DataFlowI.h

00001 /***************************************************************************
00002   tag: FMTC  do nov 2 13:06:20 CET 2006  DataFlowI.h
00003 
00004                         DataFlowI.h -  description
00005                            -------------------
00006     begin                : do november 02 2006
00007     copyright            : (C) 2006 FMTC
00008     email                : peter.soetens@fmtc.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 // -*- C++ -*-
00040 //
00041 // $Id$
00042 
00043 // ****  Code generated by the The ACE ORB (TAO) IDL Compiler ****
00044 // TAO and the TAO IDL Compiler have been developed by:
00045 //       Center for Distributed Object Computing
00046 //       Washington University
00047 //       St. Louis, MO
00048 //       USA
00049 //       http://www.cs.wustl.edu/~schmidt/doc-center.html
00050 // and
00051 //       Distributed Object Computing Laboratory
00052 //       University of California at Irvine
00053 //       Irvine, CA
00054 //       USA
00055 //       http://doc.ece.uci.edu/
00056 // and
00057 //       Institute for Software Integrated Systems
00058 //       Vanderbilt University
00059 //       Nashville, TN
00060 //       USA
00061 //       http://www.isis.vanderbilt.edu/
00062 //
00063 // Information about TAO is available at:
00064 //     http://www.cs.wustl.edu/~schmidt/TAO.html
00065 
00066 // TAO_IDL - Generated from
00067 // be/be_codegen.cpp:844
00068 
00069 #ifndef DATAFLOWI_H_
00070 #define DATAFLOWI_H_
00071 
00072 #include "../rtt-config.h"
00073 #include "corba.h"
00074 #ifdef CORBA_IS_TAO
00075 #include "DataFlowS.h"
00076 #else
00077 #include "DataFlowC.h"
00078 #endif
00079 #include "../DataFlowInterface.hpp"
00080 #include "../BufferInterface.hpp"
00081 #include "CorbaConversion.hpp"
00082 
00083 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00084 #pragma once
00085 #endif /* ACE_LACKS_PRAGMA_ONCE */
00086 
00087 /*
00088  * Represent a buffered data channel.
00089  */
00090 template< class T>
00091 class  RTT_Corba_BufferChannel_i : public virtual POA_RTT::Corba::BufferChannel, public virtual PortableServer::RefCountServantBase
00092 {
00093     typename RTT::BufferInterface<T>::shared_ptr mbuf;
00094 public:
00095   //Constructor
00096   RTT_Corba_BufferChannel_i (typename RTT::BufferInterface<T>::shared_ptr buf)
00097       : mbuf(buf)
00098     {}
00099 
00100 
00101   //Destructor
00102     virtual ~RTT_Corba_BufferChannel_i (void) {}
00103 
00104     virtual CORBA::Boolean push (const ::CORBA::Any & data)
00105         ACE_THROW_SPEC ((
00106                          CORBA::SystemException
00107                          ))
00108     {
00109         using namespace RTT;
00110         // Logger::In in("CorbaBufferChannelI::push");
00111         // log(Debug) << "Receiving buffer value."<<endlog();
00112 
00113         T value;
00114         if ( AnyConversion<T>::update( data, value ) == false ) {
00115             Logger::log() <<Logger::Error << "Could not accept remote value: wrong data type."<<Logger::endl;
00116             return false;
00117         }
00118 
00119         return mbuf->Push( value );
00120     }
00121 
00122     virtual CORBA::Boolean pull ( ::CORBA::Any_out data)
00123         ACE_THROW_SPEC ((
00124                          CORBA::SystemException
00125                          ))
00126     {
00127         using namespace RTT;
00128         // Logger::In in("CorbaBufferChannelI::pull");
00129         // log(Debug) << "Returning buffer value."<<endlog();
00130         T result;
00131         if ( mbuf->Pop( result ) == false ) {
00132             data = new CORBA::Any();
00133             return false;
00134         }
00135         CORBA::Any_var toset = AnyConversion<T>::createAny( result );
00136         data = toset._retn();
00137         return true;
00138     }
00139 
00140   virtual
00141   ::CORBA::Any_ptr front(
00142 
00143     )
00144     ACE_THROW_SPEC ((
00145       CORBA::SystemException
00146       )) {
00147       return RTT::AnyConversion<T>::createAny( mbuf->front() );
00148   }
00149 
00150   virtual
00151   CORBA::Boolean full (
00152 
00153     )
00154     ACE_THROW_SPEC ((
00155       CORBA::SystemException
00156       )) {
00157       return mbuf->full();
00158   }
00159 
00160   virtual
00161   CORBA::Boolean empty (
00162 
00163     )
00164     ACE_THROW_SPEC ((
00165       CORBA::SystemException
00166       )) {
00167       return mbuf->empty();
00168   }
00169 
00170   virtual
00171   CORBA::Long capacity (
00172 
00173     )
00174     ACE_THROW_SPEC ((
00175       CORBA::SystemException
00176       )){
00177       return mbuf->capacity();
00178   }
00179 
00180   virtual
00181   CORBA::Long size (
00182 
00183     )
00184     ACE_THROW_SPEC ((
00185       CORBA::SystemException
00186       )) {
00187       return mbuf->size();
00188   }
00189 
00190   virtual
00191   void clear (
00192 
00193     )
00194     ACE_THROW_SPEC ((
00195       CORBA::SystemException
00196       )) {
00197       mbuf->clear();
00198   }
00199 };
00200 
00204 template<>
00205 class  RTT_Corba_BufferChannel_i<RTT::detail::UnknownType> : public virtual POA_RTT::Corba::BufferChannel, public virtual PortableServer::RefCountServantBase
00206 {
00207     RTT::BufferBase::shared_ptr mbuf;
00208 public:
00209   //Constructor
00210   RTT_Corba_BufferChannel_i ( RTT::BufferBase::shared_ptr buf)
00211       : mbuf(buf)
00212     {}
00213 
00214   //Destructor
00215     virtual ~RTT_Corba_BufferChannel_i (void) {}
00216 
00217     virtual CORBA::Boolean push (const ::CORBA::Any & data)
00218         ACE_THROW_SPEC ((
00219                          CORBA::SystemException
00220                          ))
00221     {
00222         using namespace RTT;
00223         Logger::In in("CorbaBufferChannelI::push");
00224         log(Error) << "Don't know how to interprete this data type."<<endlog();
00225         return false;
00226     }
00227 
00228     virtual CORBA::Boolean pull ( ::CORBA::Any_out data)
00229         ACE_THROW_SPEC ((
00230                          CORBA::SystemException
00231                          ))
00232     {
00233         using namespace RTT;
00234         data = new CORBA::Any();
00235         Logger::In in("CorbaBufferChannelI::pull");
00236         log(Error) << "Don't know how to transfer this data type."<<endlog();
00237         return false;
00238     }
00239 
00240   virtual
00241   ::CORBA::Any_ptr front(
00242 
00243     )
00244     ACE_THROW_SPEC ((
00245       CORBA::SystemException
00246       )) {
00247       return new CORBA::Any();
00248   }
00249 
00250   virtual
00251   CORBA::Boolean full (
00252 
00253     )
00254     ACE_THROW_SPEC ((
00255       CORBA::SystemException
00256       )) {
00257       return mbuf->full();
00258   }
00259 
00260   virtual
00261   CORBA::Boolean empty (
00262 
00263     )
00264     ACE_THROW_SPEC ((
00265       CORBA::SystemException
00266       )) {
00267       return mbuf->full();
00268   }
00269 
00270   virtual
00271   CORBA::Long capacity (
00272 
00273     )
00274     ACE_THROW_SPEC ((
00275       CORBA::SystemException
00276       )){
00277       return mbuf->capacity();
00278   }
00279 
00280   virtual
00281   CORBA::Long size (
00282 
00283     )
00284     ACE_THROW_SPEC ((
00285       CORBA::SystemException
00286       )) {
00287       return mbuf->size();
00288   }
00289 
00290   virtual
00291   void clear (
00292 
00293     )
00294     ACE_THROW_SPEC ((
00295       CORBA::SystemException
00296       )) {
00297       mbuf->clear();
00298   }
00299 };
00300 
00301 
00302 class  RTT_Corba_DataFlowInterface_i : public virtual POA_RTT::Corba::DataFlowInterface, public virtual PortableServer::RefCountServantBase
00303 {
00304     RTT::DataFlowInterface* mdf;
00305 public:
00306   //Constructor
00307   RTT_Corba_DataFlowInterface_i (RTT::DataFlowInterface* dfi);
00308 
00309   //Destructor
00310   virtual ~RTT_Corba_DataFlowInterface_i (void);
00311 
00312   virtual
00313   ::RTT::Corba::DataFlowInterface::PortNames * getPorts (
00314 
00315     )
00316     ACE_THROW_SPEC ((
00317       CORBA::SystemException
00318     ));
00319 
00320   virtual
00321   ::RTT::Corba::AssignableExpression_ptr createDataChannel (
00322       const char * port_name
00323     )
00324     ACE_THROW_SPEC ((
00325       CORBA::SystemException
00326     ));
00327 
00328   virtual
00329   ::RTT::Corba::BufferChannel_ptr createBufferChannel (
00330       const char * port_name
00331     )
00332     ACE_THROW_SPEC ((
00333       CORBA::SystemException
00334     ));
00335 
00336   virtual
00337   ::RTT::Corba::Expression_ptr createDataObject (
00338       const char * port_name
00339     )
00340     ACE_THROW_SPEC ((
00341       CORBA::SystemException
00342     ));
00343 
00344   virtual
00345   ::RTT::Corba::DataFlowInterface::ConnectionModel getConnectionModel (
00346       const char * port_name
00347     )
00348     ACE_THROW_SPEC ((
00349       CORBA::SystemException
00350     ));
00351 
00352   virtual
00353   ::RTT::Corba::DataFlowInterface::PortType getPortType (
00354       const char * port_name
00355     )
00356     ACE_THROW_SPEC ((
00357       CORBA::SystemException
00358     ));
00359 
00360   virtual
00361   char* getDataType (
00362       const char * port_name
00363     )
00364     ACE_THROW_SPEC ((
00365       CORBA::SystemException
00366     ));
00367 
00368   virtual
00369   CORBA::Boolean isConnected (
00370       const char * port_name
00371     )
00372     ACE_THROW_SPEC ((
00373       CORBA::SystemException
00374     ));
00375 
00376   virtual
00377   void disconnect (
00378       const char * port_name
00379     )
00380     ACE_THROW_SPEC ((
00381       CORBA::SystemException
00382     ));
00383 
00384   virtual
00385   CORBA::Boolean connectDataPort (
00386      const char * port_name,
00387      ::RTT::Corba::AssignableExpression_ptr data
00388     )
00389     ACE_THROW_SPEC ((
00390       CORBA::SystemException
00391     ));
00392 
00393   virtual
00394   CORBA::Boolean connectBufferPort (
00395      const char * port_name,
00396      ::RTT::Corba::BufferChannel_ptr buffer
00397     )
00398     ACE_THROW_SPEC ((
00399       CORBA::SystemException
00400     ));
00401 
00402   virtual
00403   CORBA::Boolean connectPorts (
00404      const char * local_port,
00405      ::RTT::Corba::DataFlowInterface_ptr remote_ports,
00406      const char * remote_port
00407     )
00408     ACE_THROW_SPEC ((
00409       CORBA::SystemException
00410     ));
00411 };
00412 
00413 
00414 #endif /* DATAFLOWI_H_  */
00415 
Generated on Thu Dec 23 13:22:37 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3