OMNeT++ Simulation Library  5.6.1
cintparimpl.h
1 //==========================================================================
2 // CINTPARIMPL.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_CINTPARIMPL_H
17 #define __OMNETPP_CINTPARIMPL_H
18 
19 #include "cparimpl.h"
20 
21 namespace omnetpp {
22 
28 class SIM_API cIntParImpl : public cParImpl
29 {
30  protected:
31  // selector: flags & FL_ISEXPR
32  union {
33  cExpression *expr;
34  intpar_t val;
35  };
36 
37  private:
38  void copy(const cIntParImpl& other);
39 
40  protected:
41  void deleteOld();
42 
43  public:
46 
50  explicit cIntParImpl();
51 
55  cIntParImpl(const cIntParImpl& other) : cParImpl(other) {copy(other);}
56 
60  virtual ~cIntParImpl();
61 
65  void operator=(const cIntParImpl& otherpar);
67 
70 
74  virtual cIntParImpl *dup() const override {return new cIntParImpl(*this);}
75 
79  virtual void parsimPack(cCommBuffer *buffer) const override;
80 
84  virtual void parsimUnpack(cCommBuffer *buffer) override;
86 
89 
93  virtual void setBoolValue(bool b) override;
94 
98  virtual void setIntValue(intpar_t l) override;
99 
103  virtual void setDoubleValue(double d) override;
104 
108  virtual void setStringValue(const char *s) override;
109 
113  virtual void setXMLValue(cXMLElement *node) override;
114 
119  virtual void setExpression(cExpression *e) override;
121 
124 
128  virtual bool boolValue(cComponent *context) const override;
129 
133  virtual intpar_t intValue(cComponent *context) const override;
134 
138  virtual double doubleValue(cComponent *context) const override;
139 
143  virtual const char *stringValue(cComponent *context) const override;
144 
148  virtual std::string stdstringValue(cComponent *context) const override;
149 
153  virtual cXMLElement *xmlValue(cComponent *context) const override;
154 
158  virtual cExpression *getExpression() const override;
160 
163 
167  virtual Type getType() const override;
168 
172  virtual bool isNumeric() const override;
174 
177 
182  virtual void convertToConst(cComponent *context) override;
183 
187  virtual std::string str() const override;
188 
192  virtual void parse(const char *text) override;
193 
197  virtual int compare(const cParImpl *other) const override;
199 };
200 
201 } // namespace omnetpp
202 
203 
204 #endif
205 
206 
Common base for module and channel classes.
Definition: ccomponent.h:48
cIntParImpl(const cIntParImpl &other)
Definition: cintparimpl.h:55
virtual cIntParImpl * dup() const override
Definition: cintparimpl.h:74
Represents an XML element in an XML configuration file.
Definition: cxmlelement.h:73
A cParImpl subclass that stores an integer module/channel parameter.
Definition: cintparimpl.h:28
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
Definition: cabstracthistogram.h:21
Abstract base class for expression evaluators.
Definition: cexpression.h:33
Internal class that stores values for cPar objects.
Definition: cparimpl.h:44