00001
00020 #ifndef RTC_SDOCONFIGURATION_H
00021 #define RTC_SDOCONFIGURATION_H
00022
00023
00024 #include <rtm/RTC.h>
00025 #include <coil/Mutex.h>
00026 #include <coil/Guard.h>
00027
00028
00029 #include <rtm/idl/SDOPackageSkel.h>
00030 #include <rtm/ConfigAdmin.h>
00031 #include <rtm/SystemLogger.h>
00032 #include <string>
00033
00034
00035
00036
00052 #ifdef WIN32
00053 #pragma warning( disable : 4290 )
00054 #endif
00055
00056 namespace SDOPackage
00057 {
00152 class Configuration_impl
00153 : public virtual POA_SDOPackage::Configuration,
00154 public virtual PortableServer::RefCountServantBase
00155 {
00156 typedef coil::Mutex Mutex;
00157 typedef coil::Guard<Mutex> Guard;
00158 public:
00178 Configuration_impl(RTC::ConfigAdmin& configAdmin);
00179
00195 virtual ~Configuration_impl(void);
00196
00197
00198
00199
00200
00201
00242 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile)
00243 throw (CORBA::SystemException,
00244 InvalidParameter, NotAvailable, InternalError);
00245
00291 virtual CORBA::Boolean add_service_profile(const ServiceProfile& sProfile)
00292 throw (CORBA::SystemException,
00293 InvalidParameter, NotAvailable, InternalError);
00294
00330 virtual CORBA::Boolean add_organization(Organization_ptr org)
00331 throw (CORBA::SystemException,
00332 InvalidParameter, NotAvailable, InternalError);
00333
00376 virtual CORBA::Boolean remove_service_profile(const char* id)
00377 throw (CORBA::SystemException,
00378 InvalidParameter, NotAvailable, InternalError);
00379
00419 virtual CORBA::Boolean remove_organization(const char* organization_id)
00420 throw (CORBA::SystemException,
00421 InvalidParameter, NotAvailable, InternalError);
00422
00455 virtual ParameterList* get_configuration_parameters()
00456 throw (CORBA::SystemException,
00457 NotAvailable, InternalError);
00458
00489 virtual NVList* get_configuration_parameter_values()
00490 throw (CORBA::SystemException,
00491 NotAvailable, InternalError);
00492
00533 virtual CORBA::Any* get_configuration_parameter_value(const char* name)
00534 throw (CORBA::SystemException,
00535 InvalidParameter, NotAvailable, InternalError);
00536
00579 virtual CORBA::Boolean set_configuration_parameter(const char* name,
00580 const CORBA::Any& value)
00581 throw (CORBA::SystemException,
00582 InvalidParameter, NotAvailable, InternalError);
00583
00618 virtual ConfigurationSetList* get_configuration_sets()
00619 throw (CORBA::SystemException,
00620 NotAvailable, InternalError);
00621
00662 virtual ConfigurationSet* get_configuration_set(const char* config_id)
00663 throw (CORBA::SystemException,
00664 NotAvailable, InternalError);
00665
00714 virtual ConfigurationSet* get_active_configuration_set()
00715 throw (CORBA::SystemException,
00716 NotAvailable, InternalError);
00717
00759 virtual CORBA::Boolean
00760 add_configuration_set(const ConfigurationSet& configuration_set)
00761 throw (CORBA::SystemException,
00762 InvalidParameter, NotAvailable, InternalError);
00763
00815 virtual CORBA::Boolean
00816 set_configuration_set_values(const ConfigurationSet& configuration_set)
00817 throw (CORBA::SystemException,
00818 InvalidParameter, NotAvailable, InternalError);
00819
00858 virtual CORBA::Boolean remove_configuration_set(const char* config_id)
00859 throw (CORBA::SystemException,
00860 InvalidParameter, NotAvailable, InternalError);
00861
00912 virtual CORBA::Boolean activate_configuration_set(const char* config_id)
00913 throw (CORBA::SystemException,
00914 InvalidParameter, NotAvailable, InternalError);
00915
00916
00917
00918
00938 Configuration_ptr getObjRef();
00939
00959 const DeviceProfile getDeviceProfile();
00960
00980 const ServiceProfileList getServiceProfiles();
00981
01009 const ServiceProfile getServiceProfile(const char* id);
01010
01030 const OrganizationList getOrganizations();
01031
01032 protected:
01033 ::RTC::Logger rtclog;
01053 const std::string getUUID() const;
01054
01062 Configuration_var m_objref;
01063
01071 DeviceProfile m_deviceProfile;
01072 Mutex m_dprofile_mutex;
01073
01081 ServiceProfileList m_serviceProfiles;
01082 Mutex m_sprofile_mutex;
01083
01145 ParameterList m_parameters;
01146 Mutex m_params_mutex;
01147
01155
01156
01157
01158
01159
01160
01161
01162
01163 RTC::ConfigAdmin& m_configsets;
01164 Mutex m_config_mutex;
01165
01173 OrganizationList m_organizations;
01174 Mutex m_org_mutex;
01175
01183 struct nv_name
01184 {
01185 nv_name(const char* name) : m_name(name) {};
01186 bool operator()(const NameValue& nv)
01187 {
01188 return m_name == std::string(nv.name);
01189 }
01190 std::string m_name;
01191 };
01192
01200 struct service_id
01201 {
01202 service_id(const char* id) : m_id(id) {};
01203 bool operator()(const ServiceProfile& s)
01204 {
01205 std::string id(s.id);
01206 return m_id == id;
01207 }
01208 const std::string m_id;
01209 };
01210
01218 struct org_id
01219 {
01220 org_id(const char* id) : m_id(id) {};
01221 bool operator()(const Organization_ptr& o)
01222 {
01223 CORBA::String_var id(o->get_organization_id());
01224 return m_id == (const char *)id;
01225 }
01226 const std::string m_id;
01227 };
01228
01236 struct config_id
01237 {
01238 config_id(const char* id) : m_id(id) {};
01239 bool operator()(const ConfigurationSet& c)
01240 {
01241 std::string id(c.id);
01242 return m_id == id;
01243 }
01244 const std::string m_id;
01245 };
01246 };
01247 };
01248
01249 #ifdef WIN32
01250 #pragma warning( default : 4290 )
01251 #endif
01252
01253 #endif // RTC_SDOCONFIGURATION_H