OMNeT++ Simulation Library  5.6.1
cdoubleparimpl.h
1 //==========================================================================
2 // CDOUBLEPARIMPL.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_CDOUBLEPARIMPL_H
17 #define __OMNETPP_CDOUBLEPARIMPL_H
18 
19 #include "cparimpl.h"
20 
21 namespace omnetpp {
22 
29 class SIM_API cDoubleParImpl : public cParImpl
30 {
31  protected:
32  // selector: flags & FL_ISEXPR
33  union {
34  cExpression *expr;
35  double val;
36  };
37 
38  private:
39  void copy(const cDoubleParImpl& other);
40 
41  protected:
42  void deleteOld();
43 
44  public:
47 
51  explicit cDoubleParImpl();
52 
56  cDoubleParImpl(const cDoubleParImpl& other) : cParImpl(other) {copy(other);}
57 
61  virtual ~cDoubleParImpl();
62 
66  void operator=(const cDoubleParImpl& otherpar);
68 
71 
75  virtual cDoubleParImpl *dup() const override {return new cDoubleParImpl(*this);}
76 
80  virtual void parsimPack(cCommBuffer *buffer) const override;
81 
85  virtual void parsimUnpack(cCommBuffer *buffer) override;
87 
90 
94  virtual void setBoolValue(bool b) override;
95 
99  virtual void setIntValue(intpar_t l) override;
100 
104  virtual void setDoubleValue(double d) override;
105 
109  virtual void setStringValue(const char *s) override;
110 
114  virtual void setXMLValue(cXMLElement *node) override;
115 
120  virtual void setExpression(cExpression *e) override;
122 
125 
129  virtual bool boolValue(cComponent *context) const override;
130 
134  virtual intpar_t intValue(cComponent *context) const override;
135 
139  virtual double doubleValue(cComponent *context) const override;
140 
144  virtual const char *stringValue(cComponent *context) const override;
145 
149  virtual std::string stdstringValue(cComponent *context) const override;
150 
154  virtual cXMLElement *xmlValue(cComponent *context) 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) override;
184 
188  virtual std::string str() const override;
189 
193  virtual void parse(const char *text) override;
194 
198  virtual int compare(const cParImpl *other) const override;
200 };
201 
202 } // namespace omnetpp
203 
204 
205 #endif
206 
207 
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
cDoubleParImpl(const cDoubleParImpl &other)
Definition: cdoubleparimpl.h:56
Definition: cabstracthistogram.h:21
A cParImpl subclass that stores a module/channel parameter of the type double.
Definition: cdoubleparimpl.h:29
virtual cDoubleParImpl * dup() const override
Definition: cdoubleparimpl.h:75
Abstract base class for expression evaluators.
Definition: cexpression.h:33
Internal class that stores values for cPar objects.
Definition: cparimpl.h:44