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 class SIM_API cWatch : public cObject
00082 {
00083 private:
00084 void *ptr;
00085 char type;
00086
00087 public:
00090
00094 cWatch(const cWatch& vs);
00095
00099 cWatch(const char *name, char& c) : cObject(name) {ptr=&c; type='c';}
00100
00104 cWatch(const char *name, signed char& c) : cObject(name) {ptr=&c; type='c';}
00105
00109 cWatch(const char *name, unsigned char& c) : cObject(name) {ptr=&c; type='c';}
00110
00114 cWatch(const char *name, bool& b) : cObject(name) {ptr=&b; type='b';}
00115
00119 cWatch(const char *name, int& i) : cObject(name) {ptr=&i; type='i';}
00120
00124 cWatch(const char *name, unsigned int& i) : cObject(name) {ptr=&i; type='i';}
00125
00129 cWatch(const char *name, long& l) : cObject(name) {ptr=&l; type='l';}
00130
00134 cWatch(const char *name, unsigned long& l) : cObject(name) {ptr=&l; type='l';}
00135
00139 cWatch(const char *name, double& d): cObject(name) {ptr=&d; type='d';}
00140
00144 cWatch(const char *name, const char* &s) : cObject(name) {ptr=&s; type='s';}
00145
00149 cWatch(const char *name, const signed char* &s) : cObject(name) {ptr=&s; type='s';}
00150
00154 cWatch(const char *name, const unsigned char* &s) : cObject(name) {ptr=&s; type='s';}
00155
00159 cWatch(const char *name, const cObject* &o) : cObject(name) {ptr=&o; type='o';}
00160
00164 cWatch& operator=(const cWatch& vs) {ptr=vs.ptr;type=vs.type;return *this;}
00166
00169
00174 virtual cObject *dup() const {return new cWatch(*this);}
00175
00180 virtual void info(char *buf);
00181
00186 virtual void writeContents(ostream& os);
00188
00191
00196 virtual void printTo(char *s);
00197
00203 char typeChar() const {return type;}
00204
00208 void *pointer() const {return ptr;}
00210 };
00211
00212 #endif
00213