• 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.47 2008/10/09 05:06:11 cparedes 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   /* -------------------- [ P interface ] -------------------- */
00223 
00224         virtual ACS::TimeInterval default_timer_trigger (
00225               
00226           );
00227         
00228         virtual ACS::TimeInterval min_timer_trigger (
00229               
00230           );
00231         
00232         virtual T default_value (
00233               
00234           );
00235                 
00236         virtual T get_sync (
00237             ACSErr::Completion_out c
00238             
00239           );
00240         
00241   virtual void get_async (
00242                           CBpattern* cb,
00243                           const ACS::CBDescIn & desc
00244                             
00245                      );
00246         
00247         virtual CORBA::Long get_history (
00248             CORBA::Long n_last_values,
00249             TSeq_out vs,
00250             ACS::TimeSeq_out ts
00251             
00252           );
00253         
00254         virtual ACS::Monitorpattern* create_monitor (
00255             CBpattern* cb,
00256             const ACS::CBDescIn & desc
00257             
00258           );
00259         
00260      virtual ACS::Monitor* create_postponed_monitor (
00261             ACS::Time start_time,
00262             CBpattern* cb,
00263             const ACS::CBDescIn & desc
00264             
00265           );
00266         
00267      virtual ACS::stringSeq * statesDescription (
00268            
00269       ); 
00270     
00271     virtual ACS::ConditionSeq * condition (
00272           
00273       );
00274     
00275     virtual TSeq * allStates (
00276           
00277         );
00278 
00279   /* -------------------- [ RW interface ] -------------------- */
00280   virtual ACSErr::Completion * set_sync ( T value );
00281         
00282   virtual void set_async ( T value,
00283                            ACS::CBvoid_ptr cb,
00284                            const ACS::CBDescIn & desc
00285                            
00286       ) ;
00287         
00288   virtual void set_nonblocking ( T value);
00289 
00290 protected:
00291 
00297   virtual bool readCharacteristics();
00298   
00299   /* --------------------- [ History support ] ---------------------- */
00300 
00301   void addValueToHistory(ACS::Time time, ACS::pattern value);
00302 private:
00303   
00304   T state;
00308   /*  typedef baci::ActionRequest (RWdouble::*ActionFunction)(baci::BACIComponent* cob, const int& callbackID,
00309                                                     const CBDescIn& descIn, baci::BACIValue* value,
00310                                                     Completion& completion, CBDescOut& descOut);
00311   */
00313   int initialization_m;
00314   
00316   bool destroyed_m;
00317 
00319   CORBA::Object_ptr reference_mp;
00320 
00322   baci::BACIProperty* property_mp;
00323 
00325   T historyValue_m[HISTORY_SIZE];
00326 
00328   ACS::Time historyTime_m[HISTORY_SIZE];
00329 
00331   int historyStart_m;
00332 
00334   bool historyTurnaround_m;
00335 
00339 
00340   // Typeless property
00341   ACE_CString  m_description;                   
00342   ACE_CString  format_m;                                
00343   ACE_CString  units_m;                                 
00344   ACS::pattern m_resolution;                    
00345   bool initializeDevIO_m;   
00346 
00347   // P
00348   T     defaultValue_m;                         
00349   ACS::TimeInterval  defaultTimerTrig_m;                
00350   ACS::TimeInterval  minTimerTrig_m;                    
00351 
00352   ACS::stringSeq    m_statesDescription;
00353   ACS::ConditionSeq m_condition;
00354         
00355     DevIO<T> *devIO_mp;  
00356     bool deldevIO_m;
00357     T m_value;
00358     int m_enumLength;
00359 };
00360 
00361 #include "enumpropRWImpl.i"
00362 
00363 #endif 

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