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.8  2007/04/26 15:33:21  n-ando
00022  * The header include order was modified to define _REENTRANT before
00023  * including ace/config-lite.h in Linux systems.
00024  * In ace 5.4.7 or later, _REENTRANT flag should be defined explicitly.
00025  *
00026  * Revision 1.7  2007/04/23 04:58:21  n-ando
00027  * SDO Configuration was modified to use Configuration admin class.
00028  *
00029  * Revision 1.6  2007/01/24 16:03:58  n-ando
00030  * The ctor. was changed.
00031  *
00032  * Revision 1.5  2007/01/21 13:05:13  n-ando
00033  * A trivial fix.
00034  *
00035  * Revision 1.4  2006/11/08 20:00:21  n-ando
00036  * ConfigurationSet related interfaces are fixed.
00037  *
00038  * Revision 1.3  2006/10/30 08:05:45  n-ando
00039  * CORBA sequence operations were replaced by CORBA_SeqUtil functions.
00040  *
00041  * Revision 1.2  2006/10/17 10:13:15  n-ando
00042  * Small fixes.
00043  *
00044  * Revision 1.1  2006/09/11 18:14:01  n-ando
00045  * The first commit.
00046  *
00047  *
00048  */
00049 
00050 #ifndef SdoConfiguration_h
00051 #define SdoConfiguration_h
00052 
00053 // CORBA header include
00054 #include <rtm/RTC.h>
00055 
00056 #include <ace/Guard_T.h>
00057 #include <ace/Thread_Mutex.h>
00058 
00059 // local includes
00060 #include <rtm/idl/SDOPackageSkel.h>
00061 #include <rtm/ConfigAdmin.h>
00062 #include <string>
00063 
00064 // SdoConfiguration with SeqEx 159120
00065 // SdoConfiguration with SeqUtil 114504 114224
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     // <<< CORBA interfaces >>>
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     // end of CORBA interface definition
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     struct Parameter
00766     {
00767       string         name;
00768       TypeCode  type;
00769       AllowedValues allowed_values;
00770     };
00771     */
00772     ParameterList m_parameters;
00773     ACE_Thread_Mutex m_params_mutex;
00774 
00782     /*
00783       struct ConfigurationSet
00784       {
00785       string id;
00786       string description;
00787       NVList configuration_data;
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     // functor for ServiceProfile
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     // functor for Organization
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     // functor for ConfigurationSet
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 }; // namespace SDOPackage
00861 
00862 #endif // SdoConfiguration_h

Generated on Mon Jul 23 17:08:14 2007 for OpenRTM by  doxygen 1.4.1