cboolparimpl.h Source File

API: cboolparimpl.h Source File
API
cboolparimpl.h
1//==========================================================================
2// CBOOLPARIMPL.H - part of
3// OMNeT++/OMNEST
4// Discrete System Simulation in C++
5//
6//==========================================================================
7
8/*--------------------------------------------------------------*
9 Copyright (C) 1992-2017 Andras Varga
10 Copyright (C) 2006-2017 OpenSim Ltd.
11
12 This file is distributed WITHOUT ANY WARRANTY. See the file
13 `license' for details on this and other legal matters.
14*--------------------------------------------------------------*/
15
16#ifndef __OMNETPP_CBOOLPARIMPL_H
17#define __OMNETPP_CBOOLPARIMPL_H
18
19#include "cparimpl.h"
20
21namespace omnetpp {
22namespace internal {
23
30class SIM_API cBoolParImpl : public cParImpl
31{
32 protected:
33 // selector: flags & FL_ISEXPR
34 union {
35 cExpression *expr;
36 bool val;
37 };
38
39 private:
40 void copy(const cBoolParImpl& other);
41
42 protected:
43 void deleteOld() {cParImpl::deleteOld(expr);}
44
45 public:
48
52 explicit cBoolParImpl();
53
57 cBoolParImpl(const cBoolParImpl& other) : cParImpl(other) {copy(other);}
58
62 virtual ~cBoolParImpl();
63
67 void operator=(const cBoolParImpl& otherpar);
69
72
76 virtual cBoolParImpl *dup() const override {return new cBoolParImpl(*this);}
78
81
85 virtual void setBoolValue(bool b) override;
86
90 virtual void setIntValue(intval_t l) override;
91
95 virtual void setDoubleValue(double d) override;
96
100 virtual void setStringValue(const char *s) override;
101
105 virtual void setObjectValue(cObject *object) override;
106
110 virtual void setXMLValue(cXMLElement *node) override;
111
116 virtual void setExpression(cExpression *e) override;
118
121
125 virtual bool boolValue(cComponent *context, const cPar *targetPar) const override;
126
130 virtual intval_t intValue(cComponent *context, const cPar *targetPar) const override;
131
135 virtual double doubleValue(cComponent *context, const cPar *targetPar) const override;
136
140 virtual const char *stringValue(cComponent *context, const cPar *targetPar) const override;
141
145 virtual std::string stdstringValue(cComponent *context, const cPar *targetPar) const override;
146
150 virtual cObject *objectValue(cComponent *context, const cPar *targetPar) const override;
151
155 virtual cXMLElement *xmlValue(cComponent *context, const cPar *targetPar) const override;
156
160 virtual cExpression *getExpression() const override;
162
165
169 virtual Type getType() const override;
170
174 virtual bool isNumeric() const override;
176
179
184 virtual void convertToConst(cComponent *context, const cPar *targetPar) override;
185
189 virtual std::string str() const override;
190
194 virtual std::string unparse() const override;
195
199 virtual void parse(const char *text, FileLine loc, const cPar *targetPar) override;
200
204 virtual int compare(const cParImpl *other) const override;
206};
207
208} // namespace internal
209} // namespace omnetpp
210
211#endif
212
213
Definition fileline.h:28
Common base for module and channel classes.
Definition ccomponent.h:51
Abstract base class for expression evaluators.
Definition cexpression.h:34
cObject()
Definition cobject.h:124
Represents a module or channel parameter.
Definition cpar.h:71
Represents an XML element in an XML configuration file.
Definition cxmlelement.h:76
virtual cXMLElement * xmlValue(cComponent *context, const cPar *targetPar) const override
virtual void setXMLValue(cXMLElement *node) override
virtual std::string stdstringValue(cComponent *context, const cPar *targetPar) const override
virtual bool boolValue(cComponent *context, const cPar *targetPar) const override
virtual cObject * objectValue(cComponent *context, const cPar *targetPar) const override
virtual void setDoubleValue(double d) override
virtual cBoolParImpl * dup() const override
Definition cboolparimpl.h:76
virtual void setIntValue(intval_t l) override
void operator=(const cBoolParImpl &otherpar)
virtual void parse(const char *text, FileLine loc, const cPar *targetPar) override
virtual std::string unparse() const override
virtual void setExpression(cExpression *e) override
virtual double doubleValue(cComponent *context, const cPar *targetPar) const override
virtual const char * stringValue(cComponent *context, const cPar *targetPar) const override
virtual void setStringValue(const char *s) override
virtual int compare(const cParImpl *other) const override
virtual void convertToConst(cComponent *context, const cPar *targetPar) override
virtual void setObjectValue(cObject *object) override
virtual std::string str() const override
virtual cExpression * getExpression() const override
virtual intval_t intValue(cComponent *context, const cPar *targetPar) const override
virtual void setBoolValue(bool b) override
cBoolParImpl(const cBoolParImpl &other)
Definition cboolparimpl.h:57
virtual Type getType() const override
virtual bool isNumeric() const override
int64_t intval_t
Signed integer type which is guaranteed to be at least 64 bits wide. It is used throughout the librar...
Definition simkerneldefs.h:101