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

MonitorPoint.h

Go to the documentation of this file.
00001 #ifndef MONITOR_POINT_IMPL_H
00002 #define MONITOR_POINT_IMPL_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) European Southern Observatory, 2009
00006 *
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 *
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 *
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: MonitorPoint.h,v 1.3 2011/05/23 19:31:44 javarias Exp $"
00022 *
00023 * who       when      what
00024 * --------  --------  ----------------------------------------------
00025 * bjeram  2009-02-11  created
00026 */
00027 
00028 #ifndef __cplusplus
00029 #error This is a C++ include file and cannot be used from plain C
00030 #endif
00031 
00032 #include <tao/DynamicInterface/Request.h>
00033 
00034 #include "MonitorCollectorS.h"
00035 #include <baciCharacteristicComponentImpl.h>
00036 #include <TMCDBCOMMON_IDLS.h>
00037 namespace TMCDB
00038 {
00039 
00040 
00044 class MonitorPointBase : public virtual POA_ACS::Callback
00045 {
00046 public:
00047         MonitorPointBase(const char *propertyName, const ACS::TimeInterval &archivingInterval, TMCDB::DataValueType typeOfData, MonitorBlob& mb);
00048 
00049         virtual ~MonitorPointBase();
00050 
00051         void setPropertySerialNumber(serialNumberTypeSeq& sn);
00052 
00053         ACE_CString &getPropertyName() { return  propertyName_m; }
00054 
00055         CORBA::Boolean negotiate(ACS::TimeInterval, const ACS::CBDescOut&){ return true; }
00056 
00058         virtual void activate(maci::ContainerServices *cs);
00059 
00061         virtual void startMonitoring()=0;
00062 
00064         virtual void stopMonitoring()=0;
00065 
00067         virtual void fillSeq()=0;
00068 
00069         virtual void set_archiving_interval(ACS::TimeInterval time)=0;
00070 
00071         virtual void suppress_archiving()=0;
00072 
00073         virtual void enable_archiving()=0;
00074 
00075 protected:
00076 
00077         ACE_CString propertyName_m; 
00078 
00079         ACS::TimeInterval archivingInterval_m; // interval in which the value should be archived (and so monitored)
00080 
00081         double valuePercentTrigger_m; // Delta value percentage a value can change before the value should be archived (and so monitored)
00082 
00083         MonitorBlob& monitorBlob_m; 
00084 
00085         ACS::Monitor_var monitor_m; 
00086 
00087         ACS::OffShoot_var callback_m; 
00088 
00089         unsigned int curSeqPos_m; 
00090 
00091         unsigned int seqLen_m; 
00092 
00093         ACE_Thread_Mutex switchMutex_m; //when we switch the collection sequence
00094 
00095         bool suppressed_m;
00096 
00097         static const unsigned int prealocSeqLen_m = 100; // preallocated length of the seqnece. This is the step that the sequence will grow
00098         //TBD: do we need also type (as string or ..)?
00099 };//MonitorPointBase
00100 
00101 template <class T, class TBLOB_SEQ, class TPROP, class TCB, class TBASE>
00102 class MonitorPoint : public MonitorPointBase, public virtual TCB
00103 {
00104 public:
00105         MonitorPoint(const char *propertyName, const ACS::TimeInterval &monitoringInterval, ACS::Property* property, TMCDB::DataValueType typeOfData, MonitorBlob& mb);
00106 
00107         ~MonitorPoint();
00108 
00110         void startMonitoring();
00111 
00113         void stopMonitoring();
00114 
00115         void fillSeq();
00116 
00117         void set_archiving_interval(ACS::TimeInterval time);
00118 
00119         void suppress_archiving();
00120 
00121         void enable_archiving();
00122 
00124         void working(T value, const ACSErr::Completion& comp, const ACS::CBDescOut& cbdescout);
00125 
00127         void done(T value, const ACSErr::Completion& comp, const ACS::CBDescOut& cbdescout);
00128 protected:
00129         TPROP* property_m;
00130         TBLOB_SEQ blobDataSeq_m;
00131         TBASE valueTrigger_m; // Delta value describing how much a value can change before the value should be archived (and so monitored)
00132 };//MonitorPoint
00133 
00134 template <class T>
00135 T initValue(unsigned int len);
00136 template <>
00137 char* initValue(unsigned int len);
00138 #include "MonitorPoint.i"
00139 
00140 };
00141 
00142 #endif

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