Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PortProfileHelper.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00019 /*
00020  * $Log: PortProfileHelper.h,v $
00021  * Revision 1.2  2007/04/26 15:32:25  n-ando
00022  * The header include order was modified to define _REENTRANT before
00023  * including ace/config-lite.h in Linux systems.
00024  * In ace 5.4.7 or later, _REENTRANT flag should be defined explicitly.
00025  *
00026  * Revision 1.1  2006/10/17 10:23:00  n-ando
00027  * The first commitment.
00028  *
00029  */
00030 
00031 #ifndef PortProfileHelper_h
00032 #define PortProfilehelper_h
00033 
00034 
00035 // RTC header include
00036 #include "rtm/RTC.h"
00037 #include "rtm/Util.h"
00038 
00039 // ACE includes
00040 #include <ace/Thread_Mutex.h>
00041 
00042 // CORBA header include
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     // Specialization of SequenceEx template class
00539 
00540 
00541     // PortProfile.name
00542     std::string m_name;
00543 
00544     // PortProfile.interfaces
00545     typedef SequenceEx<PortInterfaceProfileList,
00546                        PortInterfaceProfile,
00547                        ACE_Thread_Mutex> IfProfiles;
00548     IfProfiles m_ifProfiles;
00549 
00550     // PortProfile.port_ref
00551     Port_ptr m_portRef;
00552 
00553     // PortProfile.connector_profile
00554     typedef SequenceEx<ConnectorProfileList,
00555                        ConnectorProfile,
00556                        ACE_Thread_Mutex> ConnProfiles;
00557     ConnProfiles m_connProfiles ;
00558 
00559     // PortProfile.owner
00560     RTObject_ptr m_owner;
00561 
00562     // PortProfile.properties
00563     NVList m_properties;
00564 
00565     // Mutex
00566     mutable ACE_Thread_Mutex m_mutex;
00567 
00568 
00569     // Functor to find PortInterfaceProfile by name
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     // Functor to find ConnectorProfile by name
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     // Functor to find ConnectorProfile by id
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   };   // class PortProfileHelper
00606 };     // namespace RTC
00607 #endif // PortProfileHelper_h

Generated on Fri Oct 5 05:16:00 2007 for OpenRTM by  doxygen 1.4.1