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 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
00136 RTT::os::Mutex channel_list_mtx;
00137 public:
00138
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);
00160
00161 return _this();
00162 }
00163
00164 PortableServer::POA_ptr _default_POA();
00165
00166
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
00234