00001
00020 #ifndef SdoConfiguration_h
00021 #define SdoConfiguration_h
00022
00023
00024 #include <rtm/RTC.h>
00025
00026 #include <ace/Guard_T.h>
00027 #include <ace/Thread_Mutex.h>
00028
00029
00030 #include <rtm/idl/SDOPackageSkel.h>
00031 #include <rtm/ConfigAdmin.h>
00032 #include <string>
00033
00034
00035
00036
00051 namespace SDOPackage
00052 {
00147 class Configuration_impl
00148 : public virtual POA_SDOPackage::Configuration,
00149 public virtual PortableServer::RefCountServantBase
00150 {
00151 public:
00171 Configuration_impl(RTC::ConfigAdmin& configAdmin);
00172
00188 virtual ~Configuration_impl();
00189
00190
00191
00192
00193
00194
00235 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile)
00236 throw (CORBA::SystemException,
00237 InvalidParameter, NotAvailable, InternalError);
00238
00284 virtual CORBA::Boolean set_service_profile(const ServiceProfile& sProfile)
00285 throw (CORBA::SystemException,
00286 InvalidParameter, NotAvailable, InternalError);
00287
00323 virtual CORBA::Boolean add_organization(Organization_ptr org)
00324 throw (CORBA::SystemException,
00325 InvalidParameter, NotAvailable, InternalError);
00326
00369 virtual CORBA::Boolean remove_service_profile(const char* id)
00370 throw (CORBA::SystemException,
00371 InvalidParameter, NotAvailable, InternalError);
00372
00412 virtual CORBA::Boolean remove_organization(const char* organization_id)
00413 throw (CORBA::SystemException,
00414 InvalidParameter, NotAvailable, InternalError);
00415
00448 virtual ParameterList* get_configuration_parameters()
00449 throw (CORBA::SystemException,
00450 NotAvailable, InternalError);
00451
00482 virtual NVList* get_configuration_parameter_values()
00483 throw (CORBA::SystemException,
00484 NotAvailable, InternalError);
00485
00526 virtual CORBA::Any* get_configuration_parameter_value(const char* name)
00527 throw (CORBA::SystemException,
00528 InvalidParameter, NotAvailable, InternalError);
00529
00572 virtual CORBA::Boolean set_configuration_parameter(const char* name,
00573 const CORBA::Any& value)
00574 throw (CORBA::SystemException,
00575 InvalidParameter, NotAvailable, InternalError);
00576
00611 virtual ConfigurationSetList* get_configuration_sets()
00612 throw (CORBA::SystemException,
00613 NotAvailable, InternalError);
00614
00655 virtual ConfigurationSet* get_configuration_set(const char* config_id)
00656 throw (CORBA::SystemException,
00657 NotAvailable, InternalError);
00658
00707 virtual ConfigurationSet* get_active_configuration_set()
00708 throw (CORBA::SystemException,
00709 NotAvailable, InternalError);
00710
00752 virtual CORBA::Boolean
00753 add_configuration_set(const ConfigurationSet& configuration_set)
00754 throw (CORBA::SystemException,
00755 InvalidParameter, NotAvailable, InternalError);
00756
00808 virtual CORBA::Boolean
00809 set_configuration_set_values(const char* config_id,
00810 const ConfigurationSet& configuration_set)
00811 throw (CORBA::SystemException,
00812 InvalidParameter, NotAvailable, InternalError);
00813
00852 virtual CORBA::Boolean remove_configuration_set(const char* config_id)
00853 throw (CORBA::SystemException,
00854 InvalidParameter, NotAvailable, InternalError);
00855
00906 virtual CORBA::Boolean activate_configuration_set(const char* config_id)
00907 throw (CORBA::SystemException,
00908 InvalidParameter, NotAvailable, InternalError);
00909
00910
00911
00912
00932 Configuration_ptr getObjRef();
00933
00953 const DeviceProfile getDeviceProfile();
00954
00974 const ServiceProfileList getServiceProfiles();
00975
01003 const ServiceProfile getServiceProfile(const char* id);
01004
01024 const OrganizationList getOrganizations();
01025
01026 protected:
01046 const std::string getUUID() const;
01047
01055 Configuration_var m_objref;
01056
01057 typedef ACE_Guard<ACE_Thread_Mutex> Guard;
01065 DeviceProfile m_deviceProfile;
01066 ACE_Thread_Mutex m_dprofile_mutex;
01067
01075 ServiceProfileList m_serviceProfiles;
01076 ACE_Thread_Mutex m_sprofile_mutex;
01077
01139 ParameterList m_parameters;
01140 ACE_Thread_Mutex m_params_mutex;
01141
01149
01150
01151
01152
01153
01154
01155
01156
01157 RTC::ConfigAdmin& m_configsets;
01158 ACE_Thread_Mutex m_config_mutex;
01159
01167 OrganizationList m_organizations;
01168 ACE_Thread_Mutex m_org_mutex;
01169
01177 struct nv_name
01178 {
01179 nv_name(const char* name) : m_name(name) {};
01180 bool operator()(const NameValue& nv)
01181 {
01182 return m_name == std::string(nv.name);
01183 }
01184 std::string m_name;
01185 };
01186
01194 struct service_id
01195 {
01196 service_id(const char* id) : m_id(id) {};
01197 bool operator()(const ServiceProfile& s)
01198 {
01199 std::string id(s.id);
01200 return m_id == id;
01201 }
01202 const std::string m_id;
01203 };
01204
01212 struct org_id
01213 {
01214 org_id(const char* id) : m_id(id) {};
01215 bool operator()(const Organization_ptr& o)
01216 {
01217 std::string id(o->get_organization_id());
01218 return m_id == id;
01219 }
01220 const std::string m_id;
01221 };
01222
01230 struct config_id
01231 {
01232 config_id(const char* id) : m_id(id) {};
01233 bool operator()(const ConfigurationSet& c)
01234 {
01235 std::string id(c.id);
01236 return m_id == id;
01237 }
01238 const std::string m_id;
01239 };
01240 };
01241 };
01242
01243 #endif // SdoConfiguration_h