00001 #ifndef MD_STATE 00002 #define MD_STATE 00003 00010 typedef struct { 00011 bool bitValue; 00012 double realValue; 00013 int intValue; 00014 bool hasSource; 00015 bool realtime; // if true data layer can update 00016 char referenceType; // uses XMLRPC-C signature conventions 00017 unsigned short sValSize; 00018 char sVal; 00019 } 00020 mdODEPOD; 00021 00022 class mdOperationalDataElement { 00023 time_t datetimeValue; 00024 public: 00025 mdODEPOD *ode; 00026 void *mand; 00027 std::string stringValue; 00028 00029 void set(int value) {ode->intValue = value;} 00030 void set(std::string value) {stringValue = value;} 00031 void set(double value) {ode->realValue = value;} 00032 void set(bool value) {ode->bitValue = value;} 00033 void set(time_t value) {datetimeValue = value;} 00034 int getInt() {return ode->intValue;} 00035 double getReal() {return ode->realValue;} 00036 std::string getString() {return stringValue;} 00037 bool getBit() {return ode->bitValue;} 00038 time_t getTime() {return datetimeValue;} 00039 00040 #ifdef MD_MAND 00041 DACLIPS::Fact *fact; 00042 #endif 00043 00044 unsigned short pack(char *framePtr); 00045 #ifndef INCLDV 00046 void source(mdResponse *mdr); 00047 #endif 00048 void unpack(char **framePtr); 00049 00050 mdOperationalDataElement(); 00051 mdOperationalDataElement(mdODEPOD *shared); 00052 ~mdOperationalDataElement() {} 00053 }; 00054 00055 typedef std::map<std::string, mdOperationalDataElement> ODEsByName; 00056 00057 class mdState { 00058 public: 00059 00060 int deviceType; 00061 00062 mdOperationalDataElement deviceODE; 00063 mdObservable deviceObservation; 00064 00065 mdState() {observables[std::string("device")] = deviceObservation; 00066 localODEs[std::string("_device")] = deviceODE; 00067 } 00068 00069 ~mdState() {} 00070 std::string create(int deviceHandle,std::string& sigNComment,std::string &dataName); 00071 00072 #ifdef XMLRPC_C 00073 xmlrpc_c::value * get(int deviceHandle,std::string &dataName); 00074 std::string set(int deviceHandle,xmlrpc_c::cstruct &inbound); 00075 void registerData(const char *dataName,const mdIncoming &thisOne); 00076 #endif 00077 00078 ObservablesByName observables; 00079 ODEsByName localODEs; 00080 00081 }; 00082 00083 #endif
1.5.6