DataFlowI.h
Go to the documentation of this file.
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 #ifndef DATAFLOWI_H_
00039 #define DATAFLOWI_H_
00040 
00041 #include "corba.h"
00042 #ifdef CORBA_IS_TAO
00043 #include "DataFlowS.h"
00044 #else
00045 #include "DataFlowC.h"
00046 #endif
00047 #include "CorbaConversion.hpp"
00048 #include "../../base/ChannelElement.hpp"
00049 #include "../../internal/DataSources.hpp"
00050 #include "CorbaTypeTransporter.hpp"
00051 #include <list>
00052 #include <rtt/os/Mutex.hpp>
00053 
00054 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00055 #pragma once
00056 #endif /* ACE_LACKS_PRAGMA_ONCE */
00057 
00058 
00059 namespace RTT {
00060 
00061     namespace corba {
00062         class CDataFlowInterface_i;
00063 
00069         class RTT_CORBA_API CRemoteChannelElement_i
00070             : public POA_RTT::corba::CRemoteChannelElement
00071             , public virtual PortableServer::RefCountServantBase
00072         {
00073         protected:
00074             CRemoteChannelElement_var remote_side;
00075             RTT::corba::CorbaTypeTransporter const& transport;
00076             PortableServer::POA_var mpoa;
00077             CDataFlowInterface_i* mdataflow;
00078 
00079         public:
00080             // standard constructor
00081             CRemoteChannelElement_i(corba::CorbaTypeTransporter const& transport,
00082                           PortableServer::POA_ptr poa);
00083             virtual ~CRemoteChannelElement_i();
00084 
00085             virtual RTT::corba::CRemoteChannelElement_ptr activate_this() {
00086                 PortableServer::ObjectId_var oid = mpoa->activate_object(this); // ref count=2
00087                 _remove_ref(); // ref count=1
00088                 return _this();
00089             }
00090 
00091             virtual void transferSamples() = 0;
00092 
00093             void setCDataFlowInterface(CDataFlowInterface_i* dataflow) {
00094                 mdataflow = dataflow;
00095             }
00096 
00097             PortableServer::POA_ptr _default_POA();
00098 
00099             void setRemoteSide(CRemoteChannelElement_ptr remote) ACE_THROW_SPEC ((
00100                       CORBA::SystemException
00101                     ));
00102         };
00103 
00111         class RTT_CORBA_API CDataFlowInterface_i
00112             : public virtual POA_RTT::corba::CDataFlowInterface
00113         {
00114             DataFlowInterface* mdf;
00115             PortableServer::POA_var mpoa;
00116 
00120             struct ServantInfo
00121             {
00122                 RTT::corba::CDataFlowInterface_var objref;
00123                 RTT::corba::CDataFlowInterface_i* servant;
00124                 DataFlowInterface* getDataFlowInterface() const { return servant->getDataFlowInterface(); }
00125                 ServantInfo(CDataFlowInterface_var objref, CDataFlowInterface_i* servant)
00126                     : objref(objref), servant(servant) {}
00127             };
00128             typedef std::list<ServantInfo> ServantMap;
00129             static ServantMap s_servant_map;
00130 
00131             typedef std::list<
00132                 std::pair<RTT::corba::CChannelElement_var, base::ChannelElementBase::shared_ptr>
00133                 > ChannelList;
00134             ChannelList channel_list;
00135             // Lock that should be taken before access to channel_list
00136             RTT::os::Mutex channel_list_mtx;
00137         public:
00138             // standard constructor
00139             CDataFlowInterface_i(DataFlowInterface* interface, PortableServer::POA_ptr poa);
00140             virtual ~CDataFlowInterface_i();
00141 
00142             DataFlowInterface* getDataFlowInterface() const;
00143 
00144             static void registerServant(CDataFlowInterface_ptr objref, CDataFlowInterface_i* servant);
00145             static void deregisterServant(DataFlowInterface* obj);
00146             static void clearServants();
00147             static DataFlowInterface* getLocalInterface(CDataFlowInterface_ptr objref);
00148 
00150             void deregisterChannel(CChannelElement_ptr channel);
00151 
00156             static CDataFlowInterface_ptr getRemoteInterface(DataFlowInterface* dfi, PortableServer::POA_ptr poa);
00157 
00158             virtual RTT::corba::CDataFlowInterface_ptr activate_this() {
00159                  PortableServer::ObjectId_var oid = mpoa->activate_object(this); // ref count=2
00160                  //_remove_ref(); // ref count=1
00161                  return _this();
00162              }
00163 
00164             PortableServer::POA_ptr _default_POA();
00165 
00166             // methods corresponding to defined IDL attributes and operations
00167             RTT::corba::CDataFlowInterface::CPortNames* getPorts() ACE_THROW_SPEC ((
00168                       CORBA::SystemException
00169                     ));
00170             RTT::corba::CDataFlowInterface::CPortDescriptions* getPortDescriptions() ACE_THROW_SPEC ((
00171                       CORBA::SystemException
00172                     ));
00173             RTT::corba::CPortType getPortType(const char* port_name) ACE_THROW_SPEC ((
00174                       CORBA::SystemException
00175                       ,::RTT::corba::CNoSuchPortException
00176                     ));
00177             char* getDataType(const char* port_name) ACE_THROW_SPEC ((
00178                       CORBA::SystemException
00179                       ,::RTT::corba::CNoSuchPortException
00180                     ));
00181             ::CORBA::Boolean isConnected(const char* port_name) ACE_THROW_SPEC ((
00182                       CORBA::SystemException
00183                       ,::RTT::corba::CNoSuchPortException
00184                     ));
00185             ::CORBA::Boolean channelReady(const char* port_name, RTT::corba::CChannelElement_ptr channel, RTT::corba::CConnPolicy const& policy) ACE_THROW_SPEC ((
00186                       CORBA::SystemException
00187                       ,::RTT::corba::CNoSuchPortException
00188                     ));
00189             void disconnectPort(const char* port_name) ACE_THROW_SPEC ((
00190                       CORBA::SystemException
00191                       ,::RTT::corba::CNoSuchPortException
00192                     ));
00193 
00194             CChannelElement_ptr buildChannelOutput(const char* reader_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
00195                       CORBA::SystemException
00196                       ,::RTT::corba::CNoCorbaTransport
00197                       ,::RTT::corba::CNoSuchPortException
00198                     ));
00199             CChannelElement_ptr buildChannelInput(const char* writer_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
00200                       CORBA::SystemException
00201                       ,::RTT::corba::CNoCorbaTransport
00202                   ,::RTT::corba::CNoSuchPortException
00203                     ));
00204 
00205             ::CORBA::Boolean createConnection( const char* writer_port,
00206                                                CDataFlowInterface_ptr reader_interface,
00207                                                const char* reader_port,
00208                                                RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
00209                                                       CORBA::SystemException
00210                                                       ,::RTT::corba::CNoSuchPortException
00211                                                     ));
00212             bool removeConnection( const char* writer_port,
00213                                                CDataFlowInterface_ptr reader_interface,
00214                                                const char* reader_port) ACE_THROW_SPEC ((
00215                                                       CORBA::SystemException
00216                                                       ,::RTT::corba::CNoSuchPortException
00217                                                     ));
00218 
00219             ::CORBA::Boolean createStream( const char* port,
00220                                            RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
00221                                                       CORBA::SystemException
00222                                                       ,::RTT::corba::CNoSuchPortException
00223                                                     ));
00224             void removeStream( const char* port, const char* stream_name) ACE_THROW_SPEC ((
00225                       CORBA::SystemException
00226                       ,::RTT::corba::CNoSuchPortException
00227                     ));
00228         };
00229     }
00230 };
00231 
00232 
00233 #endif /* DATAFLOWI_H_  */
00234 


rtt
Author(s): RTT Developers
autogenerated on Sat Jun 8 2019 18:46:08