Kea: isc::dhcp::TokenPopOrBranchFalse Class Reference

| Kea 3.2.0-git

isc::dhcp::TokenPopOrBranchFalse Class Reference

Token that represents pop or branch if false. More...

`#include <token.h>`

Inheritance diagram for isc::dhcp::TokenPopOrBranchFalse:
[legend]

## Public Member Functions
| TokenPopOrBranchFalse (const unsigned target)
| Constructor.
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values)
| Looks at the top of stack which must be "false" or "true".
Public Member Functions inherited from isc::dhcp::TokenBranch
| TokenBranch (const unsigned target)
| Constructor.
unsigned | getTarget () const
| Returns branchtarget.
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.
Protected Attributes inherited from isc::dhcp::TokenBranch
unsigned | target_

## Detailed Description

Token that represents pop or branch if false.

Branch to a forward target when the top value is false else pop it. Can be used to implement the left "and" boolean operator.

Definition at line 1505 of file token.h.

## Constructor & Destructor Documentation

## ◆ TokenPopOrBranchFalse()

TokenPopOrBranchFalse::TokenPopOrBranchFalse | ( | const unsigned | target | ) |

Constructor.

Parameters

  target | the label to branch to

Exceptions

  EvalParseError | when target is 0

Definition at line 1556 of file token.cc.

References isc::dhcp::TokenBranch::TokenBranch().

Here is the call graph for this function:

## Member Function Documentation

## ◆ evaluate()

unsigned TokenPopOrBranchFalse::evaluate | ( | Pkt & | pkt,
|  | ValueStack & | values )
| virtual

Looks at the top of stack which must be "false" or "true".

On "true" pops it and returns 0, on "false" return the branch target.

Parameters

  pkt | (unused)
  values | - stack of values (use/pop boolean top of stack)

Exceptions

  EvalBadStack | if there are less than 1 value on stack
  EvalTypeError | if the top value on the stack is not either "true" or "false"

Returns
  next label or 0 when means evaluate next token if any.

Reimplemented from isc::dhcp::TokenBranch.

Definition at line 1561 of file token.cc.

References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_POP_OR_BRANCH_FALSE, isc::dhcp::eval_logger, isc_throw, LOG_DEBUG, isc::dhcp::TokenBranch::target_, and isc::dhcp::Token::toBool().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- token.h
- token.cc