OpenRTM-aist  2.1.0
PortAdmin.h
[詳解]
1 // -*- C++ -*-
20 #ifndef RTC_PORTADMIN_H
21 #define RTC_PORTADMIN_H
22 
23 #include <rtm/idl/RTCSkel.h>
24 #include <rtm/PortBase.h>
25 #include <rtm/ObjectManager.h>
26 #include <rtm/SystemLogger.h>
27 
28 #include <string>
29 
30 namespace RTC
31 {
54  class PortAdmin
55  {
56  public:
76  PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
77 
91  virtual ~PortAdmin();
92 
113  PortServiceList* getPortServiceList() const;
114 
135  PortProfileList getPortProfileList() const;
136 
163  PortService_ptr getPortRef(const char* port_name) const;
164 
191  PortBase* getPort(const char* port_name) const;
192 
219  bool addPort(PortBase& port);
220 
247  bool addPort(PortService_ptr port);
248 
273  void registerPort(PortBase& port);
274 
299  void registerPort(PortService_ptr port);
300 
326  bool removePort(PortBase& port);
327 
353  bool removePort(PortService_ptr port);
354 
378  void deletePort(PortBase& port);
379 
403  void deletePort(PortService_ptr port);
404 
429  void deletePortByName(const char* port_name);
430 
450 
470 
489 
490  private:
498  CORBA::ORB_var m_pORB;
499 
507  PortableServer::POA_var m_pPOA;
508 
516  PortServiceList m_portRefs;
517 
525  mutable Logger rtclog;
526 
534  template <class T>
535  class comp_op
536  {
537  public:
538  explicit comp_op(const char* _name)
539  : m_name(_name)
540  {
541  }
542  explicit comp_op(T* obj)
543  : m_name(static_cast<const char*>(obj->getProfile().name))
544  {
545  }
546  bool operator()(T* obj)
547  {
548  std::string name(static_cast<const char*>(obj->getProfile().name));
549  return m_name == name;
550  }
551  private:
552  std::string m_name;
553  };
554 
562  class port_prof_collect
563  {
564  public:
565  explicit port_prof_collect(PortProfileList& p) : m_p(p) {}
566  void operator()(const PortBase* port)
567  {
568  CORBA_SeqUtil::push_back(m_p, port->getPortProfile());
569  }
570  private:
571  PortProfileList& m_p;
572  };
573 
581  class port_prof_collect2
582  {
583  public:
584  explicit port_prof_collect2(PortProfileList& p) : m_p(p) {}
585 #ifdef ORB_IS_ORBEXPRESS
586  void operator()(const PortService_var port)
587 #else
588  void operator()(const PortService_ptr port)
589 #endif
590  {
591  PortProfile* pp(port->get_port_profile());
592  CORBA_SeqUtil::push_back(m_p, *(pp));
593  delete pp;
594  }
595  private:
596  PortProfileList& m_p;
597  };
598 
599  struct find_port_name;
600  struct find_port;
601  struct del_port;
602 
603  // サーバントを直接格納するオブジェクトマネージャ
605 
606  };
607 } // namespace RTC
608 #endif // RTC_PORTADMIN_H
Object management class
RTC's Port base class
RT component logger class
オブジェクト管理用クラス
Definition: ObjectManager.h:52
Logger クラス
Definition: SystemLogger.h:101
PortAdmin クラス
Definition: PortAdmin.h:55
void deletePort(PortService_ptr port)
Port の登録を解除する
void deletePortByName(const char *port_name)
名称指定によりPort の登録を解除する
bool removePort(PortService_ptr port)
Port の登録を解除する
PortServiceList * getPortServiceList() const
Port リストの取得
void finalizePorts()
全ての Port をdeactivateし登録を削除する
virtual ~PortAdmin()
デストラクタ
PortBase * getPort(const char *port_name) const
Port のサーバントのポインタの取得
bool addPort(PortBase &port)
Port を登録する
void registerPort(PortBase &port)
Port を登録する
bool removePort(PortBase &port)
Port の登録を解除する
void activatePorts()
全ての Port のインターフェースを activates する
PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
コンストラクタ
void registerPort(PortService_ptr port)
Port を登録する
void deletePort(PortBase &port)
Port の登録を解除する
void deactivatePorts()
全ての Port のインターフェースを deactivates する
bool addPort(PortService_ptr port)
Port を登録する
PortService_ptr getPortRef(const char *port_name) const
Port のオブジェクト参照の取得
PortProfileList getPortProfileList() const
PorProfile リストの取得
Port の基底クラス
Definition: PortBase.h:132
void push_back(CorbaSequence &seq, SequenceElement elem)
CORBA sequence の最後に要素を追加する
Definition: CORBA_SeqUtil.h:175
RTコンポーネント