00001
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef OutPortCorbaProvider_h
00044 #define OutPortCorbaProvider_h
00045
00046 #include <rtm/idl/DataPortSkel.h>
00047 #include <rtm/BufferBase.h>
00048 #include <rtm/OutPortProvider.h>
00049
00050 namespace RTC
00051 {
00061 template <class DataType>
00062 class OutPortCorbaProvider
00063 : public OutPortProvider,
00064 public virtual POA_RTC::OutPortAny,
00065 public virtual PortableServer::RefCountServantBase
00066 {
00067 public:
00075 OutPortCorbaProvider(BufferBase<DataType>& buffer)
00076 : m_buffer(buffer)
00077 {
00078 CORBA::Any any_var;
00079 DataType tmp_var;
00080 any_var <<= tmp_var;
00081
00082
00083 setDataType(any_var.type()->name());
00084 setInterfaceType("CORBA_Any");
00085 setDataFlowType("Push, Pull");
00086 setSubscriptionType("Flush, New, Periodic");
00087
00088
00089 m_objref = this->_this();
00090 CORBA_SeqUtil::push_back(m_properties,
00091 NVUtil::newNV("dataport.corba_any.outport_ref",
00092 m_objref));
00093 }
00094
00102 virtual ~OutPortCorbaProvider()
00103 {}
00104
00105 CORBA::Any* get()
00106 {
00107 DataType data;
00108 CORBA::Any_var tmp = new CORBA::Any();
00109 m_buffer.read(data);
00110 tmp <<= data;
00111 return tmp._retn();
00112 }
00113
00114
00115 private:
00116 BufferBase<DataType>& m_buffer;
00117 OutPortAny_var m_objref;
00118 };
00119 };
00120 #endif // OutPortCorbaProvider_h