OpenRTM
1.0.0
|
00001 // -*- C++ -*- 00020 #ifndef RTC_SDOCONFIGURATION_H 00021 #define RTC_SDOCONFIGURATION_H 00022 00023 #include <string> 00024 00025 // CORBA header include 00026 #include <rtm/RTC.h> 00027 #include <coil/Mutex.h> 00028 #include <coil/Guard.h> 00029 00030 // local includes 00031 #include <rtm/idl/SDOPackageSkel.h> 00032 #include <rtm/ConfigAdmin.h> 00033 #include <rtm/SystemLogger.h> 00034 #include <rtm/SdoServiceAdmin.h> 00035 00036 // SdoConfiguration with SeqEx 159120 00037 // SdoConfiguration with SeqUtil 114504 114224 00038 00054 #ifdef WIN32 00055 #pragma warning( disable : 4290 ) 00056 #endif 00057 00058 namespace SDOPackage 00059 { 00154 class Configuration_impl 00155 : public virtual POA_SDOPackage::Configuration, 00156 public virtual PortableServer::RefCountServantBase 00157 { 00158 typedef coil::Mutex Mutex; 00159 typedef coil::Guard<Mutex> Guard; 00160 public: 00180 Configuration_impl(RTC::ConfigAdmin& configAdmin, 00181 RTC::SdoServiceAdmin& sdoServiceAdmin); 00182 00198 virtual ~Configuration_impl(void); 00199 00200 //============================================================ 00201 // 00202 // <<< CORBA interfaces >>> 00203 // 00204 //============================================================ 00245 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile) 00246 throw (CORBA::SystemException, 00247 InvalidParameter, NotAvailable, InternalError); 00248 00294 virtual CORBA::Boolean add_service_profile(const ServiceProfile& sProfile) 00295 throw (CORBA::SystemException, 00296 InvalidParameter, NotAvailable, InternalError); 00297 00333 virtual CORBA::Boolean add_organization(Organization_ptr org) 00334 throw (CORBA::SystemException, 00335 InvalidParameter, NotAvailable, InternalError); 00336 00379 virtual CORBA::Boolean remove_service_profile(const char* id) 00380 throw (CORBA::SystemException, 00381 InvalidParameter, NotAvailable, InternalError); 00382 00422 virtual CORBA::Boolean remove_organization(const char* organization_id) 00423 throw (CORBA::SystemException, 00424 InvalidParameter, NotAvailable, InternalError); 00425 00458 virtual ParameterList* get_configuration_parameters() 00459 throw (CORBA::SystemException, 00460 NotAvailable, InternalError); 00461 00492 virtual NVList* get_configuration_parameter_values() 00493 throw (CORBA::SystemException, 00494 NotAvailable, InternalError); 00495 00536 virtual CORBA::Any* get_configuration_parameter_value(const char* name) 00537 throw (CORBA::SystemException, 00538 InvalidParameter, NotAvailable, InternalError); 00539 00582 virtual CORBA::Boolean set_configuration_parameter(const char* name, 00583 const CORBA::Any& value) 00584 throw (CORBA::SystemException, 00585 InvalidParameter, NotAvailable, InternalError); 00586 00621 virtual ConfigurationSetList* get_configuration_sets() 00622 throw (CORBA::SystemException, 00623 NotAvailable, InternalError); 00624 00665 virtual ConfigurationSet* get_configuration_set(const char* config_id) 00666 throw (CORBA::SystemException, 00667 NotAvailable, InternalError); 00668 00717 virtual ConfigurationSet* get_active_configuration_set() 00718 throw (CORBA::SystemException, 00719 NotAvailable, InternalError); 00720 00762 virtual CORBA::Boolean 00763 add_configuration_set(const ConfigurationSet& configuration_set) 00764 throw (CORBA::SystemException, 00765 InvalidParameter, NotAvailable, InternalError); 00766 00818 virtual CORBA::Boolean 00819 set_configuration_set_values(const ConfigurationSet& configuration_set) 00820 throw (CORBA::SystemException, 00821 InvalidParameter, NotAvailable, InternalError); 00822 00861 virtual CORBA::Boolean remove_configuration_set(const char* config_id) 00862 throw (CORBA::SystemException, 00863 InvalidParameter, NotAvailable, InternalError); 00864 00915 virtual CORBA::Boolean activate_configuration_set(const char* config_id) 00916 throw (CORBA::SystemException, 00917 InvalidParameter, NotAvailable, InternalError); 00918 00919 // end of CORBA interface definition 00920 //============================================================ 00921 00941 Configuration_ptr getObjRef(); 00942 00962 const DeviceProfile getDeviceProfile(); 00963 00983 const OrganizationList getOrganizations(); 00984 00985 protected: 00986 ::RTC::Logger rtclog; 01006 const std::string getUUID() const; 01007 01015 Configuration_var m_objref; 01016 01024 DeviceProfile m_deviceProfile; 01025 Mutex m_dprofile_mutex; 01026 01088 ParameterList m_parameters; 01089 Mutex m_params_mutex; 01090 01098 /* 01099 struct ConfigurationSet 01100 { 01101 string id; 01102 string description; 01103 NVList configuration_data; 01104 }; 01105 */ 01106 RTC::ConfigAdmin& m_configsets; 01107 Mutex m_config_mutex; 01108 01116 RTC::SdoServiceAdmin& m_sdoservice; 01117 Mutex m_sdoservice_mutex; 01118 01126 OrganizationList m_organizations; 01127 Mutex m_org_mutex; 01128 01136 struct nv_name 01137 { 01138 nv_name(const char* name) : m_name(name) {}; 01139 bool operator()(const NameValue& nv) 01140 { 01141 return m_name == std::string(nv.name); 01142 } 01143 std::string m_name; 01144 }; 01145 01153 struct org_id 01154 { 01155 org_id(const char* id) : m_id(id) {}; 01156 bool operator()(const Organization_ptr& o) 01157 { 01158 CORBA::String_var id(o->get_organization_id()); 01159 return m_id == (const char *)id; 01160 } 01161 const std::string m_id; 01162 }; 01163 01171 struct config_id 01172 { 01173 config_id(const char* id) : m_id(id) {}; 01174 bool operator()(const ConfigurationSet& c) 01175 { 01176 std::string id(c.id); 01177 return m_id == id; 01178 } 01179 const std::string m_id; 01180 }; 01181 }; // class Configuration_impl 01182 }; // namespace SDOPackage 01183 01184 #ifdef WIN32 01185 #pragma warning( default : 4290 ) 01186 #endif 01187 01188 #endif // RTC_SDOCONFIGURATION_H