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 <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:
00062     PortProfileHelper();
00063     virtual ~PortProfileHelper(void);
00064 
00065 
00087     void setPortProfile(const PortProfile& profile);
00088 
00089 
00109     PortProfile* getPortProfile();
00110 
00111 
00132     void setName(const char* name);
00133 
00134 
00154     const char* getName() const;
00155 
00156 
00176     void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
00177 
00178 
00198     const PortInterfaceProfileList& getPortInterfaceProfiles() const;
00199 
00200 
00224     const PortInterfaceProfile
00225     getPortInterfaceProfile(const char* instance_name) const;
00226 
00227 
00250     void erasePortInterfaceProfile(const char* instance_name);
00251 
00252 
00273     void setPortRef(PortService_ptr port);
00274 
00275 
00296     PortService_ptr getPortRef() const;
00297 
00298 
00318     void appendConnectorProfile(ConnectorProfile conn_profile);
00319 
00320 
00341     const ConnectorProfileList getConnectorProfiles() const;
00342 
00343 
00365     const ConnectorProfile getConnectorProfile(const char* name) const;
00366 
00367 
00389     const ConnectorProfile getConnectorProfileById(const char* id) const;
00390 
00391 
00412     void eraseConnectorProfile(const char* name);
00413 
00414 
00435     void eraseConnectorProfileById(const char* id);
00436 
00437 
00457     void setOwner(RTObject_ptr owner);
00458 
00459 
00479     RTObject_ptr getOwner() const;
00480 
00481 
00501     void setProperties(NVList& prop);
00502 
00503 
00523     const NVList& getProperties() const;
00524 
00525 
00526 
00527   private:
00528     // Specialization of SequenceEx template class
00529 
00530 
00531     // PortProfile.name
00532     std::string m_name;
00533 
00534     // PortProfile.interfaces
00535     typedef SequenceEx<PortInterfaceProfileList,
00536                        PortInterfaceProfile,
00537                        Mutex> IfProfiles;
00538     IfProfiles m_ifProfiles;
00539 
00540     // PortProfile.port_ref
00541     PortService_ptr m_portRef;
00542 
00543     // PortProfile.connector_profile
00544     typedef SequenceEx<ConnectorProfileList,
00545                        ConnectorProfile,
00546                        Mutex> ConnProfiles;
00547     ConnProfiles m_connProfiles ;
00548 
00549     // PortProfile.owner
00550     RTObject_ptr m_owner;
00551 
00552     // PortProfile.properties
00553     NVList m_properties;
00554 
00555     // Mutex
00556     mutable Mutex m_mutex;
00557 
00558 
00559     // Functor to find PortInterfaceProfile by name
00560     struct if_name
00561     {
00562       if_name(const char* name) :  m_name(name) {};
00563       bool operator()(const PortInterfaceProfile& p)
00564       {
00565         std::string name(p.instance_name);
00566         return m_name == name;
00567       }
00568       const std::string m_name;
00569     };
00570 
00571     // Functor to find ConnectorProfile by name
00572     struct conn_name
00573     {
00574       conn_name(const char* name) :  m_name(name) {};
00575       bool operator()(const ConnectorProfile& c)
00576       {
00577         std::string name(c.name);
00578         return m_name == name;
00579       }
00580       const std::string m_name;
00581     };
00582     
00583     // Functor to find ConnectorProfile by id
00584     struct conn_id
00585     {
00586       conn_id(const char* id) :  m_id(id) {};
00587       bool operator()(const ConnectorProfile& c)
00588       {
00589         std::string id(c.connector_id);
00590         return m_id == id;
00591       }
00592       const std::string m_id;
00593     };
00594 
00595   };   // class PortProfileHelper
00596 };     // namespace RTC
00597 #endif // PortProfileHelper_h

Generated on Sun May 24 14:08:45 2009 for OpenRTM by  doxygen 1.5.3