OMNeT++ Simulation Library  5.6.1
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 
21 namespace omnetpp {
22 
29 class SIM_API cBoolParImpl : public cParImpl
30 {
31  protected:
32  // selector: flags & FL_ISEXPR
33  union {
34  cExpression *expr;
35  bool val;
36  };
37 
38  private:
39  void copy(const cBoolParImpl& other);
40 
41  protected:
42  void deleteOld();
43 
44  public:
47 
51  explicit cBoolParImpl();
52 
56  cBoolParImpl(const cBoolParImpl& other) : cParImpl(other) {copy(other);}
57 
61  virtual ~cBoolParImpl();
62 
66  void operator=(const cBoolParImpl& otherpar);
68 
71 
75  virtual cBoolParImpl *dup() const override {return new cBoolParImpl(*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
virtual cBoolParImpl * dup() const override
Definition: cboolparimpl.h:75
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
A cParImpl subclass that stores a module/channel parameter of the type bool.
Definition: cboolparimpl.h:29
Definition: cabstracthistogram.h:21
cBoolParImpl(const cBoolParImpl &other)
Definition: cboolparimpl.h:56
Abstract base class for expression evaluators.
Definition: cexpression.h:33
Internal class that stores values for cPar objects.
Definition: cparimpl.h:44