00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef PortAdmin_h
00043 #define PortAdmin_h
00044
00045 #include <rtm/idl/RTCSkel.h>
00046 #include <rtm/PortBase.h>
00047 #include <rtm/ObjectManager.h>
00048
00049
00050
00051 namespace RTC
00052 {
00053
00054
00055 class PortAdmin
00056 {
00057 public:
00058 PortAdmin(CORBA::ORB_ptr, PortableServer::POA_ptr poa);
00059 virtual ~PortAdmin(){};
00060
00081 PortList* getPortList() const;
00082
00107 Port_ptr getPortRef(const char* port_name) const;
00108
00109
00134 PortBase* getPort(const char* port_name) const;
00135
00136
00161 void registerPort(PortBase& port);
00162
00163
00187 void deletePort(PortBase& port);
00188
00212 void deletePortByName(const char* port_name);
00213
00214
00232 void finalizePorts();
00233
00234 private:
00235
00236 CORBA::ORB_var m_pORB;
00237
00238
00239 PortableServer::POA_var m_pPOA;
00240
00241
00242 PortList m_portRefs;
00243
00244
00245 template <class T>
00246 class comp_op
00247 {
00248 public:
00249 comp_op(const char* _name)
00250 :
00251 m_name(_name)
00252 {
00253 }
00254 comp_op(T* obj)
00255 : m_name((const char*)(obj->getProfile().name))
00256 {
00257 }
00258 bool operator()(T* obj)
00259 {
00260 std::string name((const char*)obj->getProfile().name);
00261 return m_name == name;
00262 }
00263 private:
00264 std::string m_name;
00265 };
00266
00267 struct find_port_name;
00268 struct del_port;
00269
00270
00271 ObjectManager<const char*, PortBase, comp_op<PortBase> > m_portServants;
00272
00273
00274 };
00275 };
00276 #endif // PortAdmin_h