OMNeT++ API
6.1
Discrete Event Simulation Library
cexpression.h
1
//==========================================================================
2
// CEXPRESSION.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_CEXPRESSION_H
17
#define __OMNETPP_CEXPRESSION_H
18
19
#include "cobject.h"
20
#include "cexception.h"
21
#include "cvalue.h"
22
23
namespace
omnetpp {
24
25
class
cXMLElement;
26
33
class
SIM_API
cExpression
34
{
35
public
:
39
class
SIM_API
Context
:
public
cObject
40
{
41
public
:
42
explicit
Context
(
cComponent
*component,
const
char
*baseDirectory,
const
char
*paramName=
nullptr
) :
43
component(component), baseDirectory(baseDirectory), paramName(paramName) {}
44
cComponent
*component =
nullptr
;
45
const
char
*baseDirectory =
nullptr
;
46
const
char
*paramName =
nullptr
;
47
};
48
49
public
:
52
56
explicit
cExpression
() {}
57
61
cExpression
(
const
cExpression
& other) =
default
;
62
66
virtual
~cExpression
() {}
67
71
cExpression
&
operator=
(
const
cExpression
& other) {
return
*
this
;}
72
76
virtual
cExpression
*dup()
const
= 0;
77
81
virtual
std::string
str
()
const
{
return
""
;}
83
90
virtual
cValue
evaluate(Context *context)
const
= 0;
91
96
virtual
bool
boolValue(Context *context)
const
= 0;
97
103
virtual
intval_t
intValue(Context *context,
const
char
*expectedUnit=
nullptr
)
const
= 0;
104
110
virtual
double
doubleValue(Context *context,
const
char
*expectedUnit=
nullptr
)
const
= 0;
111
116
virtual
std::string stringValue(Context *context)
const
= 0;
117
122
virtual
cXMLElement
*xmlValue(Context *context)
const
= 0;
123
129
virtual
cValue
evaluate(
cComponent
*contextComponent=
nullptr
)
const
;
130
137
virtual
bool
boolValue(
cComponent
*contextComponent=
nullptr
)
const
;
138
146
virtual
intval_t
intValue(
cComponent
*contextComponent=
nullptr
,
const
char
*expectedUnit=
nullptr
)
const
;
147
155
virtual
double
doubleValue(
cComponent
* contextComponent=
nullptr
,
const
char
*expectedUnit=
nullptr
)
const
;
156
163
virtual
std::string stringValue(
cComponent
*contextComponent=
nullptr
)
const
;
164
171
virtual
cXMLElement
*xmlValue(
cComponent
*contextComponent=
nullptr
)
const
;
173
183
virtual
void
parse(
const
char
*text) = 0;
184
189
virtual
int
compare(
const
cExpression
*other)
const
= 0;
190
195
virtual
bool
isAConstant
()
const
{
return
false
;}
196
201
virtual
std::string getSourceLocation()
const
= 0;
203
};
204
205
}
// namespace omnetpp
206
207
208
#endif
209
210
omnetpp::cExpression::isAConstant
virtual bool isAConstant() const
Definition:
cexpression.h:195
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition:
cobject.h:92
omnetpp::cValue
A variant-like value class used during evaluating NED expressions.
Definition:
cvalue.h:47
omnetpp::cExpression::~cExpression
virtual ~cExpression()
Definition:
cexpression.h:66
omnetpp::cExpression
Abstract base class for expression evaluators.
Definition:
cexpression.h:33
omnetpp::cExpression::str
virtual std::string str() const
Definition:
cexpression.h:81
omnetpp::cExpression::cExpression
cExpression()
Definition:
cexpression.h:56
omnetpp::cExpression::operator=
cExpression & operator=(const cExpression &other)
Definition:
cexpression.h:71
omnetpp::cExpression::Context
Contextual information for evaluating the expression.
Definition:
cexpression.h:39
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::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
include
omnetpp
cexpression.h
Generated by
1.8.17