Kea: isc::dhcp::variant< S > Struct Template Reference

| Kea 1.5.0

Public Types | Public Member Functions | List of all members
isc::dhcp::variant< S > Struct Template Reference

A char[S] buffer to store and retrieve objects. More...

`#include <dhcp4_parser.h>`

## Public Types
typedef variant< S > | self_type
| Type of *this. More...
typedef variant< S > | self_type
| Type of *this. More...

## Public Member Functions
| variant ()
| Empty construction. More...
| variant ()
| Empty construction. More...
template<typename T >
| variant (YY_RVREF(T) t)
| Construct and fill. More...
template<typename T >
| variant (YY_RVREF(T) t)
| Construct and fill. More...
| ~variant ()
| Destruction, allowed only if empty. More...
| ~variant ()
| Destruction, allowed only if empty. More...
template<typename T >
T & | as ()
| Accessor to a built T. More...
template<typename T >
T & | as ()
| Accessor to a built T. More...
template<typename T >
const T & | as () const
| Const accessor to a built T (for printer). More...
template<typename T >
const T & | as () const
| Const accessor to a built T (for printer). More...
template<typename T >
T & | build ()
| Instantiate an empty T in here. More...
template<typename T >
T & | build ()
| Instantiate an empty T in here. More...
template<typename T >
T & | build (const T &t)
| Instantiate a T in here from t. More...
template<typename T >
T & | build (const T &t)
| Instantiate a T in here from t. More...
template<typename T >
void | copy (const self_type &other)
| Copy the content of other to this. More...
template<typename T >
void | copy (const self_type &other)
| Copy the content of other to this. More...
template<typename T >
void | destroy ()
| Destroy the stored T. More...
template<typename T >
void | destroy ()
| Destroy the stored T. More...
template<typename T >
T & | emplace ()
| Instantiate an empty T in here. More...
template<typename T >
T & | emplace ()
| Instantiate an empty T in here. More...
template<typename T >
T & | emplace (const T &t)
| Instantiate a T in here from t. More...
template<typename T >
T & | emplace (const T &t)
| Instantiate a T in here from t. More...
template<typename T >
void | move (self_type &other)
| Move the content of other to this. More...
template<typename T >
void | move (self_type &other)
| Move the content of other to this. More...
template<typename T >
void | swap (self_type &other)
| Swap the content with other, of same type. More...
template<typename T >
void | swap (self_type &other)
| Swap the content with other, of same type. More...

## Detailed Description

### template<size_t S>
struct isc::dhcp::variant< S >

A char[S] buffer to store and retrieve objects.

Sort of a variant, but does not keep track of the nature of the stored data, since that knowledge is available via the current state.

Definition at line 296 of file dhcp4_parser.h.

## Member Typedef Documentation

## ◆ self_type [1/2]

template<size_t S>

typedef variant<S> isc::dhcp::variant< S >::self_type

Type of *this.

Definition at line 299 of file dhcp4_parser.h.

## ◆ self_type [2/2]

template<size_t S>

typedef variant<S> isc::dhcp::variant< S >::self_type

Type of *this.

Definition at line 299 of file dhcp6_parser.h.

## Constructor & Destructor Documentation

## ◆ variant() [1/4]

template<size_t S>

isc::dhcp::variant< S >::variant | ( |  | ) |
| inline

Empty construction.

Definition at line 302 of file dhcp4_parser.h.

## ◆ variant() [2/4]

template<size_t S>
template<typename T >

isc::dhcp::variant< S >::variant | ( | YY_RVREF(T) | t | ) |
| inline

Construct and fill.

Definition at line 309 of file dhcp4_parser.h.

## ◆ ~variant() [1/2]

template<size_t S>

isc::dhcp::variant< S >::~variant | ( |  | ) |
| inline

Destruction, allowed only if empty.

Definition at line 317 of file dhcp4_parser.h.

## ◆ variant() [3/4]

template<size_t S>

isc::dhcp::variant< S >::variant | ( |  | ) |
| inline

Empty construction.

Definition at line 302 of file dhcp6_parser.h.

## ◆ variant() [4/4]

template<size_t S>
template<typename T >

isc::dhcp::variant< S >::variant | ( | YY_RVREF(T) | t | ) |
| inline

Construct and fill.

Definition at line 309 of file dhcp6_parser.h.

## ◆ ~variant() [2/2]

template<size_t S>

isc::dhcp::variant< S >::~variant | ( |  | ) |
| inline

Destruction, allowed only if empty.

Definition at line 317 of file dhcp6_parser.h.

## Member Function Documentation

## ◆ as() [1/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::as | ( |  | ) |
| inline

Accessor to a built T.

Definition at line 378 of file dhcp4_parser.h.

