00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef SdoConfiguration_h
00051 #define SdoConfiguration_h
00052
00053
00054 #include <rtm/RTC.h>
00055
00056 #include <ace/Guard_T.h>
00057 #include <ace/Thread_Mutex.h>
00058
00059
00060 #include <rtm/idl/SDOPackageSkel.h>
00061 #include <rtm/ConfigAdmin.h>
00062 #include <string>
00063
00064
00065
00066
00067 namespace SDOPackage
00068 {
00136 class Configuration_impl
00137 : public virtual POA_SDOPackage::Configuration,
00138 public virtual PortableServer::RefCountServantBase
00139 {
00140 public:
00141 Configuration_impl(RTC::ConfigAdmin& configAdmin);
00142 virtual ~Configuration_impl();
00143
00144
00145
00146
00147
00148
00182 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile)
00183 throw (InvalidParameter, NotAvailable, InternalError);
00184
00222 virtual CORBA::Boolean set_service_profile(const ServiceProfile& sProfile)
00223 throw (InvalidParameter, NotAvailable, InternalError);
00224
00253 virtual CORBA::Boolean add_organization(Organization_ptr org)
00254 throw (InvalidParameter, NotAvailable, InternalError);
00255
00290 virtual CORBA::Boolean remove_service_profile(const char* id)
00291 throw (InvalidParameter, NotAvailable, InternalError);
00292
00323 virtual CORBA::Boolean remove_organization(const char* organization_id)
00324 throw (InvalidParameter, NotAvailable, InternalError);
00325
00353 virtual ParameterList* get_configuration_parameters()
00354 throw (NotAvailable, InternalError);
00355
00380 virtual NVList* get_configuration_parameter_values()
00381 throw (NotAvailable, InternalError);
00382
00410 virtual CORBA::Any* get_configuration_parameter_value(const char* name)
00411 throw (InvalidParameter, NotAvailable, InternalError);
00412
00446 virtual CORBA::Boolean set_configuration_parameter(const char* name,
00447 const CORBA::Any& value)
00448 throw (InvalidParameter, NotAvailable, InternalError);
00449
00479 virtual ConfigurationSetList* get_configuration_sets()
00480 throw (NotAvailable, InternalError);
00481
00512 virtual ConfigurationSet* get_configuration_set(const char* config_id)
00513 throw (InvalidParameter, NotAvailable, InternalError);
00514
00553 virtual CORBA::Boolean
00554 set_configuration_set_values(const char* config_id,
00555 const ConfigurationSet& configuration_set)
00556 throw (InvalidParameter, NotAvailable, InternalError);
00557
00601 virtual ConfigurationSet* get_active_configuration_set()
00602 throw (NotAvailable, InternalError);
00603
00634 virtual CORBA::Boolean
00635 add_configuration_set(const ConfigurationSet& configuration_set)
00636 throw (InvalidParameter, NotAvailable, InternalError);
00637
00669 virtual CORBA::Boolean remove_configuration_set(const char* config_id)
00670 throw (InvalidParameter, NotAvailable, InternalError);
00671
00715 virtual CORBA::Boolean activate_configuration_set(const char* config_id)
00716 throw (InvalidParameter, NotAvailable, InternalError);
00717
00718
00719
00720
00721 Configuration_ptr getObjRef();
00722
00723 const DeviceProfile getDeviceProfile();
00724
00725 const ServiceProfileList getServiceProfiles();
00726
00727 const ServiceProfile getServiceProfile(const char* id);
00728
00729 const OrganizationList getOrganizations();
00730
00731 protected:
00732 const std::string getUUID() const;
00733
00734 Configuration_var m_objref;
00735
00736 typedef ACE_Guard<ACE_Thread_Mutex> Guard;
00744 DeviceProfile m_deviceProfile;
00745 ACE_Thread_Mutex m_dprofile_mutex;
00746
00754 ServiceProfileList m_serviceProfiles;
00755 ACE_Thread_Mutex m_sprofile_mutex;
00756
00764
00765
00766
00767
00768
00769
00770
00771
00772 ParameterList m_parameters;
00773 ACE_Thread_Mutex m_params_mutex;
00774
00782
00783
00784
00785
00786
00787
00788
00789
00790 RTC::ConfigAdmin& m_configsets;
00791 ACE_Thread_Mutex m_config_mutex;
00792
00800 OrganizationList m_organizations;
00801 ACE_Thread_Mutex m_org_mutex;
00802
00811 struct nv_name
00812 {
00813 nv_name(const char* name) : m_name(name) {};
00814 bool operator()(const NameValue& nv)
00815 {
00816 return m_name == std::string(nv.name);
00817 }
00818 std::string m_name;
00819 };
00820
00821
00822
00823 struct service_id
00824 {
00825 service_id(const char* id) : m_id(id) {};
00826 bool operator()(const ServiceProfile& s)
00827 {
00828 std::string id(s.id);
00829 return m_id == id;
00830 }
00831 const std::string m_id;
00832 };
00833
00834
00835 struct org_id
00836 {
00837 org_id(const char* id) : m_id(id) {};
00838 bool operator()(const Organization_ptr& o)
00839 {
00840 std::string id(o->get_organization_id());
00841 return m_id == id;
00842 }
00843 const std::string m_id;
00844 };
00845
00846
00847 struct config_id
00848 {
00849 config_id(const char* id) : m_id(id) {};
00850 bool operator()(const ConfigurationSet& c)
00851 {
00852 std::string id(c.id);
00853 return m_id == id;
00854 }
00855 const std::string m_id;
00856 };
00857
00858 };
00859
00860 };
00861
00862 #endif // SdoConfiguration_h