PortAdmin.h

Go to the documentation of this file.
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(){};
00090     
00111     PortList* getPortList() const;
00112     
00133     PortProfileList getPortProfileList() const;
00134     
00163     Port_ptr getPortRef(const char* port_name) const;
00164     
00193     PortBase* getPort(const char* port_name) const;
00194     
00219     void registerPort(PortBase& port);
00220     
00244     void deletePort(PortBase& port);
00245     
00269     void deletePortByName(const char* port_name);
00270     
00288     void finalizePorts();
00289     
00290   private:
00291     // ORB へのポインタ
00292     CORBA::ORB_var m_pORB;
00293     
00294     // POA へのポインタ
00295     PortableServer::POA_var m_pPOA;
00296     
00297     // Portのオブジェクトリファレンスのリスト. PortList
00298     PortList m_portRefs;
00299     
00300     
00301     template <class T>
00302     class comp_op
00303     {
00304     public:
00305       comp_op(const char* _name)
00306         : m_name(_name)
00307       {
00308       }
00309       comp_op(T* obj) 
00310         : m_name((const char*)(obj->getProfile().name))
00311       {
00312       }
00313       bool operator()(T* obj)
00314       {
00315         std::string name((const char*)obj->getProfile().name);
00316         return m_name == name;
00317       }
00318     private:
00319       std::string m_name;
00320     };
00321     
00322     class port_prof_collect
00323     {
00324     public:
00325       port_prof_collect(PortProfileList& p) : m_p(p) {}
00326       void operator()(const PortBase* port)
00327       {
00328         CORBA_SeqUtil::push_back(m_p, port->getPortProfile());
00329       }
00330     private:
00331       PortProfileList& m_p;
00332     };
00333     
00334     struct find_port_name;
00335     struct del_port;
00336     
00337     // サーバントを直接格納するオブジェクトマネージャ
00338     ObjectManager<const char*, PortBase, comp_op<PortBase> > m_portServants;
00339     
00340   };
00341 };     // namespace RTC
00342 #endif // PortAdmin_h

Generated on Wed May 21 05:17:34 2008 for OpenRTM by  doxygen 1.5.3