Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

SdoConfiguration.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00019 /*
00020  * $Log: SdoConfiguration.h,v $
00021  * Revision 1.4  2006/11/08 20:00:21  n-ando
00022  * ConfigurationSet related interfaces are fixed.
00023  *
00024  * Revision 1.3  2006/10/30 08:05:45  n-ando
00025  * CORBA sequence operations were replaced by CORBA_SeqUtil functions.
00026  *
00027  * Revision 1.2  2006/10/17 10:13:15  n-ando
00028  * Small fixes.
00029  *
00030  * Revision 1.1  2006/09/11 18:14:01  n-ando
00031  * The first commit.
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 // CORBA header include
00043 #include "rtm/RTC.h"
00044 
00045 // local includes
00046 #include "rtm/idl/SDOPackageSkel.h"
00047 
00048 // SdoConfiguration with SeqEx 159120
00049 // SdoConfiguration with SeqUtil 114504 114224
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     // <<< CORBA interfaces >>>
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     // end of CORBA interface definition
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     struct Parameter
00747     {
00748       string         name;
00749       TypeCode  type;
00750       AllowedValues allowed_values;
00751     };
00752     */
00753     ParameterList m_parameters;
00754     ACE_Thread_Mutex m_params_mutex;
00755 
00763     /*
00764       struct ConfigurationSet
00765       {
00766       string id;
00767       string description;
00768       NVList configuration_data;
00769       };
00770     */
00771     ConfigurationSetList m_configurations;
00772     std::string  m_activeConfId;
00773     CORBA::Long m_activeConfIndex; // -1: active config list has changed
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     // functor for ServiceProfile
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     // functor for Organization
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     // functor for ConfigurationSet
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 }; // namespace SDOPackage
00847 
00848 #endif // SdoConfiguration_h

Generated on Mon Jan 15 12:15:35 2007 for OpenRTM by  doxygen 1.4.1