00001
00020 #ifndef RTC_SDOCONFIGURATION_H
00021 #define RTC_SDOCONFIGURATION_H
00022
00023 #include <string>
00024
00025
00026 #include <rtm/RTC.h>
00027 #include <coil/Mutex.h>
00028 #include <coil/Guard.h>
00029
00030
00031 #include <rtm/idl/SDOPackageSkel.h>
00032 #include <rtm/ConfigAdmin.h>
00033 #include <rtm/SystemLogger.h>
00034 #include <rtm/SdoServiceAdmin.h>
00035
00036
00037
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
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
00920
00921
00941 Configuration_ptr getObjRef();
00942
00962 const DeviceProfile getDeviceProfile();
00963
00983 const ServiceProfileList getServiceProfiles();
00984
01012 const ServiceProfile getServiceProfile(const char* id);
01013
01033 const OrganizationList getOrganizations();
01034
01035 protected:
01036 ::RTC::Logger rtclog;
01056 const std::string getUUID() const;
01057
01065 Configuration_var m_objref;
01066
01074 DeviceProfile m_deviceProfile;
01075 Mutex m_dprofile_mutex;
01076
01084 ServiceProfileList m_serviceProfiles;
01085 Mutex m_sprofile_mutex;
01086
01148 ParameterList m_parameters;
01149 Mutex m_params_mutex;
01150
01158
01159
01160
01161
01162
01163
01164
01165
01166 RTC::ConfigAdmin& m_configsets;
01167 Mutex m_config_mutex;
01168
01176 RTC::SdoServiceAdmin& m_sdoservice;
01177 Mutex m_sdoservice_mutex;
01178
01186 OrganizationList m_organizations;
01187 Mutex m_org_mutex;
01188
01196 struct nv_name
01197 {
01198 nv_name(const char* name) : m_name(name) {};
01199 bool operator()(const NameValue& nv)
01200 {
01201 return m_name == std::string(nv.name);
01202 }
01203 std::string m_name;
01204 };
01205
01213 struct service_id
01214 {
01215 service_id(const char* id) : m_id(id) {};
01216 bool operator()(const ServiceProfile& s)
01217 {
01218 std::string id(s.id);
01219 return m_id == id;
01220 }
01221 const std::string m_id;
01222 };
01223
01231 struct org_id
01232 {
01233 org_id(const char* id) : m_id(id) {};
01234 bool operator()(const Organization_ptr& o)
01235 {
01236 CORBA::String_var id(o->get_organization_id());
01237 return m_id == (const char *)id;
01238 }
01239 const std::string m_id;
01240 };
01241
01249 struct config_id
01250 {
01251 config_id(const char* id) : m_id(id) {};
01252 bool operator()(const ConfigurationSet& c)
01253 {
01254 std::string id(c.id);
01255 return m_id == id;
01256 }
01257 const std::string m_id;
01258 };
01259 };
01260 };
01261
01262 #ifdef WIN32
01263 #pragma warning( default : 4290 )
01264 #endif
01265
01266 #endif // RTC_SDOCONFIGURATION_H