00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CWATCH_H
00020 #define __CWATCH_H
00021
00022 #include "cobject.h"
00023
00024
00025 class cWatch;
00026
00032
00059 #define WATCH(var) new cWatch( #var, var );
00060
00067 #define LWATCH(var) cWatch var##__varshell( #var, var );
00068
00069
00070
00071
00081
00082 class SIM_API cWatch : public cObject
00083 {
00084 private:
00085 void *ptr;
00086 char type;
00087
00088 public:
00091
00095 cWatch(const cWatch& vs);
00096
00100 cWatch(const char *name, char& c) : cObject(name) {ptr=&c; type='c';}
00101
00105 cWatch(const char *name, signed char& c) : cObject(name) {ptr=&c; type='c';}
00106
00110 cWatch(const char *name, unsigned char& c) : cObject(name) {ptr=&c; type='c';}
00111
00115 cWatch(const char *name, bool& b) : cObject(name) {ptr=&b; type='b';}
00116
00120 cWatch(const char *name, int& i) : cObject(name) {ptr=&i; type='i';}
00121
00125 cWatch(const char *name, unsigned int& i) : cObject(name) {ptr=&i; type='i';}
00126
00130 cWatch(const char *name, long& l) : cObject(name) {ptr=&l; type='l';}
00131
00135 cWatch(const char *name, unsigned long& l) : cObject(name) {ptr=&l; type='l';}
00136
00140 cWatch(const char *name, double& d): cObject(name) {ptr=&d; type='d';}
00141
00145 cWatch(const char *name, const char* &s) : cObject(name) {ptr=&s; type='s';}
00146
00150 cWatch(const char *name, const signed char* &s) : cObject(name) {ptr=&s; type='s';}
00151
00155 cWatch(const char *name, const unsigned char* &s) : cObject(name) {ptr=&s; type='s';}
00156
00160 cWatch(const char *name, const cObject* &o) : cObject(name) {ptr=&o; type='o';}
00161
00165 cWatch& operator=(const cWatch& vs) {ptr=vs.ptr;type=vs.type;return *this;}
00167
00170
00175 virtual cObject *dup() const {return new cWatch(*this);}
00176
00181 virtual std::string info() const;
00182
00187 virtual void writeContents(std::ostream& os);
00189
00192
00197 virtual void printTo(char *s) const;
00198
00204 char typeChar() const {return type;}
00205
00209 void *pointer() const {return ptr;}
00211 };
00212
00213 #endif
00214