00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CWATCH_H
00022 #define __CWATCH_H
00023
00024 #include "cobject.h"
00025
00026
00027 class cWatch;
00028
00034
00061 #define WATCH(var) new cWatch( #var, var );
00062
00069 #define LWATCH(var) cWatch var##__varshell( #var, var );
00070
00071
00072
00073
00083 class SIM_API cWatch : public cObject
00084 {
00085 private:
00086 void *ptr;
00087 char type;
00088
00089 public:
00092
00096 cWatch(const cWatch& vs);
00097
00101 cWatch(const char *name, char& c) : cObject(name) {ptr=&c; type='c';}
00102
00106 cWatch(const char *name, signed char& c) : cObject(name) {ptr=&c; type='c';}
00107
00111 cWatch(const char *name, unsigned char& c) : cObject(name) {ptr=&c; type='c';}
00112
00116 cWatch(const char *name, int& i) : cObject(name) {ptr=&i; type='i';}
00117
00121 cWatch(const char *name, unsigned int& i) : cObject(name) {ptr=&i; type='i';}
00122
00126 cWatch(const char *name, long& l) : cObject(name) {ptr=&l; type='l';}
00127
00131 cWatch(const char *name, unsigned long& l) : cObject(name) {ptr=&l; type='l';}
00132
00136 cWatch(const char *name, double& d): cObject(name) {ptr=&d; type='d';}
00137
00141 cWatch(const char *name, char* &s) : cObject(name) {ptr=&s; type='s';}
00142
00146 cWatch(const char *name, signed char* &s) : cObject(name) {ptr=&s; type='s';}
00147
00151 cWatch(const char *name, unsigned char* &s) : cObject(name) {ptr=&s; type='s';}
00152
00156 cWatch(const char *name, const cObject* &o) : cObject(name) {ptr=&o; type='o';}
00157
00161 cWatch& operator=(const cWatch& vs) {ptr=vs.ptr;type=vs.type;return *this;}
00163
00166
00170 virtual const char *className() const {return "cWatch";}
00171
00176 virtual cObject *dup() const {return new cWatch(*this);}
00177
00182 virtual void info(char *buf);
00183
00188 virtual const char *inspectorFactoryName() const {return "cWatchIFC";}
00189
00194 virtual void writeContents(ostream& os);
00196
00199
00204 virtual void printTo(char *s);
00205
00211 char typeChar() const {return type;}
00212
00216 void *pointer() const {return ptr;}
00218 };
00219
00220 #endif
00221