Referenced by isc::dhcp::variant< sizeof(union_type)>::copy(), isc::dhcp::variant< sizeof(union_type)>::move(), and isc::dhcp::variant< sizeof(union_type)>::swap().

## ◆ as() [2/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::as | ( |  | ) |
| inline

Accessor to a built T.

Definition at line 378 of file dhcp6_parser.h.

## ◆ as() [3/4]

template<size_t S>
template<typename T >

const T& isc::dhcp::variant< S >::as | ( |  | ) | const
| inline

Const accessor to a built T (for printer).

Definition at line 389 of file dhcp6_parser.h.

## ◆ as() [4/4]

template<size_t S>
template<typename T >

const T& isc::dhcp::variant< S >::as | ( |  | ) | const
| inline

Const accessor to a built T (for printer).

Definition at line 389 of file dhcp4_parser.h.

## ◆ build() [1/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::build | ( |  | ) |
| inline

Instantiate an empty T in here.

Obsolete, use emplace.

Definition at line 361 of file dhcp4_parser.h.

## ◆ build() [2/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::build | ( |  | ) |
| inline

Instantiate an empty T in here.

Obsolete, use emplace.

Definition at line 361 of file dhcp6_parser.h.

## ◆ build() [3/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::build | ( | const T & | t | ) |
| inline

Instantiate a T in here from t.

Obsolete, use emplace.

Definition at line 370 of file dhcp4_parser.h.

## ◆ build() [4/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::build | ( | const T & | t | ) |
| inline

Instantiate a T in here from t.

Obsolete, use emplace.

Definition at line 370 of file dhcp6_parser.h.

## ◆ copy() [1/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::copy | ( | const self_type & | other | ) |
| inline

Copy the content of other to this.

Definition at line 444 of file dhcp4_parser.h.

## ◆ copy() [2/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::copy | ( | const self_type & | other | ) |
| inline

Copy the content of other to this.

Definition at line 444 of file dhcp6_parser.h.

## ◆ destroy() [1/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::destroy | ( |  | ) |
| inline

Destroy the stored T.

Definition at line 452 of file dhcp4_parser.h.

Referenced by isc::dhcp::variant< sizeof(union_type)>::move().

## ◆ destroy() [2/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::destroy | ( |  | ) |
| inline

Destroy the stored T.

Definition at line 452 of file dhcp6_parser.h.

## ◆ emplace() [1/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::emplace | ( |  | ) |
| inline

Instantiate an empty T in here.

Definition at line 325 of file dhcp6_parser.h.

## ◆ emplace() [2/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::emplace | ( |  | ) |
| inline

Instantiate an empty T in here.

Definition at line 325 of file dhcp4_parser.h.

## ◆ emplace() [3/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::emplace | ( | const T & | t | ) |
| inline

Instantiate a T in here from t.

Definition at line 348 of file dhcp4_parser.h.

## ◆ emplace() [4/4]

template<size_t S>
template<typename T >

T& isc::dhcp::variant< S >::emplace | ( | const T & | t | ) |
| inline

Instantiate a T in here from t.

Definition at line 348 of file dhcp6_parser.h.

## ◆ move() [1/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::move | ( | self_type & | other | ) |
| inline

Move the content of other to this.

Destroys other.

Definition at line 419 of file dhcp4_parser.h.

## ◆ move() [2/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::move | ( | self_type & | other | ) |
| inline

Move the content of other to this.

Destroys other.

Definition at line 419 of file dhcp6_parser.h.

## ◆ swap() [1/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::swap | ( | self_type & | other | ) |
| inline

Swap the content with other, of same type.

Both variants must be built beforehand, because swapping the actual data requires reading it (with as()), and this is not possible on unconstructed variants: it would require some dynamic testing, which should not be the variant's responsibility. Swapping between built and (possibly) non-built is done with variant::move ().

Definition at line 407 of file dhcp6_parser.h.

## ◆ swap() [2/2]

template<size_t S>
template<typename T >

void isc::dhcp::variant< S >::swap | ( | self_type & | other | ) |
| inline

Swap the content with other, of same type.

Both variants must be built beforehand, because swapping the actual data requires reading it (with as()), and this is not possible on unconstructed variants: it would require some dynamic testing, which should not be the variant's responsibility. Swapping between built and (possibly) non-built is done with variant::move ().

Definition at line 407 of file dhcp4_parser.h.

## Member Data Documentation

## ◆ yyalign_me

template<size_t S>

long double isc::dhcp::variant< S >::yyalign_me

Strongest alignment constraints.

Definition at line 484 of file dhcp4_parser.h.

## ◆ yyraw

template<size_t S>

char isc::dhcp::variant< S >::yyraw[S]

A buffer large enough to store any of the semantic values.

Definition at line 486 of file dhcp4_parser.h.

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

- dhcp4_parser.h
- dhcp6_parser.h