00001
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef PortProfileHelper_h
00027 #define PortProfilehelper_h
00028
00029
00030
00031 #include <ace/Thread_Mutex.h>
00032
00033
00034
00035 #include "rtm/idl/RTCSkel.h"
00036
00037
00038
00039 #include "rtm/RTC.h"
00040 #include "rtm/Util.h"
00041
00042
00043 namespace RTC
00044 {
00064 class PortProfileHelper
00065 {
00066 public:
00067 PortProfileHelper();
00068 virtual ~PortProfileHelper();
00069
00070
00092 void setPortProfile(const PortProfile& profile);
00093
00094
00114 PortProfile* getPortProfile();
00115
00116
00137 void setName(const char* name);
00138
00139
00159 const char* getName() const;
00160
00161
00181 void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
00182
00183
00203 const PortInterfaceProfileList& getPortInterfaceProfiles() const;
00204
00205
00229 const PortInterfaceProfile
00230 getPortInterfaceProfile(const char* instance_name) const;
00231
00232
00255 void erasePortInterfaceProfile(const char* instance_name);
00256
00257
00278 void setPortRef(Port_ptr port);
00279
00280
00301 Port_ptr getPortRef() const;
00302
00303
00323 void appendConnectorProfile(ConnectorProfile conn_profile);
00324
00325
00346 const ConnectorProfileList getConnectorProfiles() const;
00347
00348
00370 const ConnectorProfile getConnectorProfile(const char* name) const;
00371
00372
00394 const ConnectorProfile getConnectorProfileById(const char* id) const;
00395
00396
00417 void eraseConnectorProfile(const char* name);
00418
00419
00440 void eraseConnectorProfileById(const char* id);
00441
00442
00462 void setOwner(RTObject_ptr owner);
00463
00464
00484 RTObject_ptr getOwner() const;
00485
00486
00506 void setProperties(NVList& prop);
00507
00508
00528 const NVList& getProperties() const;
00529
00530
00531
00532 private:
00533
00534
00535
00536
00537 std::string m_name;
00538
00539
00540 typedef SequenceEx<PortInterfaceProfileList,
00541 PortInterfaceProfile,
00542 ACE_Thread_Mutex> IfProfiles;
00543 IfProfiles m_ifProfiles;
00544
00545
00546 Port_ptr m_portRef;
00547
00548
00549 typedef SequenceEx<ConnectorProfileList,
00550 ConnectorProfile,
00551 ACE_Thread_Mutex> ConnProfiles;
00552 ConnProfiles m_connProfiles ;
00553
00554
00555 RTObject_ptr m_owner;
00556
00557
00558 NVList m_properties;
00559
00560
00561 mutable ACE_Thread_Mutex m_mutex;
00562
00563
00564
00565 struct if_name
00566 {
00567 if_name(const char* name) : m_name(name) {};
00568 bool operator()(const PortInterfaceProfile& p)
00569 {
00570 std::string name(p.instance_name);
00571 return m_name == name;
00572 }
00573 const std::string m_name;
00574 };
00575
00576
00577 struct conn_name
00578 {
00579 conn_name(const char* name) : m_name(name) {};
00580 bool operator()(const ConnectorProfile& c)
00581 {
00582 std::string name(c.name);
00583 return m_name == name;
00584 }
00585 const std::string m_name;
00586 };
00587
00588
00589 struct conn_id
00590 {
00591 conn_id(const char* id) : m_id(id) {};
00592 bool operator()(const ConnectorProfile& c)
00593 {
00594 std::string id(c.connector_id);
00595 return m_id == id;
00596 }
00597 const std::string m_id;
00598 };
00599
00600 };
00601 };
00602 #endif // PortProfileHelper_h