メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ

InPortCorbaProvider.h

説明を見る。
00001 // -*- C++ -*-
00020 /*
00021  * $Log: InPortCorbaProvider.h,v $
00022  * Revision 1.4  2007/01/21 09:48:08  n-ando
00023  * A method to advertise interface profile was changed.
00024  *
00025  * Revision 1.3  2007/01/14 23:01:47  n-ando
00026  * Now object reference is duplicate to set property.
00027  *
00028  * Revision 1.2  2007/01/06 17:52:54  n-ando
00029  * Interface and its profile publish functions (publishInterfaceProfile()
00030  * and publishInterface()) are added.
00031  *
00032  * Revision 1.1  2006/12/02 18:41:02  n-ando
00033  * InPortCorbaProvider class is an implementation of InPortAny.
00034  *
00035  */
00036 
00037 #ifndef InPortCorbaProvider_h
00038 #define InPortCorbaProvider_h
00039 
00040 #include <rtm/idl/DataPortSkel.h>
00041 #include <rtm/BufferBase.h>
00042 #include <rtm/InPortProvider.h>
00043 
00044 namespace RTC
00045 {
00055   template <class DataType>
00056   class InPortCorbaProvider
00057     : public InPortProvider,
00058       public virtual POA_RTC::InPortAny,
00059       public virtual PortableServer::RefCountServantBase
00060   {
00061   public:
00069     InPortCorbaProvider(BufferBase<DataType>& buffer)
00070       : m_buffer(buffer)
00071     {
00072       CORBA::Any any_var;
00073       DataType   tmp_var;
00074       any_var <<= tmp_var;
00075       
00076       // PortProfile setting
00077       setDataType(any_var.type()->name());
00078       setInterfaceType("CORBA_Any");
00079       setDataFlowType("Push, Pull");
00080       setSubscriptionType("Any");
00081 
00082       // ConnectorProfile setting
00083       m_objref = this->_this();
00084       //      CORBA_SeqUtil::push_back(m_properties,
00085       //               NVUtil::newNV("dataport.corba_any.inport_ref",
00086       //                     RTC::InPortAny::_duplicate(m_objref)));
00087     }
00088 
00089     void publishInterface(SDOPackage::NVList& prop)
00090     {
00091       if (!NVUtil::isStringValue(prop,
00092                                  "dataport.interface_type",
00093                                  "CORBA_Any"))
00094         {
00095           return;
00096         }
00097       SDOPackage::NVList nv(m_properties);
00098       CORBA_SeqUtil::push_back(nv,
00099                                NVUtil::newNV("dataport.corba_any.inport_ref",
00100                                              RTC::InPortAny::_duplicate(m_objref)));
00101       
00102       NVUtil::append(prop, nv);
00103     }
00104 
00105 
00106     virtual ~InPortCorbaProvider()
00107     {
00108     }
00109 
00110     virtual void put(const CORBA::Any& data)
00111     {
00112       DataType* tmp;
00113       if (data >>= tmp)
00114         {
00115           m_buffer.write(*tmp);
00116         }
00117       return;
00118     }
00119   private:
00120     BufferBase<DataType>& m_buffer;
00121     RTC::InPortAny_var m_objref;
00122   };
00123 
00124 
00125 };     // namespace RTC
00126 #endif // InPortCorbaProvider_h
00127 

OpenRTMに対してFri Oct 5 05:14:57 2007に生成されました。  doxygen 1.4.1