Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
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
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
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);
00087 _remove_ref();
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 typedef std::list<
00121 std::pair<RTT::corba::CDataFlowInterface_var, DataFlowInterface*>
00122 > ServantMap;
00123 static ServantMap s_servant_map;
00124
00125 typedef std::list<
00126 std::pair<RTT::corba::CChannelElement_var, base::ChannelElementBase::shared_ptr>
00127 > ChannelList;
00128 ChannelList channel_list;
00129
00130 RTT::os::Mutex channel_list_mtx;
00131 public:
00132
00133 CDataFlowInterface_i(DataFlowInterface* interface, PortableServer::POA_ptr poa);
00134 virtual ~CDataFlowInterface_i();
00135
00136 static void registerServant(CDataFlowInterface_ptr objref, DataFlowInterface* obj);
00137 static void deregisterServant(DataFlowInterface* obj);
00138 static void clearServants();
00139 static DataFlowInterface* getLocalInterface(CDataFlowInterface_ptr objref);
00140
00142 void deregisterChannel(CChannelElement_ptr channel);
00143
00148 static CDataFlowInterface_ptr getRemoteInterface(DataFlowInterface* dfi, PortableServer::POA_ptr poa);
00149
00150 virtual RTT::corba::CDataFlowInterface_ptr activate_this() {
00151 PortableServer::ObjectId_var oid = mpoa->activate_object(this);
00152
00153 return _this();
00154 }
00155
00156 PortableServer::POA_ptr _default_POA();
00157
00158
00159 RTT::corba::CDataFlowInterface::CPortNames* getPorts() ACE_THROW_SPEC ((
00160 CORBA::SystemException
00161 ));
00162 RTT::corba::CDataFlowInterface::CPortDescriptions* getPortDescriptions() ACE_THROW_SPEC ((
00163 CORBA::SystemException
00164 ));
00165 RTT::corba::CPortType getPortType(const char* port_name) ACE_THROW_SPEC ((
00166 CORBA::SystemException
00167 ,::RTT::corba::CNoSuchPortException
00168 ));
00169 char* getDataType(const char* port_name) ACE_THROW_SPEC ((
00170 CORBA::SystemException
00171 ,::RTT::corba::CNoSuchPortException
00172 ));
00173 ::CORBA::Boolean isConnected(const char* port_name) ACE_THROW_SPEC ((
00174 CORBA::SystemException
00175 ,::RTT::corba::CNoSuchPortException
00176 ));
00177 ::CORBA::Boolean channelReady(const char* port_name, RTT::corba::CChannelElement_ptr channel) ACE_THROW_SPEC ((
00178 CORBA::SystemException
00179 ,::RTT::corba::CNoSuchPortException
00180 ));
00181 void disconnectPort(const char* port_name) ACE_THROW_SPEC ((
00182 CORBA::SystemException
00183 ,::RTT::corba::CNoSuchPortException
00184 ));
00185
00186 CChannelElement_ptr buildChannelOutput(const char* reader_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
00187 CORBA::SystemException
00188 ,::RTT::corba::CNoCorbaTransport
00189 ,::RTT::corba::CNoSuchPortException
00190 ));
00191 CChannelElement_ptr buildChannelInput(const char* writer_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
00192 CORBA::SystemException
00193 ,::RTT::corba::CNoCorbaTransport
00194 ,::RTT::corba::CNoSuchPortException
00195 ));
00196
00197 ::CORBA::Boolean createConnection( const char* writer_port,
00198 CDataFlowInterface_ptr reader_interface,
00199 const char* reader_port,
00200 RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
00201 CORBA::SystemException
00202 ,::RTT::corba::CNoSuchPortException
00203 ));
00204 bool removeConnection( const char* writer_port,
00205 CDataFlowInterface_ptr reader_interface,
00206 const char* reader_port) ACE_THROW_SPEC ((
00207 CORBA::SystemException
00208 ,::RTT::corba::CNoSuchPortException
00209 ));
00210
00211 ::CORBA::Boolean createStream( const char* port,
00212 RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
00213 CORBA::SystemException
00214 ,::RTT::corba::CNoSuchPortException
00215 ));
00216 void removeStream( const char* port, const char* stream_name) ACE_THROW_SPEC ((
00217 CORBA::SystemException
00218 ,::RTT::corba::CNoSuchPortException
00219 ));
00220 };
00221 }
00222 };
00223
00224
00225 #endif
00226