00001
00020 #ifndef RTM_MANAGERSERVANT_H
00021 #define RTM_MANAGERSERVANT_H
00022
00023 #include <iostream>
00024 #include <coil/Mutex.h>
00025 #include <coil/Guard.h>
00026 #include <rtm/idl/ManagerSkel.h>
00027 #include <rtm/Manager.h>
00028 #include <rtm/SystemLogger.h>
00029
00045 namespace RTM
00046 {
00063 class ManagerServant
00064 : public virtual POA_RTM::Manager,
00065 public virtual PortableServer::RefCountServantBase
00066 {
00067 public:
00081
00082 ManagerServant();
00083
00095 virtual ~ManagerServant(void);
00096
00121 RTC::ReturnCode_t load_module(const char* pathname, const char* initfunc);
00122
00142 RTC::ReturnCode_t unload_module(const char* pathname);
00143
00161 RTM::ModuleProfileList* get_loadable_modules();
00162
00180 RTM::ModuleProfileList* get_loaded_modules();
00181
00182
00202 RTM::ModuleProfileList* get_factory_profiles();
00203
00222 RTC::RTObject_ptr create_component(const char* module_name);
00223
00242 RTC::ReturnCode_t delete_component(const char* instance_name);
00243
00261 RTC::RTCList* get_components();
00262
00282 RTC::ComponentProfileList* get_component_profiles();
00283
00284
00302 RTM::ManagerProfile* get_profile();
00303
00321 RTM::NVList* get_configuration();
00322
00344 RTC::ReturnCode_t set_configuration(const char* name, const char* value);
00345
00365 ::CORBA::Boolean is_master();
00366
00388 RTM::ManagerList* get_master_managers();
00389
00413 RTC::ReturnCode_t add_master_manager(RTM::Manager_ptr mgr);
00414
00434 RTC::ReturnCode_t remove_master_manager(RTM::Manager_ptr mgr);
00435
00457 RTM::ManagerList* get_slave_managers();
00458
00478 RTC::ReturnCode_t add_slave_manager(RTM::Manager_ptr mgr);
00479
00499 RTC::ReturnCode_t remove_slave_manager(RTM::Manager_ptr mgr);
00500
00501
00502
00512 RTC::ReturnCode_t fork();
00522 RTC::ReturnCode_t shutdown();
00532 RTC::ReturnCode_t restart();
00533
00543 CORBA::Object_ptr get_service(const char* name);
00544
00554 RTM::Manager_ptr getObjRef() const;
00555
00565 bool createINSManager();
00566
00576 RTM::Manager_ptr findManager(const char* host_port);
00577 private:
00578 typedef coil::Guard<coil::Mutex> Guard;
00579 ::RTC::Logger rtclog;
00580 ::RTC::Manager& m_mgr;
00581 ::RTM::Manager_var m_objref;
00582
00583 ::RTM::ManagerList m_masters;
00584 ::coil::Mutex m_masterMutex;
00585 ::RTM::ManagerList m_slaves;
00586 ::coil::Mutex m_slaveMutex;
00587
00588 CORBA::Boolean m_isMaster;
00589
00590 class is_equiv
00591 {
00592 RTM::Manager_var m_mgr;
00593 public:
00594 is_equiv(RTM::Manager_ptr mgr)
00595 : m_mgr(RTM::Manager::_duplicate(mgr)) {}
00596 bool operator()(RTM::Manager_ptr mgr)
00597 {
00598 return m_mgr->_is_equivalent(mgr);
00599 }
00600 };
00601
00602 };
00603 };
00604 #endif // RTM_MANAGERSERVANT_H