00001 // -*- C++ -*- 00019 #ifndef RTC_SDOSERVICEADMIN_H 00020 #define RTC_SDOSERVICEADMIN_H 00021 00022 #include <coil/Mutex.h> 00023 #include <coil/Factory.h> 00024 00025 #include <rtm/idl/SDOPackageStub.h> 00026 #include <rtm/SystemLogger.h> 00027 00028 namespace RTC 00029 { 00030 class RTObject_impl; 00031 class SdoServiceProviderBase; 00032 class SdoServiceConsumerBase; 00033 00148 class SdoServiceAdmin 00149 { 00150 public: 00170 SdoServiceAdmin(::RTC::RTObject_impl& rtobj); 00171 00187 virtual ~SdoServiceAdmin(); 00188 00200 SDOPackage::ServiceProfileList* getServiceProviderProfiles(); 00201 00229 SDOPackage::ServiceProfile* getServiceProviderProfile(const char* id); 00230 00258 SDOPackage::SDOService_ptr getServiceProvider(const char* id); 00259 00267 bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof, 00268 SdoServiceProviderBase* provider); 00269 00277 bool removeSdoServiceProvider(const char* id); 00278 00290 bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& sProfile); 00291 00303 bool removeSdoServiceConsumer(const char* id); 00304 00305 protected: 00317 bool isEnabledConsumerType(const SDOPackage::ServiceProfile& sProfile); 00318 00330 bool isExistingConsumerType(const SDOPackage::ServiceProfile& sProfile); 00331 00332 const std::string getUUID() const; 00333 00334 std::string ifrToKey(std::string& ifr); 00335 00336 00337 private: 00338 RTC::RTObject_impl& m_rtobj; 00339 coil::vstring m_consumerTypes; 00340 bool m_allConsumerEnabled; 00341 00349 std::vector<SdoServiceProviderBase*> m_providers; 00350 coil::Mutex m_provider_mutex; 00351 00359 std::vector<SdoServiceConsumerBase*> m_consumers; 00360 coil::Mutex m_consumer_mutex; 00361 00369 ::RTC::Logger rtclog; 00370 }; 00371 00372 00373 }; 00374 00375 #endif // RTC_SDOSERVICEADMIN_H