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

MonitorComponent.h

Go to the documentation of this file.
00001 #ifndef MONITOR_COMPONENT_H
00002 #define MONITOR_COMPONENT_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: MonitorComponent.h,v 1.3 2012/03/02 14:03:10 tstaig 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 "MonitorPoint.h"
00033 
00034 #define ROMONITORPOINTNS(NS, Type, type) ROMonitorPoint<NS::Type, TMCDB::type##BlobDataSeq, ACS::P##type, POA_ACS::CB##type, POA_ACS::Alarm##type, NS::Type, ACS::type##Seq_var, NS::Type>
00035 #define ROMONITORPOINT(Type, type) ROMonitorPoint<const Type, TMCDB::type##BlobDataSeq, ACS::P##type, POA_ACS::CB##type, POA_ACS::Alarm##type, Type, ACS::type##Seq_var, const Type>
00036 #define ROMONITORPOINTNSSEQ(NS, Type, type) ROMonitorPoint<const ACS::type##Seq&, TMCDB::type##SeqBlobDataSeq, ACS::P##type##Seq, POA_ACS::CB##type##Seq, POA_ACS::Alarm##type, NS::Type, ACS::type##SeqSeq_var, NS::Type>
00037 #define ROMONITORPOINTSEQ(Type, type) ROMonitorPoint<const ACS::type##Seq&, TMCDB::type##SeqBlobDataSeq, ACS::P##type##Seq, POA_ACS::CB##type##Seq, POA_ACS::Alarm##type, Type, ACS::type##SeqSeq_var, const Type>
00038 #define MONITORPOINTNS(NS, Type, type) MonitorPoint<NS::Type, TMCDB::type##BlobDataSeq, ACS::P##type, POA_ACS::CB##type, NS::Type>
00039 #define MONITORPOINT(Type, type) MonitorPoint<const Type, TMCDB::type##BlobDataSeq, ACS::P##type, POA_ACS::CB##type, Type>
00040 #define MONITORPOINTNSSEQ(NS, Type, type) MonitorPoint<const ACS::type##Seq&, TMCDB::type##SeqBlobDataSeq, ACS::P##type##Seq, POA_ACS::CB##type##Seq, NS::Type>
00041 #define MONITORPOINTSEQ(Type, type) MonitorPoint<const ACS::type##Seq&, TMCDB::type##SeqBlobDataSeq, ACS::P##type##Seq, POA_ACS::CB##type##Seq, Type>
00042 #define CBTIENS(NS, Type, type) POA_ACS::CB##type##_tie<MONITORPOINTNS(NS, Type, type) >
00043 #define CBTIE(Type, type) POA_ACS::CB##type##_tie<MONITORPOINT(Type, type) >
00044 #define CBTIENSSEQ(NS, Type, type) POA_ACS::CB##type##Seq_tie<MONITORPOINTNSSEQ(NS, Type, type) >
00045 #define CBTIESEQ(Type, type) POA_ACS::CB##type##Seq_tie<MONITORPOINTSEQ(Type, type) >
00046 #define ALARMTIENS(NS, Type, type) POA_ACS::Alarm##type##_tie<ROMONITORPOINTNS(NS, Type, type) >
00047 #define ALARMTIE(Type, type) POA_ACS::Alarm##type##_tie<ROMONITORPOINT(Type, type) >
00048 #define ALARMTIENSSEQ(NS, Type, type) POA_ACS::Alarm##type##_tie<ROMONITORPOINTNSSEQ(NS, Type, type) >
00049 #define ALARMTIESEQ(Type, type) POA_ACS::Alarm##type##_tie<ROMONITORPOINTSEQ(Type, type) >
00050 
00051 namespace TMCDB
00052 {
00053 
00054 
00055 
00059 class MonitorComponent
00060 {
00061 public:
00063         MonitorComponent(ACS::CharacteristicComponent_ptr comp, maci::ContainerServices *cs); //ctor
00064 
00065         virtual ~MonitorComponent(); //ctor
00066 
00067         void startMonitoring();
00068 
00069         void stopMonitoring();
00070 
00073         bool addProperty(const char *propName);
00074 
00075         bool addProperty(const char *propName,  const char *pType,  ACS::Property* propRef, ACS::TimeInterval &monitoringInterval);
00076 
00078         void addAllProperties();
00079 
00080         void fillSeq();
00081 
00082         MonitorDataBlock& getMonitorDataBlock() { return monitorDataBlock_m; }
00083 
00084         void setDeviceSerialNumber(serialNumberType sn);
00085 
00086         void setPropertySerialNumber(char* propertyName, serialNumberTypeSeq sn);
00087 
00088         void set_archiving_interval(const char* propertyName, ACS::TimeInterval time);
00089 
00090         void suppress_archiving(const char* propertyName);
00091 
00092         void enable_archiving(const char* propertyName);
00093 
00094 private:
00095 
00099         ACS::TimeInterval propertyArchivingInterval(ACS::PropertyDesc *);
00100 
00102         std::vector<MonitorPointBase*> monitorPoints_m;
00104         ACS::CharacteristicComponent_var component_m;
00105 
00107         MonitorDataBlock monitorDataBlock_m;
00108 
00110         unsigned int seqIndex_m;
00111 
00112         // we need container services for activate/deactivate callbacks for monitors
00113         maci::ContainerServices *containerServices_m;
00114 
00116         ACS::CharacteristicComponentDesc_var compDesc_m;
00117 
00119         CORBA::ULong numOfProp_m;
00120 
00121         bool monitoring_m; 
00122 
00123         ACS::Time m_monitoringStartTime; 
00124 
00125         ACE_Thread_Mutex m_proMutex;
00126 
00127 };//MonitorComponent
00128 
00129 
00130 
00131 };//namespace TMCDB
00132 
00133 
00134 #endif 

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