Kea: isc::dhcp::TokenInteger Class Reference

| Kea 2.2.0

Public Member Functions | Protected Attributes | List of all members
isc::dhcp::TokenInteger Class Reference

Token representing an unsigned 32 bit integer. More...

`#include <token.h>`

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

## Public Member Functions
| TokenInteger (const uint32_t value)
| Integer value set during construction. More...
uint32_t | getInteger () const
| Returns integer value. More...
Public Member Functions inherited from isc::dhcp::TokenString
| TokenString (const std::string &str)
| Value is set during token construction. More...
void | evaluate (Pkt &pkt, ValueStack &values)
| Token evaluation (puts value of the constant string on the stack) More...
Public Member Functions inherited from isc::dhcp::Token
virtual | ~Token ()
| Virtual destructor. More...
virtual void | evaluate (Pkt &pkt, ValueStack &values)=0
| This is a generic method for evaluating a packet. More...

## Protected Attributes
uint32_t | int_value_
| value as integer (stored for testing only) More...
Protected Attributes inherited from isc::dhcp::TokenString
std::string | value_
| Constant value. More...

## 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. More...

## Detailed Description

Token representing an unsigned 32 bit integer.

For performance reasons, the constant integer value is converted to a string just once (in the constructor). Afterwards, this effectively works as a constant 4 byte long string. Hence this class is derived from TokenString and does not even need its own evaluate() method.

Definition at line 164 of file token.h.

## Constructor & Destructor Documentation

## ◆ TokenInteger()

TokenInteger::TokenInteger | ( | const uint32_t | value | ) |

Integer value set during construction.

The value is converted to string and stored in value_ provided by the base class.

Parameters

  value | integer value to be stored.

Definition at line 1263 of file token.cc.

## Member Function Documentation

## ◆ getInteger()

uint32_t isc::dhcp::TokenInteger::getInteger | ( |  | ) | const
| inline

Returns integer value.

Used in tests only.

Returns
  integer value

Definition at line 179 of file token.h.

References int_value_.

## Member Data Documentation

## ◆ int_value_

uint32_t isc::dhcp::TokenInteger::int_value_
| protected

value as integer (stored for testing only)

Definition at line 184 of file token.h.

Referenced by getInteger().

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

- token.h
- token.cc