PortProfileHelper.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #ifndef PortProfileHelper_h
00020 #define PortProfilehelper_h
00021 
00022 
00023 // RTC header include
00024 #include "rtm/RTC.h"
00025 #include "rtm/Util.h"
00026 
00027 // ACE includes
00028 #include <ace/Thread_Mutex.h>
00029 
00030 // CORBA header include
00031 #include "rtm/idl/RTCSkel.h"
00032 
00033 
00034 
00035 
00036 namespace RTC
00037 {
00057   class PortProfileHelper
00058   {
00059   public:
00060     PortProfileHelper();
00061     virtual ~PortProfileHelper();
00062 
00063 
00085     void setPortProfile(const PortProfile& profile);
00086 
00087 
00107     PortProfile* getPortProfile();
00108 
00109 
00130     void setName(const char* name);
00131 
00132 
00152     const char* getName() const;
00153 
00154 
00174     void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
00175 
00176 
00196     const PortInterfaceProfileList& getPortInterfaceProfiles() const;
00197 
00198 
00222     const PortInterfaceProfile
00223     getPortInterfaceProfile(const char* instance_name) const;
00224 
00225 
00248     void erasePortInterfaceProfile(const char* instance_name);
00249 
00250 
00271     void setPortRef(Port_ptr port);
00272 
00273 
00294     Port_ptr getPortRef() const;
00295 
00296 
00316     void appendConnectorProfile(ConnectorProfile conn_profile);
00317 
00318 
00339     const ConnectorProfileList getConnectorProfiles() const;
00340 
00341 
00363     const ConnectorProfile getConnectorProfile(const char* name) const;
00364 
00365 
00387     const ConnectorProfile getConnectorProfileById(const char* id) const;
00388 
00389 
00410     void eraseConnectorProfile(const char* name);
00411 
00412 
00433     void eraseConnectorProfileById(const char* id);
00434 
00435 
00455     void setOwner(RTObject_ptr owner);
00456 
00457 
00477     RTObject_ptr getOwner() const;
00478 
00479 
00499     void setProperties(NVList& prop);
00500 
00501 
00521     const NVList& getProperties() const;
00522 
00523 
00524 
00525   private:
00526     // Specialization of SequenceEx template class
00527 
00528 
00529     // PortProfile.name
00530     std::string m_name;
00531 
00532     // PortProfile.interfaces
00533     typedef SequenceEx<PortInterfaceProfileList,
00534                        PortInterfaceProfile,
00535                        ACE_Thread_Mutex> IfProfiles;
00536     IfProfiles m_ifProfiles;
00537 
00538     // PortProfile.port_ref
00539     Port_ptr m_portRef;
00540 
00541     // PortProfile.connector_profile
00542     typedef SequenceEx<ConnectorProfileList,
00543                        ConnectorProfile,
00544                        ACE_Thread_Mutex> ConnProfiles;
00545     ConnProfiles m_connProfiles ;
00546 
00547     // PortProfile.owner
00548     RTObject_ptr m_owner;
00549 
00550     // PortProfile.properties
00551     NVList m_properties;
00552 
00553     // Mutex
00554     mutable ACE_Thread_Mutex m_mutex;
00555 
00556 
00557     // Functor to find PortInterfaceProfile by name
00558     struct if_name
00559     {
00560       if_name(const char* name) :  m_name(name) {};
00561       bool operator()(const PortInterfaceProfile& p)
00562       {
00563         std::string name(p.instance_name);
00564         return m_name == name;
00565       }
00566       const std::string m_name;
00567     };
00568 
00569     // Functor to find ConnectorProfile by name
00570     struct conn_name
00571     {
00572       conn_name(const char* name) :  m_name(name) {};
00573       bool operator()(const ConnectorProfile& c)
00574       {
00575         std::string name(c.name);
00576         return m_name == name;
00577       }
00578       const std::string m_name;
00579     };
00580     
00581     // Functor to find ConnectorProfile by id
00582     struct conn_id
00583     {
00584       conn_id(const char* id) :  m_id(id) {};
00585       bool operator()(const ConnectorProfile& c)
00586       {
00587         std::string id(c.connector_id);
00588         return m_id == id;
00589       }
00590       const std::string m_id;
00591     };
00592 
00593   };   // class PortProfileHelper
00594 };     // namespace RTC
00595 #endif // PortProfileHelper_h

Generated on Thu May 29 15:03:33 2008 for OpenRTM by  doxygen 1.5.3