Go to the documentation of this file.00001 #ifndef baciBACIProperty_H
00002 #define baciBACIProperty_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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 };
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
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 bool hasTriggerOnValuePercentMonitor() const { return triggerOnValuePercentMonitor_m; }
00161
00162 ACS::TimeInterval getPollInterval() const { return pollInterval_m; }
00163 ACS::TimeInterval getLastPollTime() const { return lastPollTime_m; }
00164 ACS::TimeInterval getMonMinTriggerTime() const { return monMinTriggerTime_m; }
00165 BACIValue getLastValue() const { return lastValue_m; }
00166
00167
00168 void setPollInterval(const ACS::TimeInterval& _pollInterval) { pollInterval_m=_pollInterval; }
00169 void setLastPollTime(const ACS::TimeInterval& _lastPollTime) { lastPollTime_m=_lastPollTime; }
00170 void setMonMinTriggerTime(const ACS::TimeInterval& _interval) { monMinTriggerTime_m=_interval; }
00171 void setLastValue(const BACIValue& _lastValue) {lastValue_m=_lastValue;}
00172
00173
00174 void dispatchMonitors(Completion& completion, CBDescOut& descOut);
00175 void updateMonitorStates();
00176
00177 bool isInDestructionState() const { return inDestructionState_m; };
00178
00179 protected:
00180
00181 void addMonitor(BACIMonitor* monitor);
00182 void removeMonitor(BACIMonitor* monitor);
00183
00184 ACS::TimeInterval GCD(ACS::TimeInterval t1, ACS::TimeInterval t2);
00185
00186
00187 private:
00188 ACE_CString name_m;
00189
00190 PropertyImplementator* propertyImplementator_mp;
00191 CharacteristicModelImpl* characteristicModel_mp;
00192
00193 BACIValue lastValue_m;
00194
00195 BACIComponent* component_mp;
00196
00197 BACIMonitorVector monitorVector_m;
00198
00199 bool triggerOnValueMonitor_m;
00200 bool triggerOnValuePercentMonitor_m;
00201 ACS::TimeInterval pollInterval_m;
00202 ACS::TimeInterval lastPollTime_m;
00203 ACS::TimeInterval monMinTriggerTime_m;
00204
00205
00206 BACIMonitor* archiver_mp;
00207
00208 BACIValue::Type type_m;
00209
00210 bool inDestructionState_m;
00211
00212 BACIMutex monitorVectorMutex_m;
00213
00214 friend class BACIComponent;
00215 friend class BACIMonitor;
00216
00220 void operator=(const BACIProperty&);
00221
00225 BACIProperty(const BACIProperty&);
00226
00227 };
00228
00232 typedef std::vector<BACIProperty*> BACIPropertyVector;
00233
00234
00235
00236
00237 };
00238
00239 #endif
00240
00241