00001
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef OutPortCorbaProvider_h
00038 #define OutPortCorbaProvider_h
00039
00040 #include <rtm/idl/DataPortSkel.h>
00041 #include <rtm/BufferBase.h>
00042 #include <rtm/OutPortProvider.h>
00043
00044 namespace RTC
00045 {
00055 template <class DataType>
00056 class OutPortCorbaProvider
00057 : public OutPortProvider,
00058 public virtual POA_RTC::OutPortAny,
00059 public virtual PortableServer::RefCountServantBase
00060 {
00061 public:
00069 OutPortCorbaProvider(BufferBase<DataType>& buffer)
00070 : m_buffer(buffer)
00071 {
00072 CORBA::Any any_var;
00073 DataType tmp_var;
00074 any_var <<= tmp_var;
00075
00076
00077 setDataType(any_var.type()->name());
00078 setInterfaceType("CORBA_Any");
00079 setDataFlowType("Push, Pull");
00080 setSubscriptionType("Any");
00081
00082
00083 m_objref = this->_this();
00084 CORBA_SeqUtil::push_back(m_properties,
00085 NVUtil::newNV("dataport.corba_any.outport_ref",
00086 RTC::OutPortAny::_duplicate(m_objref)));
00087 }
00088
00096 virtual ~OutPortCorbaProvider()
00097 {}
00098
00099 CORBA::Any* get()
00100 {
00101 DataType data;
00102 CORBA::Any_var tmp = new CORBA::Any();
00103 m_buffer.read(data);
00104 tmp <<= data;
00105 return tmp._retn();
00106 }
00107
00108
00109 private:
00110 BufferBase<DataType>& m_buffer;
00111 OutPortAny_var m_objref;
00112 };
00113 };
00114 #endif // OutPortCorbaProvider_h
00115