• 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.53 2012/11/20 15:17:07 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         virtual void enable_alarm_system();
00171 
00172         virtual void disable_alarm_system();
00173 
00174         virtual bool alarm_system_enabled();
00175     
00176     /*
00177         virtual CosPropertyService::PropertySet_ptr get_all_characteristics (
00178             
00179           );
00180     */
00181   
00182   /* ----------------- [ TypelessProperty interface ] ----------------- */
00183 
00184         virtual char * description ();
00185         
00186         virtual char * format ();
00187         
00188         virtual char * units ();
00189         
00190         virtual ACS::pattern resolution ();
00191         
00192         virtual CORBA::Boolean initialize_devio (); 
00193 
00194         virtual void publish_now();
00195   /* -------------------- [ P interface ] -------------------- */
00196 
00197     virtual ACS::TimeInterval default_timer_trigger ();
00198         
00199     virtual ACS::TimeInterval min_timer_trigger ();
00200         
00201     virtual T default_value ();
00202                 
00203     virtual T get_sync (ACSErr::Completion_out c);
00204         
00205     virtual void get_async (
00206                           CBpattern* cb,
00207                           const ACS::CBDescIn & desc
00208                      );
00209         
00210     virtual CORBA::Long get_history (
00211         CORBA::Long n_last_values,
00212         TSeq_out vs,
00213         ACS::TimeSeq_out ts
00214     );
00215         
00216     virtual ACS::Monitorpattern* create_monitor (
00217         CBpattern* cb,
00218         const ACS::CBDescIn & desc
00219     );
00220         
00221     virtual ACS::Monitor* create_postponed_monitor (
00222         ACS::Time start_time,
00223         CBpattern* cb,
00224         const ACS::CBDescIn & desc
00225         );
00226     
00227     virtual ACS::stringSeq * statesDescription (
00228         ); 
00229     
00230     virtual ACS::ConditionSeq * condition (
00231         );
00232     
00233     virtual TSeq * allStates ();
00234 
00235     /* -------------------- [ RO interface ] -------------------- */
00236   
00237     virtual TSeq* alarm_on ();
00238         
00239     virtual TSeq* alarm_off ();
00240     
00241     virtual ACS::Subscription_ptr new_subscription_AlarmEnum (
00242         ACS::Alarmpattern_ptr cb,
00243         const ACS::CBDescIn & desc
00244     ); 
00250     bool checkAlarm(T state);
00251 
00257     void setAlarmFaultFamily(const char* ff);
00258 
00264     void setAlarmFaultMember(const char* fm);
00265 
00269     const char* getAlarmFaultFamily() { return alarmFaultFamily_m.c_str(); }
00270 
00274     const char* getAlarmFaultMember() { return alarmFaultMember_m.c_str(); }
00275 
00279     int getAlarmLevel() { return this->alarmLevel_m;}
00280 
00281 
00282 protected:
00283     
00289     virtual bool readCharacteristics();
00290 
00291     /* --------------------- [ History support ] ---------------------- */
00292     
00293     void addValueToHistory(ACS::Time time, ACS::pattern value);
00294     
00295   private:
00296     
00300     T state;
00301 
00305     /*  typedef ActionRequest (ROdouble::*ActionFunction)(BACIComponent* cob, const int& callbackID,
00306         const CBDescIn& descIn, BACIValue* value,
00307         Completion& completion, CBDescOut& descOut);
00308     */
00310     int initialization_m;
00311     
00313     bool destroyed_m;
00314     
00316     CORBA::Object_ptr reference_mp;
00317     
00319     baci::BACIProperty* property_mp;
00320     
00322     baci::MonitorenumpropEventDispatcher *monitorEventDispatcher_mp;
00323     
00325     baci::AlarmSystemMonitorEnumProp<T, ROEnumImpl<ACS_ENUM_T(T), SK> > *alarmSystemMonitorEnumProp_mp;
00326 
00328     T historyValue_m[HISTORY_SIZE];
00329     
00331     ACS::Time historyTime_m[HISTORY_SIZE];
00332     
00334     int historyStart_m;
00335     
00337     bool historyTurnaround_m;
00338     
00342     
00343     // Typeless property
00344     ACE_CString  m_description;                         
00345     ACE_CString  format_m;                              
00346     ACE_CString  units_m;                               
00347     ACS::pattern m_resolution;                  
00348     bool initializeDevIO_m;   
00349  
00350     // P
00351     T   defaultValue_m;                         
00352     ACS::TimeInterval  defaultTimerTrig_m;              
00353     ACS::TimeInterval  minTimerTrig_m;                  
00354     
00355     ACS::TimeInterval  m_alarm_timer_trig;
00356     
00357     ACS::stringSeq    m_statesDescription;
00358     ACS::ConditionSeq m_condition;      
00359     
00360     // RO
00362     TSeq        m_alarm_on;                     
00363 
00365     TSeq        m_alarm_off;                    
00366 
00368     bool  alarmRaised_m; 
00369 
00370     ACE_CString alarmFaultFamily_m;
00371     ACE_CString alarmFaultMember_m;
00372     int alarmLevel_m;
00373     bool alarmSystemEnabled_m;
00374 
00375 #ifdef MAKE_VXWORKS 
00376     baci::AlarmenumpropEventStrategy<T, ROEnumImpl<ACS_ENUM_T(T), SK>, ACS::Alarmpattern> a;
00377 #endif
00378     
00379     DevIO<T> *devIO_mp;  
00380     bool deldevIO_m;
00381     T   m_value;
00382     int m_enumLength;
00383 };
00384 
00385 #include "enumpropROImpl.i"
00386 
00387 #endif 

Generated on Mon May 4 2015 08:27:43 for ACS-2015.4 C++ API by  doxygen 1.7.0