00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef PortAdmin_h
00040 #define PortAdmin_h
00041
00042 #include <rtm/idl/RTCSkel.h>
00043 #include <rtm/PortBase.h>
00044 #include <rtm/ObjectManager.h>
00045
00046
00047
00048 namespace RTC
00049 {
00050
00051
00052 class PortAdmin
00053 {
00054 public:
00055 PortAdmin(CORBA::ORB_ptr, PortableServer::POA_ptr poa);
00056 virtual ~PortAdmin(){};
00057
00078 PortList* getPortList() const;
00079
00104 Port_ptr getPortRef(const char* port_name) const;
00105
00106
00131 PortBase* getPort(const char* port_name) const;
00132
00133
00158 void registerPort(PortBase& port);
00159
00160
00184 void deletePort(PortBase& port);
00185
00209 void deletePortByName(const char* port_name);
00210
00211
00229 void finalizePorts();
00230
00231 private:
00232
00233 CORBA::ORB_var m_pORB;
00234
00235
00236 PortableServer::POA_var m_pPOA;
00237
00238
00239 PortList m_portRefs;
00240
00241
00242 template <class T>
00243 class comp_op
00244 {
00245 public:
00246 comp_op(std::string _name) : m_name(_name) {};
00247 comp_op(T* obj) : m_name((const char*)obj->getProfile().name) {};
00248 bool operator()(T* obj)
00249 {
00250 std::string name((const char*)obj->getProfile().name);
00251 return m_name == name;
00252 }
00253 std::string m_name;
00254 };
00255
00256 struct find_port_name;
00257 struct del_port;
00258
00259
00260 ObjectManager<std::string, PortBase, comp_op<PortBase> > m_portServants;
00261
00262
00263 };
00264 };
00265 #endif // PortAdmin_h