00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PortProfileHelper_h
00032 #define PortProfilehelper_h
00033
00034
00035
00036 #include "rtm/RTC.h"
00037 #include "rtm/Util.h"
00038
00039
00040 #include <ace/Thread_Mutex.h>
00041
00042
00043 #include "rtm/idl/RTCSkel.h"
00044
00045
00046
00047
00048 namespace RTC
00049 {
00069 class PortProfileHelper
00070 {
00071 public:
00072 PortProfileHelper();
00073 virtual ~PortProfileHelper();
00074
00075
00097 void setPortProfile(const PortProfile& profile);
00098
00099
00119 PortProfile* getPortProfile();
00120
00121
00142 void setName(const char* name);
00143
00144
00164 const char* getName() const;
00165
00166
00186 void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
00187
00188
00208 const PortInterfaceProfileList& getPortInterfaceProfiles() const;
00209
00210
00234 const PortInterfaceProfile
00235 getPortInterfaceProfile(const char* instance_name) const;
00236
00237
00260 void erasePortInterfaceProfile(const char* instance_name);
00261
00262
00283 void setPortRef(Port_ptr port);
00284
00285
00306 Port_ptr getPortRef() const;
00307
00308
00328 void appendConnectorProfile(ConnectorProfile conn_profile);
00329
00330
00351 const ConnectorProfileList getConnectorProfiles() const;
00352
00353
00375 const ConnectorProfile getConnectorProfile(const char* name) const;
00376
00377
00399 const ConnectorProfile getConnectorProfileById(const char* id) const;
00400
00401
00422 void eraseConnectorProfile(const char* name);
00423
00424
00445 void eraseConnectorProfileById(const char* id);
00446
00447
00467 void setOwner(RTObject_ptr owner);
00468
00469
00489 RTObject_ptr getOwner() const;
00490
00491
00511 void setProperties(NVList& prop);
00512
00513
00533 const NVList& getProperties() const;
00534
00535
00536
00537 private:
00538
00539
00540
00541
00542 std::string m_name;
00543
00544
00545 typedef SequenceEx<PortInterfaceProfileList,
00546 PortInterfaceProfile,
00547 ACE_Thread_Mutex> IfProfiles;
00548 IfProfiles m_ifProfiles;
00549
00550
00551 Port_ptr m_portRef;
00552
00553
00554 typedef SequenceEx<ConnectorProfileList,
00555 ConnectorProfile,
00556 ACE_Thread_Mutex> ConnProfiles;
00557 ConnProfiles m_connProfiles ;
00558
00559
00560 RTObject_ptr m_owner;
00561
00562
00563 NVList m_properties;
00564
00565
00566 mutable ACE_Thread_Mutex m_mutex;
00567
00568
00569
00570 struct if_name
00571 {
00572 if_name(const char* name) : m_name(name) {};
00573 bool operator()(const PortInterfaceProfile& p)
00574 {
00575 std::string name(p.instance_name);
00576 return m_name == name;
00577 }
00578 const std::string m_name;
00579 };
00580
00581
00582 struct conn_name
00583 {
00584 conn_name(const char* name) : m_name(name) {};
00585 bool operator()(const ConnectorProfile& c)
00586 {
00587 std::string name(c.name);
00588 return m_name == name;
00589 }
00590 const std::string m_name;
00591 };
00592
00593
00594 struct conn_id
00595 {
00596 conn_id(const char* id) : m_id(id) {};
00597 bool operator()(const ConnectorProfile& c)
00598 {
00599 std::string id(c.connector_id);
00600 return m_id == id;
00601 }
00602 const std::string m_id;
00603 };
00604
00605 };
00606 };
00607 #endif // PortProfileHelper_h