cobjectparimpl.h Source File

API: cobjectparimpl.h Source File
API
cobjectparimpl.h
1//==========================================================================
2// COBJECTPARIMPL.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_COBJECTPARIMPL_H
17#define __OMNETPP_COBJECTPARIMPL_H
18
19#include "cparimpl.h"
20
21namespace omnetpp {
22
23class cTemporaryOwner;
24
25namespace internal {
26
40class SIM_API cObjectParImpl : public cParImpl
41{
42 protected:
43 // selector: flags & FL_ISEXPR
44 cExpression *expr = nullptr;
45 mutable cObject *obj = nullptr; // stores the result of the last evaluation
46 opp_staticpooledstring expectedType; // value of the "@class" property, or ""
47
48 private:
49 void copy(const cObjectParImpl& other);
50
51 protected:
52 void deleteOld();
53 void deleteObject();
54 virtual void doSetObject(cObject *object);
55 virtual void checkType(cObject *object) const;
56 virtual void checkOwnership(cObject *obj, cTemporaryOwner& tmp) const;
57
58 public:
61
65 explicit cObjectParImpl() {}
66
70 cObjectParImpl(const cObjectParImpl& other) : cParImpl(other) {copy(other);}
71
75 virtual ~cObjectParImpl();
76
80 void operator=(const cObjectParImpl& otherpar);
82
85
89 virtual cObjectParImpl *dup() const override {return new cObjectParImpl(*this);}
91
94
98 virtual void setBoolValue(bool b) override;
99
103 virtual void setIntValue(intval_t l) override;
104
108 virtual void setDoubleValue(double d) override;
109
113 virtual void setStringValue(const char *s) override;
114
118 virtual void setObjectValue(cObject *object) override;
119
123 virtual void setXMLValue(cXMLElement *node) override;
124
129 virtual void setExpression(cExpression *e) override;
131
134
138 virtual bool boolValue(cComponent *context, const cPar *targetPar) const override;
139
143 virtual intval_t intValue(cComponent *context, const cPar *targetPar) const override;
144
148 virtual double doubleValue(cComponent *context, const cPar *targetPar) const override;
149
153 virtual const char *stringValue(cComponent *context, const cPar *targetPar) const override;
154
158 virtual std::string stdstringValue(cComponent *context, const cPar *targetPar) const override;
159
163 virtual cObject *objectValue(cComponent *context, const cPar *targetPar) const override;
164
168 virtual cXMLElement *xmlValue(cComponent *context, const cPar *targetPar) const override;
169
173 virtual cExpression *getExpression() const override;
175
178
182 virtual Type getType() const override;
183
187 virtual bool isNumeric() const override;
188
192 virtual void setExpectedType(const char *s);
194
197
201 virtual void convertToConst(cComponent *context, const cPar *targetPar) override;
202
206 virtual std::string str() const override;
207
211 virtual std::string unparse() const override;
212
216 virtual void parse(const char *text, FileLine loc, const cPar *targetPar) override;
217
221 virtual int compare(const cParImpl *other) const override;
222
226 virtual void forEachChild(cVisitor *v, cComponent *context) override;
228};
229
230} // namespace internal
231} // namespace omnetpp
232
233#endif
234
235
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
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition cvisitor.h:57
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 cObjectParImpl &otherpar)
virtual cObjectParImpl * dup() const override
Definition cobjectparimpl.h:89
virtual bool boolValue(cComponent *context, const cPar *targetPar) const override
virtual cObject * objectValue(cComponent *context, const cPar *targetPar) const override
virtual void setExpectedType(const char *s)
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
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 forEachChild(cVisitor *v, cComponent *context) override
virtual void setStringValue(const char *s) override
virtual int compare(const cParImpl *other) const override
cObjectParImpl(const cObjectParImpl &other)
Definition cobjectparimpl.h:70
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
cObjectParImpl()
Definition cobjectparimpl.h:65
Definition opp_pooledstring.h:30
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