PortAdmin.h
Go to the documentation of this file.
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 namespace RTC
29 {
52  class PortAdmin
53  {
54  public:
74  PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
75 
89  virtual ~PortAdmin(void){};
90 
112 
134 
161  PortService_ptr getPortRef(const char* port_name) const;
162 
189  PortBase* getPort(const char* port_name) const;
190 
217  bool addPort(PortBase& port);
218 
245  bool addPort(PortService_ptr port);
246 
271  void registerPort(PortBase& port);
272 
297  void registerPort(PortService_ptr port);
298 
324  bool removePort(PortBase& port);
325 
351  bool removePort(PortService_ptr port);
352 
376  void deletePort(PortBase& port);
377 
401  void deletePort(PortService_ptr port);
402 
427  void deletePortByName(const char* port_name);
428 
447  void activatePorts();
448 
467  void deactivatePorts();
468 
486  void finalizePorts();
487 
488  private:
496  CORBA::ORB_var m_pORB;
497 
505  PortableServer::POA_var m_pPOA;
506 
515 
523  mutable Logger rtclog;
524 
532  template <class T>
533  class comp_op
534  {
535  public:
536  comp_op(const char* _name)
537  : m_name(_name)
538  {
539  }
540  comp_op(T* obj)
541  : m_name((const char*)(obj->getProfile().name))
542  {
543  }
544  bool operator()(T* obj)
545  {
546  std::string name((const char*)obj->getProfile().name);
547  return m_name == name;
548  }
549  private:
550  std::string m_name;
551  };
552 
561  {
562  public:
564  void operator()(const PortBase* port)
565  {
567  }
568  private:
570  };
571 
580  {
581  public:
583  void operator()(const PortService_ptr port)
584  {
585  PortProfile* pp(port->get_port_profile());
586  CORBA_SeqUtil::push_back(m_p, *(pp));
587  delete pp;
588  }
589  private:
591  };
592 
593  struct find_port_name;
594  struct find_port;
595  struct del_port;
596 
597  // サーバントを直接格納するオブジェクトマネージャ ObjectManager<const char*, PortBase, comp_op<PortBase> > m_portServants; }; }; // namespace RTC #endif // RTC_PORTADMIN_H
599 
600  };
601 }; // namespace RTC
602 #endif // RTC_PORTADMIN_H
RTC&#39;s Port base class.
port_prof_collect(PortProfileList &p)
Definition: PortAdmin.h:563
RT-Component.
void finalizePorts()
Deactivate all Ports and unregister them.
Definition: PortAdmin.cpp:368
Logger rtclog
Logger stream.
Definition: PortAdmin.h:523
CORBA::ORB_var m_pORB
Reference to ORB.
Definition: PortAdmin.h:496
PortableServer::POA_var m_pPOA
Reference to POA.
Definition: PortAdmin.h:505
RT component logger class.
PortServiceList * getPortServiceList() const
Get PortServiceList.
Definition: PortAdmin.cpp:108
PortService_ptr getPortRef(const char *port_name) const
Get the reference to Port object.
Definition: PortAdmin.cpp:161
PortBase * getPort(const char *port_name) const
Get pointer to the Port&#39;s servant.
Definition: PortAdmin.cpp:179
void activatePorts()
Activate all Port interfaces.
Definition: PortAdmin.cpp:334
comp_op functor
Definition: PortAdmin.h:533
port_prof_collect2(PortProfileList &p)
Definition: PortAdmin.h:582
PortProfileList corerection functor.
Definition: PortAdmin.h:560
Functor to fing a Port.
Definition: PortAdmin.cpp:33
PortProfileList corerection functor.
Definition: PortAdmin.h:579
Functor to delete the Port.
Definition: PortAdmin.cpp:77
virtual ~PortAdmin(void)
Destructor.
Definition: PortAdmin.h:89
Class for managing objects.
void registerPort(PortBase &port)
Regsiter the Port.
Definition: PortAdmin.cpp:239
PortProfileList getPortProfileList() const
Get PorProfileList.
Definition: PortAdmin.cpp:122
bool operator()(T *obj)
Definition: PortAdmin.h:544
ObjectManager< const char *, PortBase, comp_op< PortBase > > m_portServants
Definition: PortAdmin.h:595
void deactivatePorts()
Deactivate all Port interfaces.
Definition: PortAdmin.cpp:351
bool removePort(PortBase &port)
Unregister the Port registration.
Definition: PortAdmin.cpp:262
std::vector< IPortService * > PortServiceList
Definition: IPortService.h:39
void deletePortByName(const char *port_name)
Unregister the Port&#39;s registration by its name.
Definition: PortAdmin.cpp:320
void operator()(const PortService_ptr port)
Definition: PortAdmin.h:583
bool addPort(PortBase &port)
Regsiter the Port.
Definition: PortAdmin.cpp:191
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
PortServiceList m_portRefs
List of Port&#39;s object references.
Definition: PortAdmin.h:514
void deletePort(PortBase &port)
Unregister the Port registration.
Definition: PortAdmin.cpp:297
comp_op(const char *_name)
Definition: PortAdmin.h:536
std::vector< PortProfile * > PortProfileList
Definition: IPortService.h:63
PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
Constructor.
Definition: PortAdmin.cpp:94
const PortProfile & getPortProfile() const
Get the PortProfile of the Port.
Definition: PortBase.cpp:119
void operator()(const PortBase *port)
Definition: PortAdmin.h:564


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Jun 6 2019 19:25:59