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.2 2011/03/30 18:11:18 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 namespace TMCDB 00035 { 00036 00037 00038 00042 class MonitorComponent 00043 { 00044 public: 00046 MonitorComponent(ACS::CharacteristicComponent_ptr comp, maci::ContainerServices *cs); //ctor 00047 00048 virtual ~MonitorComponent(); //ctor 00049 00050 void startMonitoring(); 00051 00052 void stopMonitoring(); 00053 00056 bool addProperty(const char *propName); 00057 00058 bool addProperty(const char *propName, const char *pType, ACS::Property* propRef, ACS::TimeInterval &monitoringInterval); 00059 00061 void addAllProperties(); 00062 00063 void fillSeq(); 00064 00065 MonitorDataBlock& getMonitorDataBlock() { return monitorDataBlock_m; } 00066 00067 void setDeviceSerialNumber(serialNumberType sn); 00068 00069 void setPropertySerialNumber(char* propertyName, serialNumberTypeSeq sn); 00070 00071 void set_archiving_interval(const char* propertyName, ACS::TimeInterval time); 00072 00073 void suppress_archiving(const char* propertyName); 00074 00075 void enable_archiving(const char* propertyName); 00076 00077 private: 00078 00082 ACS::TimeInterval propertyArchivingInterval(ACS::PropertyDesc *); 00083 00085 std::vector<MonitorPointBase*> monitorPoints_m; 00087 ACS::CharacteristicComponent_var component_m; 00088 00090 MonitorDataBlock monitorDataBlock_m; 00091 00093 unsigned int seqIndex_m; 00094 00095 // we need container services for activate/deactivate callbacks for monitors 00096 maci::ContainerServices *containerServices_m; 00097 00099 ACS::CharacteristicComponentDesc_var compDesc_m; 00100 00102 CORBA::ULong numOfProp_m; 00103 00104 bool monitoring_m; 00105 00106 ACS::Time m_monitoringStartTime; 00107 00108 ACE_Thread_Mutex m_proMutex; 00109 00110 };//MonitorComponent 00111 00112 00113 00114 };//namespace TMCDB 00115 00116 00117 #endif