PortAdmin.h

説明を見る。
00001 // -*- C++ -*-
00020 #ifndef PortAdmin_h
00021 #define PortAdmin_h
00022 
00023 #include <rtm/idl/RTCSkel.h>
00024 #include <rtm/PortBase.h>
00025 #include <rtm/ObjectManager.h>
00026 
00027 namespace RTC
00028 {
00052   class PortAdmin
00053   {
00054   public:
00074     PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00075     
00089     virtual ~PortAdmin(void){};
00090     
00111     PortServiceList* getPortServiceList() const;
00112     
00133     PortProfileList getPortProfileList() const;
00134     
00163     PortService_ptr getPortRef(const char* port_name) const;
00164     
00193     PortBase* getPort(const char* port_name) const;
00194     
00219     void registerPort(PortBase& port);
00220     void registerPort(PortService_ptr port);
00221     
00245     void deletePort(PortBase& port);
00246     void deletePort(PortService_ptr port);
00247     
00271     void deletePortByName(const char* port_name);
00272 
00291     void activatePorts();
00292 
00311     void deactivatePorts();
00312 
00330     void finalizePorts();
00331     
00332   private:
00333     // ORB へのポインタ
00334     CORBA::ORB_var m_pORB;
00335     
00336     // POA へのポインタ
00337     PortableServer::POA_var m_pPOA;
00338     
00339     // Portのオブジェクトリファレンスのリスト. PortServiceList
00340     PortServiceList m_portRefs;
00341     
00342     
00343     template <class T>
00344     class comp_op
00345     {
00346     public:
00347       comp_op(const char* _name)
00348         : m_name(_name)
00349       {
00350       }
00351       comp_op(T* obj) 
00352         : m_name((const char*)(obj->getProfile().name))
00353       {
00354       }
00355       bool operator()(T* obj)
00356       {
00357         std::string name((const char*)obj->getProfile().name);
00358         return m_name == name;
00359       }
00360     private:
00361       std::string m_name;
00362     };
00363     
00364     class port_prof_collect
00365     {
00366     public:
00367       port_prof_collect(PortProfileList& p) : m_p(p) {}
00368       void operator()(const PortBase* port)
00369       {
00370         CORBA_SeqUtil::push_back(m_p, port->getPortProfile());
00371       }
00372     private:
00373       PortProfileList& m_p;
00374     };
00375 
00376     class port_prof_collect2
00377     {
00378     public:
00379       port_prof_collect2(PortProfileList& p) : m_p(p) {}
00380       void operator()(const PortService_ptr port)
00381       {
00382         PortProfile* pp(port->get_port_profile());
00383         CORBA_SeqUtil::push_back(m_p, *(pp));
00384         delete pp;
00385       }
00386     private:
00387       PortProfileList& m_p;
00388     };
00389     
00390     struct find_port_name;
00391     struct del_port;
00392     
00393     // サーバントを直接格納するオブジェクトマネージャ
00394     ObjectManager<const char*, PortBase, comp_op<PortBase> > m_portServants;
00395     
00396   };
00397 };     // namespace RTC
00398 #endif // PortAdmin_h

OpenRTMに対してSun May 24 14:08:25 2009に生成されました。  doxygen 1.5.3