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

enumpropRWImpl.h

Go to the documentation of this file.
00001 #ifndef RWENUM_IMPL_H
00002 #define RWENUM_IMPL_H
00003 /*******************************************************************************
00004 * E.S.O. - ACS project
00005 *
00006 * "@(#) $Id: enumpropRWImpl.h,v 1.48 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 2003-03-14 changed defaultValue_m from ACS::pattern type to type T
00012 * bjeram 2002-11-18 create_monitr returns Monitorpattern (onchange)
00013 * bjeram 2001-11-28 RWEnumImpl derives virtaully out of  PortableServer::RefCountServantBase
00014 * bjeram  05/11/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 
00029 #define HISTORY_SIZE 32
00030 
00031 
00032 #define ACS_ENUM_T(T) T, T##CB, T##Seq, T##Seq_out, T##Alarm
00033 #define ACS_ENUM_C class T, class TCB, class TSeq, class TSeq_out, class TAlarm, class SK
00034 
00037 template <ACS_ENUM_C>
00038 class RWEnumImpl: public virtual PortableServer::RefCountServantBase,
00039                   public SK, 
00040                   public baci::CharacteristicModelImpl,
00041                   public baci::PropertyImplementator,
00042                   public baci::ActionImplementator 
00043 {
00044 
00045 public:
00046 
00047 
00053   RWEnumImpl(const ACE_CString& name, baci::BACIComponent *cob, DevIO<T> *devIO=0, bool flagdeldevIO=false);
00054    
00058   virtual ~RWEnumImpl();
00059 
00066   virtual int initialization() { return initialization_m; }
00067 
00072   CORBA::Object_ptr getCORBAReference() const 
00073   { 
00074     return reference_mp;
00075   }
00076 
00080   baci::BACIProperty* getProperty() const 
00081   { 
00082     return property_mp;
00083   }
00084 
00088     DevIO<T>* getDevIO() const
00089         {
00090             return devIO_mp;
00091         }
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   /***
00109    * Implementation of async. set_value method
00110    */
00111   virtual baci::ActionRequest setValueAction(baci::BACIComponent* cob, const int& callbackID,
00112                                const CBDescIn& descIn, baci::BACIValue* value,
00113                                Completion& completion, CBDescOut& descOut);
00114 
00115  /* --------------- [ Action implementator interface ] -------------- */
00116 
00134   virtual baci::ActionRequest invokeAction(int function,
00135                                      baci::BACIComponent* cob, const int& callbackID, 
00136                                      const CBDescIn& descIn, baci::BACIValue* value, 
00137                                      Completion& completion, CBDescOut& descOut);
00138 
00139   /* -------------- [ Property implementator interface ] -------------- */
00140 
00148   virtual void getValue(baci::BACIProperty* property,
00149                         baci::BACIValue* value, 
00150                         Completion &completion,
00151                         CBDescOut& descOut);
00152 
00153  /* ----------------- [ Other interface ] ----------------- */
00154 
00163   virtual void setValue(baci::BACIProperty* property,
00164                         baci::BACIValue* value, 
00165                         Completion &completion,
00166                         CBDescOut& descOut);
00167 
00168   /* ----------------------------------------------------------------- */
00169   /* ---------------------- [ CORBA interface ] ---------------------- */
00170   /* ----------------------------------------------------------------- */
00171 
00172   /* ------------------ [ CharacteristicModel interface ] ------------------ */
00173 
00174         virtual char * name (
00175               
00176           );
00177 
00178     /*
00179         virtual CORBA::Any * get_characteristic_by_name (
00180             const char * name
00181             
00182           );
00183         
00184         virtual ACS::stringSeq * find_characteristic (
00185             const char * reg_exp
00186             
00187           );
00188     */
00189 
00190   /* --------------------- [ Property interface ] --------------------- */
00191 
00192         virtual char * characteristic_component_name (
00193               
00194           );
00195 
00196     /*
00197         virtual CosPropertyService::PropertySet_ptr get_all_characteristics (
00198             
00199           );
00200     */
00201   
00202   /* ----------------- [ TypelessProperty interface ] ----------------- */
00203 
00204         virtual char * description (
00205               
00206           );
00207         
00208         virtual char * format (
00209               
00210           );
00211         
00212         virtual char * units (
00213               
00214           );
00215         
00216         virtual ACS::pattern resolution (
00217               
00218           );
00219         
00220         virtual CORBA::Boolean initialize_devio (); 
00221         
00222         virtual void publish_now();
00223 
00224   /* -------------------- [ P interface ] -------------------- */
00225 
00226         virtual ACS::TimeInterval default_timer_trigger (
00227               
00228           );
00229         
00230         virtual ACS::TimeInterval min_timer_trigger (
00231               
00232           );
00233         
00234         virtual T default_value (
00235               
00236           );
00237                 
00238         virtual T get_sync (
00239             ACSErr::Completion_out c
00240             
00241           );
00242         
00243   virtual void get_async (
00244                           CBpattern* cb,
00245                           const ACS::CBDescIn & desc
00246                             
00247                      );
00248         
00249         virtual CORBA::Long get_history (
00250             CORBA::Long n_last_values,
00251             TSeq_out vs,
00252             ACS::TimeSeq_out ts
00253             
00254           );
00255         
00256         virtual ACS::Monitorpattern* create_monitor (
00257             CBpattern* cb,
00258             const ACS::CBDescIn & desc
00259             
00260           );
00261         
00262      virtual ACS::Monitor* create_postponed_monitor (
00263             ACS::Time start_time,
00264             CBpattern* cb,
00265             const ACS::CBDescIn & desc
00266             
00267           );
00268         
00269      virtual ACS::stringSeq * statesDescription (
00270            
00271       ); 
00272     
00273     virtual ACS::ConditionSeq * condition (
00274           
00275       );
00276     
00277     virtual TSeq * allStates (
00278           
00279         );
00280 
00281   /* -------------------- [ RW interface ] -------------------- */
00282   virtual ACSErr::Completion * set_sync ( T value );
00283         
00284   virtual void set_async ( T value,
00285                            ACS::CBvoid_ptr cb,
00286                            const ACS::CBDescIn & desc
00287                            
00288       ) ;
00289         
00290   virtual void set_nonblocking ( T value);
00291 
00292 protected:
00293 
00299   virtual bool readCharacteristics();
00300   
00301   /* --------------------- [ History support ] ---------------------- */
00302 
00303   void addValueToHistory(ACS::Time time, ACS::pattern value);
00304 private:
00305   
00306   T state;
00310   /*  typedef baci::ActionRequest (RWdouble::*ActionFunction)(baci::BACIComponent* cob, const int& callbackID,
00311                                                     const CBDescIn& descIn, baci::BACIValue* value,
00312                                                     Completion& completion, CBDescOut& descOut);
00313   */
00315   int initialization_m;
00316   
00318   bool destroyed_m;
00319 
00321   CORBA::Object_ptr reference_mp;
00322 
00324   baci::BACIProperty* property_mp;
00325 
00327   T historyValue_m[HISTORY_SIZE];
00328 
00330   ACS::Time historyTime_m[HISTORY_SIZE];
00331 
00333   int historyStart_m;
00334 
00336   bool historyTurnaround_m;
00337 
00341 
00342   // Typeless property
00343   ACE_CString  m_description;                   
00344   ACE_CString  format_m;                                
00345   ACE_CString  units_m;                                 
00346   ACS::pattern m_resolution;                    
00347   bool initializeDevIO_m;   
00348 
00349   // P
00350   T     defaultValue_m;                         
00351   ACS::TimeInterval  defaultTimerTrig_m;                
00352   ACS::TimeInterval  minTimerTrig_m;                    
00353 
00354   ACS::stringSeq    m_statesDescription;
00355   ACS::ConditionSeq m_condition;
00356         
00357     DevIO<T> *devIO_mp;  
00358     bool deldevIO_m;
00359     T m_value;
00360     int m_enumLength;
00361 };
00362 
00363 #include "enumpropRWImpl.i"
00364 
00365 #endif 

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