Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

OutPortCorbaProvider.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00020 /*
00021  * $Log: OutPortCorbaProvider.h,v $
00022  * Revision 1.5  2007/02/04 16:56:00  n-ando
00023  * The subscription types were updated.
00024  *
00025  * Revision 1.4  2007/01/21 10:25:24  n-ando
00026  * A trivial fix.
00027  *
00028  * Revision 1.3  2007/01/14 23:01:53  n-ando
00029  * Now object reference is duplicate to set property.
00030  *
00031  * Revision 1.2  2007/01/06 17:57:35  n-ando
00032  * Interface subscription/unsubscription functions (subscribeInterface()
00033  * and unsubscribeInterface()) are added.
00034  *
00035  * Revision 1.1  2006/12/02 18:48:21  n-ando
00036  * The first commitment.
00037  *
00038  * Revision 1.1  2006/11/27 09:44:42  n-ando
00039  * The first commitment.
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       // PortProfile setting
00083       setDataType(any_var.type()->name());
00084       setInterfaceType("CORBA_Any");
00085       setDataFlowType("Push, Pull");
00086       setSubscriptionType("Flush, New, Periodic");
00087 
00088       // ConnectorProfile setting
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 };     // namespace RTC
00120 #endif // OutPortCorbaProvider_h

Generated on Fri Oct 5 05:15:59 2007 for OpenRTM by  doxygen 1.4.1