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

baciBACIProperty.h

Go to the documentation of this file.
00001 #ifndef baciBACIProperty_H 00002 #define baciBACIProperty_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: baciBACIProperty.h,v 1.7 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 "baciThread.h" 00040 #include "baciValue.h" 00041 #include "logging.h" 00042 #include "baciBACIMonitor.h" 00043 #include "baciCharacteristicModelImpl.h" 00044 00045 #include <vector> 00046 00047 namespace baci { 00048 00049 00050 class BACIComponent; 00051 class BACIProperty; 00052 00053 /* ------------------------------------------------------------------------ */ 00054 00061 class baci_EXPORT PropertyImplementator 00062 { 00063 public: 00064 00072 virtual void getValue(BACIProperty* property, 00073 BACIValue* value, 00074 Completion &completion, 00075 CBDescOut& descOut) = 0; 00076 00083 virtual int initialization() { return 0; } 00084 00086 virtual ~PropertyImplementator() {} 00087 00088 }; /* PropertyImplementator */ 00089 00090 /* ------------------------------------------------------------------------ */ 00091 00092 00093 00100 class baci_EXPORT BACIProperty 00101 { 00102 00103 public: 00104 00113 BACIProperty(const ACE_CString& name_, 00114 PropertyImplementator* propertyImplementator_, 00115 CharacteristicModelImpl *characteristicModel_, 00116 const BACIValue& defaultValue_, 00117 BACIComponent* component_p); 00118 00122 ~BACIProperty(); 00123 00124 /* ---- */ 00125 00126 // ACE_CString getName() const { return name; } 00127 const char * getName() const { return name_m.c_str(); } 00128 00129 BACIValue::Type getType() const { return type_m; } 00130 00131 PropertyImplementator* getPropertyImplementator() const { return propertyImplementator_mp; } 00132 00133 CharacteristicModelImpl* getCharacteristicModel() const { return characteristicModel_mp; }; 00134 00142 void getValue(BACIProperty* property, 00143 BACIValue* value, 00144 Completion &completion, 00145 CBDescOut& descOut) 00146 { 00147 if (propertyImplementator_mp!=0) 00148 propertyImplementator_mp->getValue(property, 00149 value, 00150 completion, 00151 descOut); 00152 } 00153 00154 BACIComponent* getComponent() const { return component_mp; } 00155 00156 int getMonitorCount() const { return monitorVector_m.size(); } 00157 BACIMonitor* getMonitorAt(int pos) const { return monitorVector_m[pos]; } 00158 00159 bool hasTriggerOnValueMonitor() const { return triggerOnValueMonitor_m; } 00160 00161 ACS::TimeInterval getPollInterval() const { return pollInterval_m; } 00162 ACS::TimeInterval getLastPollTime() const { return lastPollTime_m; } 00163 ACS::TimeInterval getMonMinTriggerTime() const { return monMinTriggerTime_m; } 00164 BACIValue getLastValue() const { return lastValue_m; } 00165 //Completion getLastCompletion() const { return lastCompletion; } 00166 00167 void setPollInterval(const ACS::TimeInterval& _pollInterval) { pollInterval_m=_pollInterval; } 00168 void setLastPollTime(const ACS::TimeInterval& _lastPollTime) { lastPollTime_m=_lastPollTime; } 00169 void setMonMinTriggerTime(const ACS::TimeInterval& _interval) { monMinTriggerTime_m=_interval; } 00170 void setLastValue(const BACIValue& _lastValue) {lastValue_m=_lastValue;} 00171 //void setLastCompletion(const Completion& _lastCompletion) { lastCompletion=_lastCompletion;} 00172 00173 void dispatchMonitors(Completion& completion, CBDescOut& descOut); 00174 void updateMonitorStates(); 00175 00176 bool isInDestructionState() const { return inDestructionState_m; }; 00177 00178 protected: 00179 00180 void addMonitor(BACIMonitor* monitor); 00181 void removeMonitor(BACIMonitor* monitor); 00182 00183 ACS::TimeInterval GCD(ACS::TimeInterval t1, ACS::TimeInterval t2); 00184 00185 00186 private: 00187 ACE_CString name_m; 00188 00189 PropertyImplementator* propertyImplementator_mp; 00190 CharacteristicModelImpl* characteristicModel_mp; 00191 00192 BACIValue lastValue_m; 00193 00194 BACIComponent* component_mp; 00195 00196 BACIMonitorVector monitorVector_m; 00197 00198 bool triggerOnValueMonitor_m; 00199 ACS::TimeInterval pollInterval_m; 00200 ACS::TimeInterval lastPollTime_m; 00201 ACS::TimeInterval monMinTriggerTime_m; 00202 // Completion lastCompletion; 00203 00204 BACIMonitor* archiver_mp; 00205 00206 BACIValue::Type type_m; 00207 00208 bool inDestructionState_m; 00209 00210 BACIMutex monitorVectorMutex_m; 00211 00212 friend class BACIComponent; 00213 friend class BACIMonitor; 00214 00218 void operator=(const BACIProperty&); 00219 00223 BACIProperty(const BACIProperty&); 00224 00225 }; /* BACIProperty */ 00226 00230 typedef std::vector<BACIProperty*> BACIPropertyVector; 00231 00232 00233 /* ------------------------------------------------------------------------ */ 00234 00235 }; 00236 00237 #endif /* baci_H */ 00238 00239

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