OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
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#include <string>
29
30namespace RTC
31{
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
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.
Class for managing objects.
Definition ObjectManager.h:52
Logger class.
Definition SystemLogger.h:101
PortAdmin class.
Definition PortAdmin.h:55
void deletePort(PortService_ptr port)
Unregister the Port registration.
void deletePortByName(const char *port_name)
Unregister the Port's registration by its name.
bool removePort(PortService_ptr port)
Unregister the Port registration.
void finalizePorts()
Deactivate all Ports and unregister them.
virtual ~PortAdmin()
Destructor.
bool addPort(PortBase &port)
Regsiter the Port.
PortBase * getPort(const char *port_name) const
Get pointer to the Port's servant.
void registerPort(PortBase &port)
Regsiter the Port.
PortServiceList * getPortServiceList() const
Get PortServiceList.
bool removePort(PortBase &port)
Unregister the Port registration.
void activatePorts()
Activate all Port interfaces.
PortAdmin(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
Constructor.
void registerPort(PortService_ptr port)
Regsiter the Port.
void deletePort(PortBase &port)
Unregister the Port registration.
void deactivatePorts()
Deactivate all Port interfaces.
bool addPort(PortService_ptr port)
Regsiter the Port.
PortService_ptr getPortRef(const char *port_name) const
Get the reference to Port object.
PortProfileList getPortProfileList() const
Get PorProfileList.
Port base class.
Definition PortBase.h:132
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
Definition CORBA_SeqUtil.h:175
RT-Component.