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

SdoSystemElement.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00019 /*
00020  * $Log: SdoSystemElement.h,v $
00021  * Revision 1.2  2006/10/17 10:12:44  n-ando
00022  * Small fixes.
00023  *
00024  * Revision 1.1  2006/09/11 18:14:41  n-ando
00025  * The first commit.
00026  *
00027  *
00028  */
00029 
00030 #ifndef SdoSystemElement_h
00031 #define SdoSystemElement_h
00032 
00033 // CORBA header include
00034 #include "rtm/RTC.h"
00035 #include "rtm/Util.h"
00036 
00037 
00038 
00039 // local includes
00040 #include "rtm/idl/SDOPackageSkel.h"
00041 
00042 
00043 
00044 namespace SDOPackage
00045 {
00046   class Configuration_impl;
00047   class Organization_impl;
00067   class SDOSystemElement_impl
00068     : public virtual POA_SDOPackage::SDOSystemElement, 
00069       public virtual PortableServer::RefCountServantBase
00070   {
00071   public:
00082     SDOSystemElement_impl();
00083     SDOSystemElement_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00084 
00096     virtual ~SDOSystemElement_impl();
00097 
00098     //============================================================
00099     //
00100     // <<< CORBA interfaces >>>
00101     //
00102     //============================================================
00103 
00125     virtual OrganizationList* get_owned_organizations()
00126       throw (NotAvailable);
00127 
00128     // end of CORBA interface definition
00129     //============================================================
00130 
00131   protected:
00132     // Partial specialization
00133     template <class T, class X>
00134     class SeqEx
00135       : public SequenceEx <T, X, ACE_Thread_Mutex> {};
00136     
00137     SeqEx<OrganizationList, Organization_ptr> m_ownedOrganizations;
00138 
00139     CORBA::ORB_var m_pORB;
00140     PortableServer::POA_var m_pPOA;
00141     
00142 
00143   };
00144   
00145 
00146   //============================================================
00147   // SDO_impl
00148   //============================================================
00170   class SDO_impl
00171     : public virtual SDOSystemElement_impl
00172   {
00173   public:
00174     //    SDO_impl();
00175     //    SDO_impl(char* id = "", char* type = "");
00176     SDO_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00177     virtual ~SDO_impl(){};
00178 
00179     //============================================================
00180     //
00181     // <<< CORBA interfaces >>>
00182     //
00183     //============================================================
00184 
00214     virtual char* get_sdo_id()
00215       throw (NotAvailable, InternalError);
00216     
00246     virtual char* get_sdo_type()
00247       throw (NotAvailable, InternalError);
00248     
00279     virtual DeviceProfile* get_device_profile()
00280       throw (NotAvailable, InternalError);
00281     
00313     virtual ServiceProfileList* get_service_profiles()
00314       throw (InvalidParameter, NotAvailable, InternalError);
00315     
00344     virtual ServiceProfile* get_service_profile(const char* id)
00345       throw (InvalidParameter, NotAvailable, InternalError);
00346     
00374     virtual SDOService_ptr get_sdo_service(const char* id)
00375       throw (InvalidParameter, NotAvailable, InternalError);
00376     
00416     virtual Configuration_ptr get_configuration()
00417       throw (InterfaceNotImplemented, NotAvailable, InternalError);
00418     
00457     virtual Monitoring_ptr get_monitoring()
00458       throw (InterfaceNotImplemented, NotAvailable, InternalError);
00459     
00490     virtual OrganizationList* get_organizations()
00491       throw (NotAvailable, InternalError);
00492     
00519     virtual NVList* get_status_list()
00520       throw (NotAvailable, InternalError);
00521     
00551     virtual CORBA::Any* get_status(const char* name)
00552       throw (InvalidParameter, NotAvailable, InternalError);
00553     
00554     // end of CORBA interface definition
00555     //============================================================
00556 
00557 
00558     //============================================================
00559     //
00560     // <<< Local interfaces >>>
00561     //
00562     //============================================================
00563 
00564     void setSdoId(const char* sdo_id);
00565     void setSdoType(const char* sdo_type);
00566     void setDeviceProfile(const DeviceProfile& device_profile);
00567     void setServiceProfiles(const ServiceProfileList& service_profile);
00568     void addServiceProfile(const ServiceProfile& service_profile);
00569     
00570     
00571   protected:
00572     // Partial specialization
00573     template <class T, class X>
00574     class SeqEx
00575       : public SequenceEx <T, X, ACE_Thread_Mutex> {};
00576     
00577     struct SdoId
00578     {
00579       CORBA::String_var _id;
00580       ACE_Thread_Mutex _mutex;
00581     };
00582 
00583     struct SdoType
00584     {
00585       CORBA::String_var _type;
00586       ACE_Thread_Mutex _mutex;
00587     };
00588 
00589     SdoId m_SdoId;
00590     SdoType m_SdoType;
00591 
00592 
00593     Configuration_impl* m_pConfig;
00594 
00595 
00596     Configuration_var m_varConfiguration;
00597     Monitoring_var m_varMonitoring;
00598     SeqEx<NVList, NameValue> m_Status;
00599     
00600     // functor for ServiceProfile
00601     struct nv_name
00602     {
00603       nv_name(const char* id) : m_name(id) {};
00604       bool operator()(const NameValue& v)
00605       {
00606         std::string name(v.name);
00607         return m_name == name;
00608       }
00609       const std::string m_name;
00610     };
00611 
00612 
00613     PortableServer::ObjectId_var m_varConfigId;
00614     SDOPackage::Configuration_var m_varConfigObj;
00615 
00616     PortableServer::ObjectId_var m_varOrgId;
00617     SDOPackage::Configuration_var m_varOrgObj;
00618 
00619   };
00620 
00621 }; // namespace SDOPackage
00622 
00623 #endif // SdoSystemElement_h

Generated on Sat Oct 28 02:28:13 2006 for OpenRTM by  doxygen 1.4.1