Kea  2.1.7-git
isc::dhcp::TokenInteger Class Reference

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

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenInteger:

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

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
valueinteger 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.

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.


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