00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef SdoConfiguration_h
00037 #define SdoConfiguration_h
00038
00039 #include <ace/Guard_T.h>
00040 #include <ace/Thread_Mutex.h>
00041
00042
00043 #include "rtm/RTC.h"
00044
00045
00046 #include "rtm/idl/SDOPackageSkel.h"
00047
00048
00049
00050
00051 namespace SDOPackage
00052 {
00120 class Configuration_impl
00121 : public virtual POA_SDOPackage::Configuration,
00122 public virtual PortableServer::RefCountServantBase
00123 {
00124 public:
00125 Configuration_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00126 virtual ~Configuration_impl(){};
00127
00128
00129
00130
00131
00132
00166 virtual CORBA::Boolean set_device_profile(const DeviceProfile& dProfile)
00167 throw (InvalidParameter, NotAvailable, InternalError);
00168
00206 virtual CORBA::Boolean set_service_profile(const ServiceProfile& sProfile)
00207 throw (InvalidParameter, NotAvailable, InternalError);
00208
00237 virtual CORBA::Boolean add_organization(Organization_ptr org)
00238 throw (InvalidParameter, NotAvailable, InternalError);
00239
00274 virtual CORBA::Boolean remove_service_profile(const char* id)
00275 throw (InvalidParameter, NotAvailable, InternalError);
00276
00307 virtual CORBA::Boolean remove_organization(const char* organization_id)
00308 throw (InvalidParameter, NotAvailable, InternalError);
00309
00337 virtual ParameterList* get_configuration_parameters()
00338 throw (NotAvailable, InternalError);
00339
00364 virtual NVList* get_configuration_parameter_values()
00365 throw (NotAvailable, InternalError);
00366
00394 virtual CORBA::Any* get_configuration_parameter_value(const char* name)
00395 throw (InvalidParameter, NotAvailable, InternalError);
00396
00430 virtual CORBA::Boolean set_configuration_parameter(const char* name,
00431 const CORBA::Any& value)
00432 throw (InvalidParameter, NotAvailable, InternalError);
00433
00463 virtual ConfigurationSetList* get_configuration_sets()
00464 throw (NotAvailable, InternalError);
00465
00496 virtual ConfigurationSet* get_configuration_set(const char* config_id)
00497 throw (InvalidParameter, NotAvailable, InternalError);
00498
00537 virtual CORBA::Boolean
00538 set_configuration_set_values(const char* config_id,
00539 const ConfigurationSet& configuration_set)
00540 throw (InvalidParameter, NotAvailable, InternalError);
00541
00585 virtual ConfigurationSet* get_active_configuration_set()
00586 throw (NotAvailable, InternalError);
00587
00618 virtual CORBA::Boolean
00619 add_configuration_set(const ConfigurationSet& configuration_set)
00620 throw (InvalidParameter, NotAvailable, InternalError);
00621
00653 virtual CORBA::Boolean remove_configuration_set(const char* config_id)
00654 throw (InvalidParameter, NotAvailable, InternalError);
00655
00699 virtual CORBA::Boolean activate_configuration_set(const char* config_id)
00700 throw (InvalidParameter, NotAvailable, InternalError);
00701
00702
00703
00704
00705 const DeviceProfile getDeviceProfile();
00706
00707 const ServiceProfileList getServiceProfiles();
00708
00709 const ServiceProfile getServiceProfile(const char* id);
00710
00711 const OrganizationList getOrganizations();
00712
00713 protected:
00714 const std::string getUUID() const;
00715 CORBA::Long getActiveConfigIndex();
00716
00717 typedef ACE_Guard<ACE_Thread_Mutex> Guard;
00725 DeviceProfile m_deviceProfile;
00726 ACE_Thread_Mutex m_dprofile_mutex;
00727
00735 ServiceProfileList m_serviceProfiles;
00736 ACE_Thread_Mutex m_sprofile_mutex;
00737
00745
00746
00747
00748
00749
00750
00751
00752
00753 ParameterList m_parameters;
00754 ACE_Thread_Mutex m_params_mutex;
00755
00763
00764
00765
00766
00767
00768
00769
00770
00771 ConfigurationSetList m_configurations;
00772 std::string m_activeConfId;
00773 CORBA::Long m_activeConfIndex;
00774 ACE_Thread_Mutex m_config_mutex;
00775
00783 OrganizationList m_organizations;
00784 ACE_Thread_Mutex m_org_mutex;
00785
00794 struct nv_name
00795 {
00796 nv_name(const char* name) : m_name(name) {};
00797 bool operator()(const NameValue& nv)
00798 {
00799 return m_name == std::string(nv.name);
00800 }
00801 std::string m_name;
00802 };
00803
00804
00805
00806 struct service_id
00807 {
00808 service_id(const char* id) : m_id(id) {};
00809 bool operator()(const ServiceProfile& s)
00810 {
00811 std::string id(s.id);
00812 return m_id == id;
00813 }
00814 const std::string m_id;
00815 };
00816
00817
00818 struct org_id
00819 {
00820 org_id(const char* id) : m_id(id) {};
00821 bool operator()(const Organization_ptr& o)
00822 {
00823 std::string id(o->get_organization_id());
00824 return m_id == id;
00825 }
00826 const std::string m_id;
00827 };
00828
00829
00830 struct config_id
00831 {
00832 config_id(const char* id) : m_id(id) {};
00833 bool operator()(const ConfigurationSet& c)
00834 {
00835 std::string id(c.id);
00836 return m_id == id;
00837 }
00838 const std::string m_id;
00839 };
00840
00841 CORBA::ORB_var m_varORB;
00842 PortableServer::POA_var m_varPOA;
00843
00844 };
00845
00846 };
00847
00848 #endif // SdoConfiguration_h