Kea 2.7.5
|
Token that represents an alternative. More...
#include <token.h>
Public Member Functions | |
TokenIfElse () | |
Constructor (does nothing) | |
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values) |
Alternative. | |
Public Member Functions inherited from isc::dhcp::Token | |
virtual | ~Token () |
Virtual destructor. | |
virtual unsigned | getLabel () const |
Return the label of this token. | |
Additional Inherited Members | |
Static Public Member Functions inherited from isc::dhcp::Token | |
static bool | toBool (std::string value) |
Coverts a (string) value to a boolean. | |
Token that represents an alternative.
For example in the sub-expression "ifelse(cond, iftrue, iffalse)" the boolean "cond" expression is evaluated, if it is true then the "iftrue" value is returned else the "iffalse" value is returned. Please note that "iftrue" and "iffalse" must be plain string (vs. boolean) expressions and they are always evaluated. If you want a similar operator on boolean expressions it can be built from "and", "or" and "not" boolean operators.
|
inline |
|
virtual |
Alternative.
Evaluation does not use packet information, but rather consumes the last three results. It does a simple string comparison on the condition (third value on the stack) which is required to be either "true" or "false", and leaves the second and first value if the condition is "true" or "false".
EvalBadStack | if there are less than 3 values on stack |
EvalTypeError | if the third value (the condition) is not either "true" or "false" |
pkt | (unused) |
values | - stack of values (two items are removed) |
Implements isc::dhcp::Token.
Definition at line 989 of file token.cc.
References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_IFELSE_FALSE, isc::dhcp::EVAL_DEBUG_IFELSE_TRUE, isc::dhcp::eval_logger, isc_throw, LOG_DEBUG, and isc::dhcp::Token::toBool().