OMNeT++ Simulation Library  6.0.3
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 namespace internal {
23 
30 class SIM_API cBoolParImpl : public cParImpl
31 {
32  protected:
33  // selector: flags & FL_ISEXPR
34  union {
35  cExpression *expr;
36  bool val;
37  };
38 
39  private:
40  void copy(const cBoolParImpl& other);
41 
42  protected:
43  void deleteOld();
44 
45  public:
48 
52  explicit cBoolParImpl();
53 
57  cBoolParImpl(const cBoolParImpl& other) : cParImpl(other) {copy(other);}
58 
62  virtual ~cBoolParImpl();
63 
67  void operator=(const cBoolParImpl& otherpar);
69 
72 
76  virtual cBoolParImpl *dup() const override {return new cBoolParImpl(*this);}
78 
81 
85  virtual void setBoolValue(bool b) override;
86 
90  virtual void setIntValue(intval_t l) override;
91 
95  virtual void setDoubleValue(double d) override;
96 
100  virtual void setStringValue(const char *s) override;
101 
105  virtual void setObjectValue(cObject *object) override;
106 
110  virtual void setXMLValue(cXMLElement *node) override;
111 
116  virtual void setExpression(cExpression *e) override;
118 
121 
125  virtual bool boolValue(cComponent *context) const override;
126 
130  virtual intval_t intValue(cComponent *context) const override;
131 
135  virtual double doubleValue(cComponent *context) const override;
136 
140  virtual const char *stringValue(cComponent *context) const override;
141 
145  virtual std::string stdstringValue(cComponent *context) const override;
146 
150  virtual cObject *objectValue(cComponent *context) const override;
151 
155  virtual cXMLElement *xmlValue(cComponent *context) const override;
156 
160  virtual cExpression *getExpression() const override;
162 
165 
169  virtual Type getType() const override;
170 
174  virtual bool isNumeric() const override;
176 
179 
184  virtual void convertToConst(cComponent *context) override;
185 
189  virtual std::string str() const override;
190 
194  virtual void parse(const char *text, FileLine loc) override;
195 
199  virtual int compare(const cParImpl *other) const override;
201 };
202 
203 } // namespace internal
204 } // namespace omnetpp
205 
206 #endif
207 
208 
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
omnetpp::cExpression
Abstract base class for expression evaluators.
Definition: cexpression.h:33
omnetpp::FileLine
Definition: fileline.h:27
omnetpp::internal::cBoolParImpl
A cParImpl subclass that stores a module/channel parameter of the type bool.
Definition: cboolparimpl.h:30
omnetpp::intval_t
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
omnetpp::internal::cParImpl
Internal class that stores values for cPar objects.
Definition: cparimpl.h:46
omnetpp::cXMLElement
Represents an XML element in an XML configuration file.
Definition: cxmlelement.h:75
omnetpp::cComponent
Common base for module and channel classes.
Definition: ccomponent.h:49
omnetpp::internal::cBoolParImpl::cBoolParImpl
cBoolParImpl(const cBoolParImpl &other)
Definition: cboolparimpl.h:57
omnetpp::internal::cBoolParImpl::dup
virtual cBoolParImpl * dup() const override
Definition: cboolparimpl.h:76