OpenRTM-aist  2.1.0
PortProfileHelper.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef RTC_PORTPROFILEHELPER_H
20 #define RTC_PORTPROFILEHELPER_H
21 
22 
23 // RTC header include
24 #include <rtm/RTC.h>
25 #include <rtm/Util.h>
26 
27 // ACE includes
28 
29 // CORBA header include
30 #include <rtm/idl/RTCSkel.h>
31 
32 #include <string>
33 
34 
35 
36 namespace RTC
37 {
58  {
59 
60  public:
90  virtual ~PortProfileHelper(void);
91 
92 
114  void setPortProfile(const PortProfile& profile);
115 
116 
136  PortProfile* getPortProfile();
137 
138 
159  void setName(const char* name);
160 
161 
181  const char* getName() const;
182 
183 
203  void appendPortInterfaceProfile(PortInterfaceProfile if_prof);
204 
205 
225  const PortInterfaceProfileList& getPortInterfaceProfiles() const;
226 
227 
251  const PortInterfaceProfile
252  getPortInterfaceProfile(const char* instance_name) const;
253 
254 
277  void erasePortInterfaceProfile(const char* instance_name);
278 
279 
300  void setPortRef(PortService_ptr port);
301 
302 
323  PortService_ptr getPortRef() const;
324 
325 
345  void appendConnectorProfile(ConnectorProfile conn_profile);
346 
347 
368  const ConnectorProfileList getConnectorProfiles() const;
369 
370 
392  const ConnectorProfile getConnectorProfile(const char* name) const;
393 
394 
416  const ConnectorProfile getConnectorProfileById(const char* id) const;
417 
418 
439  void eraseConnectorProfile(const char* name);
440 
441 
462  void eraseConnectorProfileById(const char* id);
463 
464 
484  void setOwner(RTObject_ptr owner);
485 
486 
506  RTObject_ptr getOwner() const;
507 
508 
528  void setProperties(NVList& prop);
529 
530 
550  const NVList& getProperties() const;
551 
552 
553 
554  private:
555  // Specialization of SequenceEx template class
556 
557 
558  // PortProfile.name
559  std::string m_name;
560 
561  // PortProfile.interfaces
562  using IfProfiles = SequenceEx<PortInterfaceProfileList,
563  PortInterfaceProfile,
564  std::mutex>;
565  IfProfiles m_ifProfiles;
566 
567  // PortProfile.port_ref
568  PortService_var m_portRef;
569 
570  // PortProfile.connector_profile
571  using ConnProfiles = SequenceEx<ConnectorProfileList,
572  ConnectorProfile,
573  std::mutex>;
574  ConnProfiles m_connProfiles;
575 
576  // PortProfile.owner
577  RTObject_var m_owner;
578 
579  // PortProfile.properties
580  NVList m_properties;
581 
582  mutable std::mutex m_mutex;
583 
584 
585  // Functor to find PortInterfaceProfile by name
586  struct if_name
587  {
588  explicit if_name(const char* name) : m_name(name) {}
589  bool operator()(const PortInterfaceProfile& p)
590  {
591  std::string name(p.instance_name);
592  return m_name == name;
593  }
594  const std::string m_name;
595  };
596 
597  // Functor to find ConnectorProfile by name
598  struct conn_name
599  {
600  explicit conn_name(const char* name) : m_name(name) {}
601  bool operator()(const ConnectorProfile& c)
602  {
603  std::string name(c.name);
604  return m_name == name;
605  }
606  const std::string m_name;
607  };
608 
609  // Functor to find ConnectorProfile by id
610  struct conn_id
611  {
612  explicit conn_id(const char* id) : m_id(id) {}
613  bool operator()(const ConnectorProfile& c)
614  {
615  std::string id(c.connector_id);
616  return m_id == id;
617  }
618  const std::string m_id;
619  };
620 
621  }; // class PortProfileHelper
622 } // namespace RTC
623 #endif // RTC_PORTPROFILEHELPER_H
RTComponent header.
PortProfile helper class.
Definition: PortProfileHelper.h:58
void eraseConnectorProfile(const char *name)
Erase ConnectorProfile.
const ConnectorProfileList getConnectorProfiles() const
Get ConnectorProfileList.
void erasePortInterfaceProfile(const char *instance_name)
Erase PortInterfaceProfile from the PortProfile.
void appendPortInterfaceProfile(PortInterfaceProfile if_prof)
Append PortInterfaceProfile to the PortProfile.
const PortInterfaceProfileList & getPortInterfaceProfiles() const
Get PortInterfaceProfileList.
RTObject_ptr getOwner() const
Get owner's object reference from the PortProfile.
const char * getName() const
Get PortProfile.name.
void eraseConnectorProfileById(const char *id)
Erase ConnectorProfile.
const NVList & getProperties() const
Get properties of the PortProfile.
void setPortRef(PortService_ptr port)
Set Port's object reference.
const ConnectorProfile getConnectorProfileById(const char *id) const
Get ConnectorProfile.
PortProfileHelper()
Constructor.
PortProfile * getPortProfile()
Get PortProfile.
virtual ~PortProfileHelper(void)
Destructor.
const ConnectorProfile getConnectorProfile(const char *name) const
Get ConnectorProfile.
void setOwner(RTObject_ptr owner)
Set owner's object reference to the PortProfile.
void setName(const char *name)
Set PortProfile.name.
void setPortProfile(const PortProfile &profile)
Set PortProfile.
void setProperties(NVList &prop)
Set properties to the PortProfile.
const PortInterfaceProfile getPortInterfaceProfile(const char *instance_name) const
Get PortInterfaceProfile.
PortService_ptr getPortRef() const
Get Port's object reference.
void appendConnectorProfile(ConnectorProfile conn_profile)
Append ConnectorProfile.
RT-Component.