Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

baciBACIMonitor.h

Go to the documentation of this file.
00001 #ifndef baciBACIMonitor_H 00002 #define baciBACIMonitor_H 00003 00004 /******************************************************************* 00005 * ALMA - Atacama Large Millimiter Array 00006 * (c) European Southern Observatory, 2003 00007 * 00008 *This library is free software; you can redistribute it and/or 00009 *modify it under the terms of the GNU Lesser General Public 00010 *License as published by the Free Software Foundation; either 00011 *version 2.1 of the License, or (at your option) any later version. 00012 * 00013 *This library is distributed in the hope that it will be useful, 00014 *but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 *Lesser General Public License for more details. 00017 * 00018 *You should have received a copy of the GNU Lesser General Public 00019 *License along with this library; if not, write to the Free Software 00020 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 * "@(#) $Id: baciBACIMonitor.h,v 1.5 2007/06/12 08:02:23 nbarriga Exp $" 00023 * 00024 * who when what 00025 * -------- -------- ---------------------------------------------- 00026 * dfugate 2005-01-17 created 00027 */ 00028 00034 #ifndef __cplusplus 00035 #error This is a C++ include file and cannot be used from plain C 00036 #endif 00037 00038 #include "baciExport.h" 00039 #include "acsutilTimeStamp.h" 00040 #include <acscommonC.h> 00041 #include "baciValue.h" 00042 #include "logging.h" 00043 #include <vector> 00044 00045 namespace baci { 00046 00047 00048 00049 // forwards 00050 class BACIProperty; 00051 00052 /* ------------------------------------------------------------------------ */ 00053 00060 class baci_EXPORT MonitorImplementator 00061 { 00062 public: 00063 00070 virtual int initialization() { return 0; } 00071 00077 virtual void monitorDestroyed(void) = 0; 00078 00083 virtual void monitorStateChanged(void) = 0; 00084 00085 virtual ~MonitorImplementator() {} 00086 00087 }; /* MonitorImplementator */ 00088 00089 /* ------------------------------------------------------------------------ */ 00090 00099 class baci_EXPORT BACIMonitor 00100 { 00101 00102 public: 00103 00127 enum UpdateMode { mumNull=0, 00128 mumLast=1, 00129 mumTrunc=2 }; 00130 00134 BACIMonitor(const ACE_CString& _name, int _callbackID, 00135 MonitorImplementator* monitorImplementator_p, 00136 const ACS::TimeInterval& _triggerTime, const BACIValue& _triggerValue, 00137 const ACS::TimeInterval& _minTriggerTime, const BACIValue& _minTriggerValue, 00138 BACIProperty* _property, 00139 const ACS::TimeInterval& _transmitTime=0, 00140 const UpdateMode& _updateMode=mumLast, 00141 const bool _achivingMonitor=false, 00142 const bool _suspended=false, 00143 const bool _deltaValueAndTimerInteraction=false, // delta trigger reset timer and interval is greather than minTriggerTime 00144 const unsigned int _priority=3); // archiver default priority 00145 00147 void destroy(); 00148 00149 void suspend(); 00150 void resume(); 00151 void setLastTime(const ACS::TimeInterval& _lastTime); 00152 void setTriggerValue(const BACIValue& _triggerValue); 00153 void setMinTriggerValue(const BACIValue& _minTriggerValue); 00154 void setLastValue(const BACIValue& _lastValue); 00155 void setTriggerOnValue(bool enable); 00156 00157 /* ---- */ 00158 00159 const char * getName() const { return name_m.c_str(); } 00160 bool isSuspended() const { return suspended_m; } 00161 00162 BACIMonitor& operator=(const BACIMonitor& mon) 00163 { 00164 if (this!=&mon) 00165 { 00166 name_m=mon.name_m; 00167 callbackID_m=mon.callbackID_m; 00168 triggerTime_m=mon.triggerTime_m; 00169 transmitTime_m=mon.transmitTime_m; 00170 lastTime_m=mon.lastTime_m; 00171 triggerValue_m=mon.triggerValue_m; 00172 lastValue_m=mon.lastValue_m; 00173 triggerOnValue_m=mon.triggerOnValue_m; 00174 property_mp=mon.property_mp; 00175 suspended_m=mon.suspended_m; 00176 archivingMonitor_m=mon.archivingMonitor_m; 00177 updateMode_m=mon.updateMode_m; 00178 00179 monitorImplementator_mp = mon.monitorImplementator_mp; 00180 minTriggerTime_m = mon.minTriggerTime_m; 00181 userControlledTransmitTime_m = mon.userControlledTransmitTime_m; 00182 minTriggerValue_m = mon.minTriggerValue_m; 00183 deltaValueAndTimerInteraction_m = mon.deltaValueAndTimerInteraction_m; 00184 priority_m = mon.priority_m; 00185 inDestructionState_m = mon.inDestructionState_m; 00186 destroyed_m = mon.destroyed_m; 00187 } 00188 return *this; 00189 } 00190 00191 bool operator==(const BACIMonitor& mon) const { return callbackID_m==mon.callbackID_m; } 00192 00193 UpdateMode getUpdateMode() const { return updateMode_m; } 00194 int getCallbackID() const { return callbackID_m; } 00195 ACS::TimeInterval getTriggerTime() const { return triggerTime_m; } 00196 ACS::TimeInterval getMinTriggerTime() const { return minTriggerTime_m; } 00197 ACS::TimeInterval getLastTime() const { return lastTime_m; } 00198 ACS::TimeInterval getTransmitTime() const { return transmitTime_m; } 00199 BACIValue getTriggerValue() const { return triggerValue_m; } 00200 BACIValue getMinTriggerValue() const { return minTriggerValue_m; } 00201 BACIValue getLastValue() const { return lastValue_m; } 00202 bool getTriggerOnValue() const { return triggerOnValue_m; } 00203 00204 void setUpdateMode(const UpdateMode& _updateMode); 00205 void setTriggerTime(const ACS::TimeInterval& _triggerTime); 00206 void setMinTriggerTime(const ACS::TimeInterval& _minTriggerTime); 00207 00208 void setTransmitTime(const ACS::TimeInterval& _transmitTime) 00209 { 00210 transmitTime_m = _transmitTime; 00211 } 00212 00216 void monitorStateChanged() 00217 { 00218 ACS_TRACE("baci::BACIMonitor::monitorStateChanged"); 00219 if (monitorImplementator_mp!=0) 00220 { 00221 monitorImplementator_mp->monitorStateChanged(); 00222 } 00223 } 00224 00225 MonitorImplementator* getMonitorImplementator() const { return monitorImplementator_mp; } 00226 BACIProperty* getProperty() const { return property_mp; } 00227 00228 bool isInDestructionState() const { return inDestructionState_m; }; 00229 00230 bool isArchivingMonitor() const { return archivingMonitor_m; }; 00231 00232 bool isDeltaValueAndTimerInteraction() const { return deltaValueAndTimerInteraction_m; }; 00233 00234 unsigned int getPriority() const { return priority_m; }; 00235 00236 private: 00237 00243 ~BACIMonitor(); 00244 00245 void internalDestroy(); 00246 00247 00248 ACE_CString name_m; 00249 int callbackID_m; 00250 00251 MonitorImplementator* monitorImplementator_mp; 00252 00253 UpdateMode updateMode_m; 00254 00255 ACS::TimeInterval triggerTime_m; 00256 ACS::TimeInterval minTriggerTime_m; 00257 ACS::TimeInterval transmitTime_m; 00258 bool userControlledTransmitTime_m; 00259 ACS::TimeInterval lastTime_m; 00260 00261 BACIValue triggerValue_m; 00262 BACIValue minTriggerValue_m; 00263 BACIValue lastValue_m; 00264 bool triggerOnValue_m; 00265 00266 BACIProperty* property_mp; 00267 00268 bool archivingMonitor_m; 00269 00270 bool suspended_m; 00271 00272 bool deltaValueAndTimerInteraction_m; 00273 00274 unsigned int priority_m; 00275 00276 bool inDestructionState_m; 00277 00278 bool destroyed_m; 00279 00280 friend class BACIProperty; 00281 00282 }; /* BACIMonitor */ 00283 00287 typedef std::vector<BACIMonitor*> BACIMonitorVector; 00288 /* ------------------------------------------------------------------------ */ 00289 00290 }; 00291 00292 #endif /* baci_H */ 00293 00294

Generated on Thu Apr 30 02:30:50 2009 for ACS C++ API by doxygen 1.3.8