00001 #ifndef MD_OBSERVABLES 00002 #define MD_OBSERVABLES 00003 00004 class mdResponse; 00005 00006 using namespace boost::gregorian; 00007 using namespace boost::posix_time; 00008 00009 class observable_time : time_period { 00010 00011 public: 00012 ptime instantiated; // Time the observable was created as an object. 00013 time_duration duration1; // e.g. inner bound for an interval 00014 time_duration duration2; // "" outer "" "" 00015 ptime event1; // e.g. start of an interval 00016 ptime event2; // "" end "" "" 00017 00018 observable_time(date d) : time_period(ptime(d),ptime(d,microseconds(1000))) 00019 { 00020 instantiated = second_clock::local_time(); 00021 } 00022 00023 void setEventTolerance(); 00024 void setEventStart(); 00025 void setEventEnd(); 00026 00027 }; 00028 00029 typedef struct { 00030 char focusType; // i, d, or s 00031 md_units units; 00032 bool hasBounds; 00033 bool hasSource; 00034 bool isPrivate; // true -> only owning device can access 00035 bool realtime; // if true datalayer can update this 00036 bool outOfLimits; 00037 double rValue; 00038 double rValueTarget; 00039 double rValueHigh; 00040 double rValueLow; 00041 int intValue; 00042 int intValueTarget; 00043 int intValueLow; 00044 int intValueHigh; 00045 unsigned short sValSize; 00046 char sVal; 00047 } mdObsPOD; 00048 00058 class mdObservable { 00059 time_t lastChange; 00060 observable_time ot(date()); 00061 bool _shared; 00062 public: 00063 mdObsPOD *obs; 00064 void *mand; 00065 std::string sValue; 00066 00067 mdObservable(); 00068 mdObservable(mdObsPOD *sharedMem); 00069 ~mdObservable() {} 00070 std::string create(int deviceHandle,std::string& sig,std::string& dataname); 00071 unsigned short pack(char *framePrt); 00072 #ifndef INCLDV 00073 void source(mdResponse *mdr); 00074 #endif 00075 void unpack(char **framePtr); 00076 #ifdef XMLRPC_C 00077 xmlrpc_c::value *shipIt(xmlrpc_c::cstruct outbound,std::string name); 00078 std::string setWith(xmlrpc_c::cstruct incoming); 00079 #endif 00080 00081 }; 00082 00083 typedef std::map<std::string,mdObservable> ObservablesByName; 00084 00085 #endif
1.5.6