cintparimpl.h Source File

API: cintparimpl.h Source File
API
cintparimpl.h
1//==========================================================================
2// CINTPARIMPL.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_CINTPARIMPL_H
17#define __OMNETPP_CINTPARIMPL_H
18
19#include "cparimpl.h"
20
21namespace omnetpp {
22namespace internal {
23
29class SIM_API cIntParImpl : public cParImpl
30{
31 protected:
32 // selector: flags & FL_ISEXPR
33 union {
34 cExpression *expr;
35 intval_t val;
36 };
37
38 private:
39 void copy(const cIntParImpl& other);
40
41 protected:
42 void deleteOld() {cParImpl::deleteOld(expr);}
43
44 public:
47
51 explicit cIntParImpl();
52
56 cIntParImpl(const cIntParImpl& other) : cParImpl(other) {copy(other);}
57
61 virtual ~cIntParImpl();
62
66 void operator=(const cIntParImpl& otherpar);
68
71
75 virtual cIntParImpl *dup() const override {return new cIntParImpl(*this);}
77
80
84 virtual void setBoolValue(bool b) override;
85
89 virtual void setIntValue(intval_t l) override;
90
94 virtual void setDoubleValue(double d) override;
95
99 virtual void setStringValue(const char *s) override;
100
104 virtual void setObjectValue(cObject *object) override;
105
109 virtual void setXMLValue(cXMLElement *node) override;
110
115 virtual void setExpression(cExpression *e) override;
117
120
124 virtual bool boolValue(cComponent *context, const cPar *targetPar) const override;
125
129 virtual intval_t intValue(cComponent *context, const cPar *targetPar) const override;
130
134 virtual double doubleValue(cComponent *context, const cPar *targetPar) const override;
135
139 virtual const char *stringValue(cComponent *context, const cPar *targetPar) const override;
140
144 virtual std::string stdstringValue(cComponent *context, const cPar *targetPar) const override;
145
149 virtual cObject *objectValue(cComponent *context, const cPar *targetPar) const override;
150
154 virtual cXMLElement *xmlValue(cComponent *context, const cPar *targetPar) const override;
155
159 virtual cExpression *getExpression() const override;
161
164
168 virtual Type getType() const override;
169
173 virtual bool isNumeric() const override;
175
178
183 virtual void convertToConst(cComponent *context, const cPar *targetPar) override;
184
188 virtual std::string str() const override;
189
193 virtual std::string unparse() const override;
194
198 virtual void parse(const char *text, FileLine loc, const cPar *targetPar) override;
199
203 virtual int compare(const cParImpl *other) const override;
205};
206
207} // namespace internal
208} // namespace omnetpp
209
210#endif
211
212
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
void operator=(const cIntParImpl &otherpar)
virtual bool boolValue(cComponent *context, const cPar *targetPar) const override
virtual cIntParImpl * dup() const override
Definition cintparimpl.h:75
virtual cObject * objectValue(cComponent *context, const cPar *targetPar) const override
virtual void setDoubleValue(double d) override
virtual void setIntValue(intval_t l) override
virtual void parse(const char *text, FileLine loc, const cPar *targetPar) override
virtual std::string unparse() const override
cIntParImpl(const cIntParImpl &other)
Definition cintparimpl.h:56
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
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