16 #ifndef __OMNETPP_CWATCH_H 17 #define __OMNETPP_CWATCH_H 21 #include "cownedobject.h" 49 virtual bool supportsAssignment()
const = 0;
55 virtual void assign(
const char *s) {}
73 virtual std::string
str()
const override 75 std::stringstream out;
96 virtual std::string
str()
const override 98 std::stringstream out;
102 virtual void assign(
const char *s)
override 104 std::stringstream in(s);
121 virtual std::string
str()
const override 123 return r ?
"true" :
"false";
125 virtual void assign(
const char *s)
override 127 r = *s!=
'0' && *s!=
'n' && *s!=
'N' && *s!=
'f' && *s!=
'F';
143 virtual std::string
str()
const override 145 std::stringstream out;
146 out <<
"'" << ((
unsigned char)r<32 ?
' ' : r) <<
"' (" << int(r) <<
")";
149 virtual void assign(
const char *s)
override 168 virtual const char *
getClassName()
const override {
return "unsigned char";}
170 virtual std::string
str()
const override 172 std::stringstream out;
173 out <<
"'" << (char)(r<
' ' ?
' ' : r) <<
"' (" << int(r) <<
")";
176 virtual void assign(
const char *s)
override 195 virtual const char *
getClassName()
const override {
return "std::string";}
197 virtual std::string str()
const override;
198 virtual void assign(
const char *s)
override;
212 virtual std::string
str()
const override {
return r.
str();}
214 virtual cClassDescriptor *getDescriptor()
const override {
return r.getDescriptor();}
228 virtual std::string
str()
const override {
return rp ? rp->
str() :
"<null>";}
230 virtual cClassDescriptor *getDescriptor()
const override {
return rp ? rp->getDescriptor() :
nullptr;}
234 inline cWatchBase *createWatch(
const char *varname,
short& d) {
238 inline cWatchBase *createWatch(
const char *varname,
unsigned short& d) {
242 inline cWatchBase *createWatch(
const char *varname,
int& d) {
246 inline cWatchBase *createWatch(
const char *varname,
unsigned int& d) {
250 inline cWatchBase *createWatch(
const char *varname,
long& d) {
254 inline cWatchBase *createWatch(
const char *varname,
unsigned long& d) {
258 inline cWatchBase *createWatch(
const char *varname,
float& d) {
262 inline cWatchBase *createWatch(
const char *varname,
double& d) {
266 inline cWatchBase *createWatch(
const char *varname,
bool& d) {
270 inline cWatchBase *createWatch(
const char *varname,
char& d) {
274 inline cWatchBase *createWatch(
const char *varname,
unsigned char& d) {
278 inline cWatchBase *createWatch(
const char *varname,
signed char& d) {
282 inline cWatchBase *createWatch(
const char *varname, std::string& v) {
288 inline cWatchBase *createWatch(
const char *varname, T& d) {
294 inline cWatchBase *createWatch_genericAssignable(
const char *varname, T& d) {
326 #define WATCH(variable) omnetpp::createWatch(#variable,(variable)) 334 #define WATCH_RW(variable) omnetpp::createWatch_genericAssignable(#variable,(variable)) 342 #define WATCH_OBJ(variable) omnetpp::createWatch_cObject(#variable,(variable)) 350 #define WATCH_PTR(variable) omnetpp::createWatch_cObjectPtr(#variable,(cObject*&)(variable),(variable)) virtual const char * getClassName() const override
Definition: cwatch.h:227
Watch class, specifically for bool.
Definition: cwatch.h:113
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
Watch class, specifically for pointers to objects subclassed from cObject.
Definition: cwatch.h:221
virtual std::string str() const override
Definition: cwatch.h:170
virtual bool supportsAssignment() const override
Definition: cwatch.h:95
cWatchBase(const char *name)
Definition: cwatch.h:41
virtual std::string str() const override
Definition: cwatch.h:212
Watch class, specifically for std::string.
Definition: cwatch.h:189
Helper class to make primitive types and non-cOwnedObject objects inspectable in Tkenv/Qtenv. To be used only via the WATCH, WATCH_PTR, WATCH_OBJ, WATCH_VECTOR etc macros.
Definition: cwatch.h:33
Watch class, specifically for char.
Definition: cwatch.h:135
virtual const char * getClassName() const override
Definition: cwatch.h:195
virtual void assign(const char *s) override
Definition: cwatch.h:176
virtual bool supportsAssignment() const override
Definition: cwatch.h:120
virtual void assign(const char *s) override
Definition: cwatch.h:125
virtual const char * getClassName() const override
Definition: cwatch.h:168
Template Watch class, for any type that supports operator<<, and operator>> for assignment.
Definition: cwatch.h:88
virtual std::string str() const override
Definition: cwatch.h:228
Watch class, specifically for unsigned char.
Definition: cwatch.h:162
virtual const char * getClassName() const override
Definition: cwatch.h:71
virtual bool supportsAssignment() const override
Definition: cwatch.h:213
virtual std::string str() const override
Definition: cwatch.h:143
virtual bool supportsAssignment() const override
Definition: cwatch.h:169
virtual const char * getClassName() const override
Definition: cwatch.h:119
virtual bool supportsAssignment() const override
Definition: cwatch.h:196
virtual std::string str() const override
Definition: cwatch.h:121
virtual bool supportsAssignment() const override
Definition: cwatch.h:229
virtual bool supportsAssignment() const override
Definition: cwatch.h:72
Template Watch class, for any type that supports operator<<.
Definition: cwatch.h:65
virtual void assign(const char *s)
Definition: cwatch.h:55
Watch class, specifically for objects subclassed from cObject.
Definition: cwatch.h:205
virtual const char * getClassName() const override
Definition: cwatch.h:141
virtual std::string str() const
virtual std::string str() const override
Definition: cwatch.h:96
Definition: cabstracthistogram.h:21
virtual std::string str() const override
Definition: cwatch.h:73
virtual const char * getClassName() const override
Definition: cwatch.h:94
virtual void assign(const char *s) override
Definition: cwatch.h:102
Abstract base class for structure description classes, used mainly with message subclassing.
Definition: cclassdescriptor.h:44
Base class for cOwnedObject-based classes that do not wish to support assignment and duplication...
Definition: cownedobject.h:248
virtual const char * getClassName() const override
Definition: cwatch.h:211
virtual void assign(const char *s) override
Definition: cwatch.h:149
virtual bool supportsAssignment() const override
Definition: cwatch.h:142
SIM_API const char * opp_typename(const std::type_info &t)
Returns the name of a C++ type, correcting the quirks of various compilers.
virtual const char * getClassName() const