OMNeT++ API 6.1
Discrete Event Simulation Library
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 namespace internal {
23 
29 class SIM_API cIntParImpl : public cParImpl
30 {
31  protected:
32  // selector: flags & FL_ISEXPR
33  union {
34  cExpression *expr;
35  intval_t val;
36  };
37 
38  private:
39  void copy(const cIntParImpl& other);
40 
41  protected:
42  void deleteOld() {cParImpl::deleteOld(expr);}
43 
44  public:
47 
51  explicit cIntParImpl();
52 
56  cIntParImpl(const cIntParImpl& other) : cParImpl(other) {copy(other);}
57 
61  virtual ~cIntParImpl();
62 
66  void operator=(const cIntParImpl& otherpar);
68 
71 
75  virtual cIntParImpl *dup() const override {return new cIntParImpl(*this);}
77 
80 
84  virtual void setBoolValue(bool b) override;
85 
89  virtual void setIntValue(intval_t l) override;
90 
94  virtual void setDoubleValue(double d) override;
95 
99  virtual void setStringValue(const char *s) override;
100 
104  virtual void setObjectValue(cObject *object) override;
105 
109  virtual void setXMLValue(cXMLElement *node) override;
110 
115  virtual void setExpression(cExpression *e) override;
117 
120 
124  virtual bool boolValue(cComponent *context) const override;
125 
129  virtual intval_t intValue(cComponent *context) const override;
130 
134  virtual double doubleValue(cComponent *context) const override;
135 
139  virtual const char *stringValue(cComponent *context) const override;
140 
144  virtual std::string stdstringValue(cComponent *context) const override;
145 
149  virtual cObject *objectValue(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, FileLine loc) override;
194 
198  virtual int compare(const cParImpl *other) const override;
200 };
201 
202 } // namespace internal
203 } // namespace omnetpp
204 
205 #endif
206 
207 
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::cIntParImpl
A cParImpl subclass that stores an integer module/channel parameter.
Definition: cintparimpl.h:29
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::cIntParImpl::dup
virtual cIntParImpl * dup() const override
Definition: cintparimpl.h:75
omnetpp::internal::cIntParImpl::cIntParImpl
cIntParImpl(const cIntParImpl &other)
Definition: cintparimpl.h:56