PortProfileHelper.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #ifndef RTC_PORTPROFILEHELPER_H
00020 #define RTC_PORTPROFILEHELPER_H
00021 
00022 
00023 // RTC header include
00024 #include <rtm/RTC.h>
00025 #include <rtm/Util.h>
00026 
00027 // ACE includes
00028 #include <coil/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     typedef coil::Mutex Mutex;
00060 
00061   public:
00075     PortProfileHelper();
00091     virtual ~PortProfileHelper(void);
00092 
00093 
00115     void setPortProfile(const PortProfile& profile);
00116 
00117 
00137     PortProfile* getPortProfile();
00138 
00139 
00160     void setName(const char* name);
00161 
00162 
00182     const char* getName() const;
00183 
00184 
00204     void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
00205 
00206 
00226     const PortInterfaceProfileList& getPortInterfaceProfiles() const;
00227 
00228 
00252     const PortInterfaceProfile
00253     getPortInterfaceProfile(const char* instance_name) const;
00254 
00255 
00278     void erasePortInterfaceProfile(const char* instance_name);
00279 
00280 
00301     void setPortRef(PortService_ptr port);
00302 
00303 
00324     PortService_ptr getPortRef() const;
00325 
00326 
00346     void appendConnectorProfile(ConnectorProfile conn_profile);
00347 
00348 
00369     const ConnectorProfileList getConnectorProfiles() const;
00370 
00371 
00393     const ConnectorProfile getConnectorProfile(const char* name) const;
00394 
00395 
00417     const ConnectorProfile getConnectorProfileById(const char* id) const;
00418 
00419 
00440     void eraseConnectorProfile(const char* name);
00441 
00442 
00463     void eraseConnectorProfileById(const char* id);
00464 
00465 
00485     void setOwner(RTObject_ptr owner);
00486 
00487 
00507     RTObject_ptr getOwner() const;
00508 
00509 
00529     void setProperties(NVList& prop);
00530 
00531 
00551     const NVList& getProperties() const;
00552 
00553 
00554 
00555   private:
00556     // Specialization of SequenceEx template class
00557 
00558 
00559     // PortProfile.name
00560     std::string m_name;
00561 
00562     // PortProfile.interfaces
00563     typedef SequenceEx<PortInterfaceProfileList,
00564                        PortInterfaceProfile,
00565                        Mutex> IfProfiles;
00566     IfProfiles m_ifProfiles;
00567 
00568     // PortProfile.port_ref
00569     PortService_var m_portRef;
00570 
00571     // PortProfile.connector_profile
00572     typedef SequenceEx<ConnectorProfileList,
00573                        ConnectorProfile,
00574                        Mutex> ConnProfiles;
00575     ConnProfiles m_connProfiles ;
00576 
00577     // PortProfile.owner
00578     RTObject_var m_owner;
00579 
00580     // PortProfile.properties
00581     NVList m_properties;
00582 
00583     // Mutex
00584     mutable Mutex m_mutex;
00585 
00586 
00587     // Functor to find PortInterfaceProfile by name
00588     struct if_name
00589     {
00590       if_name(const char* name) :  m_name(name) {};
00591       bool operator()(const PortInterfaceProfile& p)
00592       {
00593         std::string name(p.instance_name);
00594         return m_name == name;
00595       }
00596       const std::string m_name;
00597     };
00598 
00599     // Functor to find ConnectorProfile by name
00600     struct conn_name
00601     {
00602       conn_name(const char* name) :  m_name(name) {};
00603       bool operator()(const ConnectorProfile& c)
00604       {
00605         std::string name(c.name);
00606         return m_name == name;
00607       }
00608       const std::string m_name;
00609     };
00610     
00611     // Functor to find ConnectorProfile by id
00612     struct conn_id
00613     {
00614       conn_id(const char* id) :  m_id(id) {};
00615       bool operator()(const ConnectorProfile& c)
00616       {
00617         std::string id(c.connector_id);
00618         return m_id == id;
00619       }
00620       const std::string m_id;
00621     };
00622 
00623   };   // class PortProfileHelper
00624 };     // namespace RTC
00625 #endif // RTC_PORTPROFILEHELPER_H


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:38