00001 #ifndef __RTT_ROSSERVICE_RTT_ROSSERVICE_REGISTRY_SERVICE_H 00002 #define __RTT_ROSSERVICE_RTT_ROSSERVICE_REGISTRY_SERVICE_H 00003 00004 #include <rtt/RTT.hpp> 00005 #include <boost/shared_ptr.hpp> 00006 00007 class ROSServiceRegistryService; 00008 class ROSServiceProxyFactoryBase; 00009 typedef boost::shared_ptr<ROSServiceRegistryService> ROSServiceRegistryServicePtr; 00010 00011 class ROSServiceRegistryService : public RTT::Service 00012 { 00013 public: 00014 static ROSServiceRegistryServicePtr Instance(); 00015 static void Release(); 00016 00022 bool registerServiceFactory(ROSServiceProxyFactoryBase* factory); 00023 00024 bool hasServiceFactory(const std::string &service_type); 00025 00026 ROSServiceProxyFactoryBase* getServiceFactory(const std::string &service_type); 00027 00028 void listSrvs(); 00029 00030 private: 00035 ROSServiceRegistryService(RTT::TaskContext* owner); 00036 00038 static std::map<std::string, boost::shared_ptr<ROSServiceProxyFactoryBase> > factories_; 00039 static RTT::os::MutexRecursive factory_lock_; 00040 00042 static ROSServiceRegistryServicePtr s_instance_; 00043 }; 00044 00045 #endif // __RTT_ROSSERVICE_RTT_ROSSERVICE_REGISTRY_SERVICE_H