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

Generated on Fri Oct 5 05:16:00 2007 for OpenRTM by  doxygen 1.4.1