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
00051
00052
00053 #ifndef SdoConfiguration_h
00054 #define SdoConfiguration_h
00055
00056
00057 #include <rtm/RTC.h>
00058
00059 #include <ace/Guard_T.h>
00060 #include <ace/Thread_Mutex.h>
00061
00062
00063 #include <rtm/idl/SDOPackageSkel.h>
00064 #include <rtm/ConfigAdmin.h>
00065 #include <string>
00066
00067
00068
00069
00070 namespace SDOPackage
00071 {
00139 class Configuration_impl
00140 : public virtual POA_SDOPackage::Configuration,
00141 public virtual PortableServer::RefCountServantBase
00142 {
00143 public:
00144 Configuration_impl(RTC::ConfigAdmin& configAdmin);
00145 virtual ~Configuration_impl();
00146
00147
00148
00149
00150
00151
00185 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile)
00186 throw (InvalidParameter, NotAvailable, InternalError);
00187
00225 virtual CORBA::Boolean set_service_profile(const ServiceProfile& sProfile)
00226 throw (InvalidParameter, NotAvailable, InternalError);
00227
00256 virtual CORBA::Boolean add_organization(Organization_ptr org)
00257 throw (InvalidParameter, NotAvailable, InternalError);
00258
00293 virtual CORBA::Boolean remove_service_profile(const char* id)
00294 throw (InvalidParameter, NotAvailable, InternalError);
00295
00326 virtual CORBA::Boolean remove_organization(const char* organization_id)
00327 throw (InvalidParameter, NotAvailable, InternalError);
00328
00356 virtual ParameterList* get_configuration_parameters()
00357 throw (NotAvailable, InternalError);
00358
00383 virtual NVList* get_configuration_parameter_values()
00384 throw (NotAvailable, InternalError);
00385
00413 virtual CORBA::Any* get_configuration_parameter_value(const char* name)
00414 throw (InvalidParameter, NotAvailable, InternalError);
00415
00449 virtual CORBA::Boolean set_configuration_parameter(const char* name,
00450 const CORBA::Any& value)
00451 throw (InvalidParameter, NotAvailable, InternalError);
00452
00482 virtual ConfigurationSetList* get_configuration_sets()
00483 throw (NotAvailable, InternalError);
00484
00515 virtual ConfigurationSet* get_configuration_set(const char* config_id)
00516 throw (NotAvailable, InternalError);
00517
00556 virtual CORBA::Boolean
00557 set_configuration_set_values(const char* config_id,
00558 const ConfigurationSet& configuration_set)
00559 throw (InvalidParameter, NotAvailable, InternalError);
00560
00604 virtual ConfigurationSet* get_active_configuration_set()
00605 throw (NotAvailable, InternalError);
00606
00637 virtual CORBA::Boolean
00638 add_configuration_set(const ConfigurationSet& configuration_set)
00639 throw (InvalidParameter, NotAvailable, InternalError);
00640
00672 virtual CORBA::Boolean remove_configuration_set(const char* config_id)
00673 throw (InvalidParameter, NotAvailable, InternalError);
00674
00718 virtual CORBA::Boolean activate_configuration_set(const char* config_id)
00719 throw (InvalidParameter, NotAvailable, InternalError);
00720
00721
00722
00723
00724 Configuration_ptr getObjRef();
00725
00726 const DeviceProfile getDeviceProfile();
00727
00728 const ServiceProfileList getServiceProfiles();
00729
00730 const ServiceProfile getServiceProfile(const char* id);
00731
00732 const OrganizationList getOrganizations();
00733
00734 protected:
00735 const std::string getUUID() const;
00736
00737 Configuration_var m_objref;
00738
00739 typedef ACE_Guard<ACE_Thread_Mutex> Guard;
00747 DeviceProfile m_deviceProfile;
00748 ACE_Thread_Mutex m_dprofile_mutex;
00749
00757 ServiceProfileList m_serviceProfiles;
00758 ACE_Thread_Mutex m_sprofile_mutex;
00759
00767
00768
00769
00770
00771
00772
00773
00774
00775 ParameterList m_parameters;
00776 ACE_Thread_Mutex m_params_mutex;
00777
00785
00786
00787
00788
00789
00790
00791
00792
00793 RTC::ConfigAdmin& m_configsets;
00794 ACE_Thread_Mutex m_config_mutex;
00795
00803 OrganizationList m_organizations;
00804 ACE_Thread_Mutex m_org_mutex;
00805
00814 struct nv_name
00815 {
00816 nv_name(const char* name) : m_name(name) {};
00817 bool operator()(const NameValue& nv)
00818 {
00819 return m_name == std::string(nv.name);
00820 }
00821 std::string m_name;
00822 };
00823
00824
00825
00826 struct service_id
00827 {
00828 service_id(const char* id) : m_id(id) {};
00829 bool operator()(const ServiceProfile& s)
00830 {
00831 std::string id(s.id);
00832 return m_id == id;
00833 }
00834 const std::string m_id;
00835 };
00836
00837
00838 struct org_id
00839 {
00840 org_id(const char* id) : m_id(id) {};
00841 bool operator()(const Organization_ptr& o)
00842 {
00843 std::string id(o->get_organization_id());
00844 return m_id == id;
00845 }
00846 const std::string m_id;
00847 };
00848
00849
00850 struct config_id
00851 {
00852 config_id(const char* id) : m_id(id) {};
00853 bool operator()(const ConfigurationSet& c)
00854 {
00855 std::string id(c.id);
00856 return m_id == id;
00857 }
00858 const std::string m_id;
00859 };
00860
00861 };
00862
00863 };
00864
00865 #endif // SdoConfiguration_h