• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

enumpropROImpl.h

Go to the documentation of this file.
00001 #ifndef ENUM_IMPL_H
00002 #define ENUM_IMPL_H
00003 /*******************************************************************************
00004 * E.S.O. - ACS project
00005 *
00006 * "@(#) $Id: enumpropROImpl.h,v 1.51 2011/05/06 21:04:47 acaproni Exp $"
00007 *
00008 * who       when      what
00009 * --------  --------  ----------------------------------------------
00010 * bjeram 2004-01-12 changed m_value type from pattern to T
00011 * bjeram 2002-11-18 change to create_monitor to return Monitorpattern (onchange)
00012 * bjeram 2001-11-28 changed to virtual inheritence of PortableServer::RefCountServantBase
00013 * bjeram 2001-10-24 added support for namespaces in enumpropMACRO.idl
00014 * bjeram  19/04/01  created
00015 */
00016 
00017 #ifndef __cplusplus
00018 #error This is a C++ include file and cannot be used from plain C
00019 #endif
00020 
00021 #include <baciDB.h>
00022 #include <logging.h>
00023 #include <baciROpattern.h>
00024 #include <baciRecovery.h>
00025 #include <enumpropAlarm.h>
00026 #include <baciErrTypeProperty.h>
00027 #include <baciCharacteristicModelImpl.h>
00028 #include "enumpropAlarmSystemMonitorEnumProp.h"
00029 
00030 #define HISTORY_SIZE 32
00031 
00032 
00033 #define ACS_ENUM_T(T) T, T##CB, T##Seq, T##Seq_out, T##Alarm
00034 #define ACS_ENUM_C class T, class TCB, class TSeq, class TSeq_out, class TAlarm, class SK
00035 
00038 template <ACS_ENUM_C>
00039 class ROEnumImpl: public virtual PortableServer::RefCountServantBase,
00040                   public SK, 
00041                   public baci::CharacteristicModelImpl,
00042                   public baci::PropertyImplementator,
00043                   public baci::ActionImplementator 
00044 {
00045 
00046 public:
00047 
00048 
00054   ROEnumImpl(const ACE_CString& name, baci::BACIComponent *cob, DevIO<T> *devIO=0, bool flagdeldevIO=false);
00055    
00059   virtual ~ROEnumImpl();
00060 
00067   virtual int initialization() { return initialization_m; }
00068 
00073   CORBA::Object_ptr getCORBAReference() const 
00074   { 
00075     return reference_mp;
00076   }
00077 
00081   baci::BACIProperty* getProperty() const 
00082   { 
00083     return property_mp;
00084   }
00085 
00089     DevIO<T>* getDevIO() const
00090         {
00091             return devIO_mp;
00092         }
00099    virtual void destroy();
00100 
00101   /***
00102    * Implementation of async. get_value method
00103    */
00104   virtual baci::ActionRequest getValueAction(baci::BACIComponent* cob, const int& callbackID,
00105                                                         const CBDescIn& descIn, baci::BACIValue* value,
00106                                                         Completion& completion, CBDescOut& descOut);
00107 
00108   /* --------------- [ Action implementator interface ] -------------- */
00109 
00127   virtual baci::ActionRequest invokeAction(int function,
00128                                      baci::BACIComponent* cob, const int& callbackID, 
00129                                      const CBDescIn& descIn, baci::BACIValue* value, 
00130                                      Completion& completion, CBDescOut& descOut);
00131 
00132   /* -------------- [ Property implementator interface ] -------------- */
00133 
00141   virtual void getValue(baci::BACIProperty* property,
00142                         baci::BACIValue* value, 
00143                         Completion &completion,
00144                         CBDescOut& descOut);
00145 
00146   /* ----------------------------------------------------------------- */
00147   /* ---------------------- [ CORBA interface ] ---------------------- */
00148   /* ----------------------------------------------------------------- */
00149 
00150   /* ------------------ [ CharacteristicModel interface ] ------------------ */
00151 
00152         virtual char * name ();
00153 
00154     /*
00155         virtual CORBA::Any * get_characteristic_by_name (
00156             const char * name
00157             
00158           );
00159         
00160         virtual ACS::stringSeq * find_characteristic (
00161             const char * reg_exp
00162             
00163           );
00164     */
00165 
00166   /* --------------------- [ Property interface ] --------------------- */
00167 
00168         virtual char * characteristic_component_name ();
00169 
00170     /*
00171         virtual CosPropertyService::PropertySet_ptr get_all_characteristics (
00172             
00173           );
00174     */
00175   
00176   /* ----------------- [ TypelessProperty interface ] ----------------- */
00177 
00178         virtual char * description ();
00179         
00180         virtual char * format ();
00181         
00182         virtual char * units ();
00183         
00184         virtual ACS::pattern resolution ();
00185         
00186         virtual CORBA::Boolean initialize_devio (); 
00187   /* -------------------- [ P interface ] -------------------- */
00188 
00189     virtual ACS::TimeInterval default_timer_trigger ();
00190         
00191     virtual ACS::TimeInterval min_timer_trigger ();
00192         
00193     virtual T default_value ();
00194                 
00195     virtual T get_sync (ACSErr::Completion_out c);
00196         
00197     virtual void get_async (
00198                           CBpattern* cb,
00199                           const ACS::CBDescIn & desc
00200                      );
00201         
00202     virtual CORBA::Long get_history (
00203         CORBA::Long n_last_values,
00204         TSeq_out vs,
00205         ACS::TimeSeq_out ts
00206     );
00207         
00208     virtual ACS::Monitorpattern* create_monitor (
00209         CBpattern* cb,
00210         const ACS::CBDescIn & desc
00211     );
00212         
00213     virtual ACS::Monitor* create_postponed_monitor (
00214         ACS::Time start_time,
00215         CBpattern* cb,
00216         const ACS::CBDescIn & desc
00217         );
00218     
00219     virtual ACS::stringSeq * statesDescription (
00220         ); 
00221     
00222     virtual ACS::ConditionSeq * condition (
00223         );
00224     
00225     virtual TSeq * allStates ();
00226 
00227     /* -------------------- [ RO interface ] -------------------- */
00228   
00229     virtual TSeq* alarm_on ();
00230         
00231     virtual TSeq* alarm_off ();
00232     
00233     virtual ACS::Subscription_ptr new_subscription_AlarmEnum (
00234         ACS::Alarmpattern_ptr cb,
00235         const ACS::CBDescIn & desc
00236     ); 
00242     bool checkAlarm(T state);
00243 
00249     void setAlarmFaultFamily(const char* ff);
00250 
00256     void setAlarmFaultMember(const char* fm);
00257 
00261     const char* getAlarmFaultFamily() { return alarmFaultFamily_m.c_str(); }
00262 
00266     const char* getAlarmFaultMember() { return alarmFaultMember_m.c_str(); }
00267 
00271     int getAlarmLevel() { return this->alarmLevel_m;}
00272 
00273 
00274 protected:
00275     
00281     virtual bool readCharacteristics();
00282 
00283     /* --------------------- [ History support ] ---------------------- */
00284     
00285     void addValueToHistory(ACS::Time time, ACS::pattern value);
00286     
00287   private:
00288     
00292     T state;
00293 
00297     /*  typedef ActionRequest (ROdouble::*ActionFunction)(BACIComponent* cob, const int& callbackID,
00298         const CBDescIn& descIn, BACIValue* value,
00299         Completion& completion, CBDescOut& descOut);
00300     */
00302     int initialization_m;
00303     
00305     bool destroyed_m;
00306     
00308     CORBA::Object_ptr reference_mp;
00309     
00311     baci::BACIProperty* property_mp;
00312     
00314     baci::MonitorenumpropEventDispatcher *monitorEventDispatcher_mp;
00315     
00317     baci::AlarmSystemMonitorEnumProp<T, ROEnumImpl<ACS_ENUM_T(T), SK> > *alarmSystemMonitorEnumProp_mp;
00318 
00320     T historyValue_m[HISTORY_SIZE];
00321     
00323     ACS::Time historyTime_m[HISTORY_SIZE];
00324     
00326     int historyStart_m;
00327     
00329     bool historyTurnaround_m;
00330     
00334     
00335     // Typeless property
00336     ACE_CString  m_description;                         
00337     ACE_CString  format_m;                              
00338     ACE_CString  units_m;                               
00339     ACS::pattern m_resolution;                  
00340     bool initializeDevIO_m;   
00341  
00342     // P
00343     T   defaultValue_m;                         
00344     ACS::TimeInterval  defaultTimerTrig_m;              
00345     ACS::TimeInterval  minTimerTrig_m;                  
00346     
00347     ACS::TimeInterval  m_alarm_timer_trig;
00348     
00349     ACS::stringSeq    m_statesDescription;
00350     ACS::ConditionSeq m_condition;      
00351     
00352     // RO
00354     TSeq        m_alarm_on;                     
00355 
00357     TSeq        m_alarm_off;                    
00358 
00360     bool  alarmRaised_m; 
00361 
00362     ACE_CString alarmFaultFamily_m;
00363     ACE_CString alarmFaultMember_m;
00364     int alarmLevel_m;
00365 
00366 #ifdef MAKE_VXWORKS 
00367     baci::AlarmenumpropEventStrategy<T, ROEnumImpl<ACS_ENUM_T(T), SK>, ACS::Alarmpattern> a;
00368 #endif
00369     
00370     DevIO<T> *devIO_mp;  
00371     bool deldevIO_m;
00372     T   m_value;
00373     int m_enumLength;
00374 };
00375 
00376 #include "enumpropROImpl.i"
00377 
00378 #endif 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0