OMNeT++ Simulation Library  5.6.1
cxmlparimpl.h
1 //==========================================================================
2 // CXMLPARIMPL.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_CXMLPARIMPL_H
17 #define __OMNETPP_CXMLPARIMPL_H
18 
19 #include "cparimpl.h"
20 
21 namespace omnetpp {
22 
28 class SIM_API cXMLParImpl : public cParImpl
29 {
30  protected:
31  // selector: flags & FL_ISEXPR
32  cExpression *expr;
33  cXMLElement *val;
34 
35  private:
36  void copy(const cXMLParImpl& other);
37 
38  protected:
39  void deleteOld();
40 
41  public:
44 
48  explicit cXMLParImpl();
49 
53  cXMLParImpl(const cXMLParImpl& other) : cParImpl(other) {copy(other);}
54 
58  virtual ~cXMLParImpl();
59 
63  void operator=(const cXMLParImpl& otherpar);
65 
68 
72  virtual cXMLParImpl *dup() const override {return new cXMLParImpl(*this);}
73 
77  virtual void parsimPack(cCommBuffer *buffer) const override;
78 
82  virtual void parsimUnpack(cCommBuffer *buffer) override;
84 
87 
91  virtual void setBoolValue(bool b) override;
92 
96  virtual void setIntValue(intpar_t l) override;
97 
101  virtual void setDoubleValue(double d) override;
102 
106  virtual void setStringValue(const char *s) override;
107 
111  virtual void setXMLValue(cXMLElement *node) override;
112 
117  virtual void setExpression(cExpression *e) override;
119 
122 
126  virtual bool boolValue(cComponent *context) const override;
127 
131  virtual intpar_t intValue(cComponent *context) const override;
132 
136  virtual double doubleValue(cComponent *context) const override;
137 
141  virtual const char *stringValue(cComponent *context) const override;
142 
146  virtual std::string stdstringValue(cComponent *context) const override;
147 
151  virtual cXMLElement *xmlValue(cComponent *context) const override;
152 
156  virtual cExpression *getExpression() const override;
158 
161 
165  virtual Type getType() const override;
166 
170  virtual bool isNumeric() const override;
172 
175 
180  virtual void convertToConst(cComponent *context) override;
181 
185  virtual std::string str() const override;
186 
190  virtual void parse(const char *text) override;
191 
195  virtual int compare(const cParImpl *other) const override;
196 
200  virtual void forEachChild(cVisitor *v, cComponent *context) override;
202 };
203 
204 } // namespace omnetpp
205 
206 
207 #endif
208 
209 
cXMLParImpl(const cXMLParImpl &other)
Definition: cxmlparimpl.h:53
Common base for module and channel classes.
Definition: ccomponent.h:48
Represents an XML element in an XML configuration file.
Definition: cxmlelement.h:73
int64_t intpar_t
Type for NED parameter values that store integers. It is guaranteed to be signed and at least as wide...
Definition: simkerneldefs.h:86
Buffer for the communications layer of parallel simulation.
Definition: ccommbuffer.h:41
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition: cvisitor.h:56
A cParImpl subclass that stores a module/channel parameter of type XML.
Definition: cxmlparimpl.h:28
Definition: cabstracthistogram.h:21
Abstract base class for expression evaluators.
Definition: cexpression.h:33
virtual cXMLParImpl * dup() const override
Definition: cxmlparimpl.h:72
Internal class that stores values for cPar objects.
Definition: cparimpl.h:44