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
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
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
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
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 };
00226
00230 typedef std::vector<BACIProperty*>
BACIPropertyVector;
00231
00232
00233
00234
00235 };
00236
00237
#endif
00238
00239