NamingManager.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef RTC_NAMINGMANAGER_H
20 #define RTC_NAMINGMANAGER_H
21 
22 #include <rtm/RTC.h>
23 
24 #include <coil/Task.h>
25 #include <coil/Mutex.h>
26 #include <coil/Guard.h>
27 #include <rtm/CorbaNaming.h>
28 #include <rtm/RTObject.h>
29 #include <rtm/SystemLogger.h>
30 #include <rtm/ManagerServant.h>
31 
32 namespace RTC
33 {
34  class Manager;
63  class NamingBase
64  {
65  typedef coil::Mutex Mutex;
67  public:
79  NamingBase() {};
80 
92  virtual ~NamingBase(void) {};
93 
112  virtual void bindObject(const char* name, const RTObject_impl* rtobj) = 0;
113 
132  virtual void bindObject(const char* name,
133  const RTM::ManagerServant* mgr) = 0;
134 
152  virtual void unbindObject(const char* name) = 0;
153 
169  virtual bool isAlive() = 0;
170  };
171 
172 
197  : public virtual NamingBase
198  {
199  public:
226  NamingOnCorba(CORBA::ORB_ptr orb, const char* names);
227 
239  virtual ~NamingOnCorba(void){};
240 
264  virtual void bindObject(const char* name, const RTObject_impl* rtobj);
282  virtual void bindObject(const char* name, const RTM::ManagerServant* mgr);
283 
303  virtual void unbindObject(const char* name);
304 
320  virtual bool isAlive();
321 
322  private:
325  std::string m_endpoint;
327  std::map<std::string, RTObject_impl*> m_names;
328  };
329 
354  {
357  public:
378 
390  virtual ~NamingManager(void);
391 
415  void registerNameServer(const char* method, const char* name_server);
416 
439  void bindObject(const char* name, const RTObject_impl* rtobj);
440 
464  void bindObject(const char* name, const RTM::ManagerServant* mgr);
465 
482  void update();
483 
503  void unbindObject(const char* name);
504 
520  void unbindAll();
521 
541  std::vector<RTObject_impl*> getObjects();
542 
543  protected:
569  NamingBase* createNamingObj(const char* method, const char* name_server);
570 
590  void bindCompsTo(NamingBase* ns);
591 
613  void registerCompName(const char* name, const RTObject_impl* rtobj);
614 
637  void registerMgrName(const char* name, const RTM::ManagerServant* mgr);
638 
658  void unregisterCompName(const char* name);
659 
680  void unregisterMgrName(const char* name);
681 
701  class Names;
702  void retryConnection(Names* ns);
703 
704  protected:
705  // Name Servers' method/name and object
713  class Names
714  {
715  public:
716  Names(const char* meth, const char* name, NamingBase* naming)
717  : method(meth), nsname(name), ns(naming)
718  {
719  }
720 
722  {
723  delete ns;
724  }
725 
726  std::string method;
727  std::string nsname;
729  };
737  std::vector<Names*> m_names;
746 
747  // Components' name and object
755  struct Comps
756  {
757  Comps(const char* n, const RTObject_impl* obj)
758  : name(n), rtobj(obj)
759  {}
760  std::string name;
762  };
770  struct Mgr
771  {
772  Mgr(const char* n, const RTM::ManagerServant* obj)
773  : name(n), mgr(obj)
774  {}
775  std::string name;
777  };
785  std::vector<Comps*> m_compNames;
801  std::vector<Mgr*> m_mgrNames;
810 
819 
828  }; // class NamingManager
829 }; // namespace RTC
830 
831 #endif // RTC_NAMINGMANAGER_H
virtual ~NamingOnCorba(void)
Destructor.
const RTM::ManagerServant * mgr
Comps(const char *n, const RTObject_impl *obj)
RT-Component.
coil::Mutex Mutex
Definition: NamingManager.h:65
std::vector< Mgr * > m_mgrNames
ManagerServant list.
std::vector< Comps * > m_compNames
Component list.
Mutex class.
RT component logger class.
Manager * m_manager
Manager object.
Mgr(const char *n, const RTM::ManagerServant *obj)
Manager CORBA class.
Mutex m_mgrNamesMutex
Mutex of ManagerServant list.
virtual void bindObject(const char *name, const RTObject_impl *rtobj)=0
Pure virtual function to bind the specified objects to the NamingService.
RT-Component class.
Definition: RTObject.h:89
Manager class.
Definition: Manager.h:80
Mutex m_compNamesMutex
Mutex of Component list.
std::string m_endpoint
virtual bool isAlive()=0
Check if the name service is alive.
Structure for ManagerServant management.
Names(const char *meth, const char *name, NamingBase *naming)
NamingService management abstract class.
Definition: NamingManager.h:63
Mutex m_namesMutex
Mutex of NameServer list.
CORBA naming service helper class.
RTComponent manager servant implementation class.
Structure for NameServer management.
NamingBase()
Constructor.
Definition: NamingManager.h:79
const RTObject_impl * rtobj
Structure for component management.
virtual ~NamingBase(void)
Destructor.
Definition: NamingManager.h:92
Logger rtclog
Logger stream.
coil::Guard< Mutex > Guard
std::map< std::string, RTObject_impl * > m_names
CorbaNaming m_cosnaming
RTComponent header.
NamingServer management class for CORBA.
Guard template class.
Definition: Guard.h:41
std::vector< Names * > m_names
NameServer list.
coil::Guard< Mutex > Guard
Definition: NamingManager.h:66
virtual void unbindObject(const char *name)=0
Pure virtual function to unbind the specified objects from NamingService.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:53