A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::internal::StructValueTraitsBase< T, Constructor, Fields > Struct Template Reference

Provide the implementation details of StructValue for a set of fields. More...

#include "struct.h"

Inheritance diagram for ns3::internal::StructValueTraitsBase< T, Constructor, Fields >:
Collaboration diagram for ns3::internal::StructValueTraitsBase< T, Constructor, Fields >:

Public Types

using base_type = TupleValue<typename Fields::value_type...>
 TupleValue type used to store the structure fields.
using tuple_type = typename base_type::result_type
 Tuple of the values returned by the field AttributeValue objects.
using value_type = typename base_type::value_type
 Tuple of the field AttributeValue objects.

Static Public Member Functions

static T Construct (tuple_type values)
 Construct the represented structure from field values.
static tuple_type Read (const T &value)
 Read the field values from a structure.

Static Public Attributes

static constexpr std::size_t field_count = sizeof...(Fields)
 Number of structure fields.

Static Private Member Functions

template<std::size_t... Is>
static constexpr bool IsConstructorInvocable (std::index_sequence< Is... >)
 Check whether the constructor function accepts all field values.
template<std::size_t... Is>
static constexpr bool IsDirectlyConstructible (std::index_sequence< Is... >)
 Check whether the structure can be constructed directly from field values.
template<typename Field>
static auto ReadField (const T &object)
 Read a field through its AttributeValue type.
template<typename Field, typename Value>
static void SetField (T &object, Value &&value)
 Set a structure field through its data member or setter.
template<std::size_t... Is>
static void SetFields (T &object, tuple_type &&values, std::index_sequence< Is... >)
 Set the fields of a structure from tuple elements.

Detailed Description

template<typename T, auto Constructor, typename... Fields>
requires (StructFieldFor<Fields, T> && ...)
struct ns3::internal::StructValueTraitsBase< T, Constructor, Fields >

Provide the implementation details of StructValue for a set of fields.

Template Parameters
TThe represented structure type.
ConstructorFunction used to construct the structure, or nullptr.
FieldsFields represented by StructValue.

Definition at line 309 of file struct.h.

Member Typedef Documentation

◆ base_type

template<typename T, auto Constructor, typename... Fields>
using ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::base_type = TupleValue<typename Fields::value_type...>

TupleValue type used to store the structure fields.

Definition at line 312 of file struct.h.

◆ tuple_type

template<typename T, auto Constructor, typename... Fields>
using ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::tuple_type = typename base_type::result_type

Tuple of the values returned by the field AttributeValue objects.

Definition at line 314 of file struct.h.

◆ value_type

template<typename T, auto Constructor, typename... Fields>
using ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::value_type = typename base_type::value_type

Tuple of the field AttributeValue objects.

Definition at line 316 of file struct.h.

Member Function Documentation

◆ Construct()

template<typename T, auto Constructor, typename... Fields>
T ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::Construct ( tuple_type values)
static

Construct the represented structure from field values.

Parameters
valuesThe field values.
Returns
the constructed structure

Definition at line 500 of file struct.h.

References Construct(), IsConstructorInvocable(), IsDirectlyConstructible(), and SetFields().

Referenced by Construct().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsConstructorInvocable()

template<typename T, auto Constructor, typename... Fields>
template<std::size_t... Is>
bool ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::IsConstructorInvocable ( std::index_sequence< Is... > )
staticconstexprprivate

Check whether the constructor function accepts all field values.

Template Parameters
IsIndices of the field values.
Returns
true if the constructor function can be invoked

Definition at line 573 of file struct.h.

References IsConstructorInvocable().

Referenced by Construct(), and IsConstructorInvocable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsDirectlyConstructible()

template<typename T, auto Constructor, typename... Fields>
template<std::size_t... Is>
bool ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::IsDirectlyConstructible ( std::index_sequence< Is... > )
staticconstexprprivate

Check whether the structure can be constructed directly from field values.

Template Parameters
IsIndices of the field values.
Returns
true if the structure can be constructed directly

Definition at line 552 of file struct.h.

References IsDirectlyConstructible().

Referenced by Construct(), and IsDirectlyConstructible().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

template<typename T, auto Constructor, typename... Fields>
StructValueTraitsBase< T, Constructor, Fields... >::tuple_type ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::Read ( const T & value)
static

Read the field values from a structure.

Parameters
valueThe structure to read.
Returns
the field values

Definition at line 543 of file struct.h.

References ReadField().

Here is the call graph for this function:

◆ ReadField()

template<typename T, auto Constructor, typename... Fields>
template<typename Field>
auto ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::ReadField ( const T & object)
staticprivate

Read a field through its AttributeValue type.

Template Parameters
FieldDescriptor of the field to read.
Parameters
objectThe structure to read.
Returns
the field value returned by the AttributeValue

Definition at line 562 of file struct.h.

Referenced by Read().

Here is the caller graph for this function:

◆ SetField()

template<typename T, auto Constructor, typename... Fields>
template<typename Field, typename Value>
void ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::SetField ( T & object,
Value && value )
staticprivate

Set a structure field through its data member or setter.

Template Parameters
FieldDescriptor of the field to set.
ValueType of the field value.
Parameters
objectThe structure whose field is set.
valueThe value to set.

Definition at line 597 of file struct.h.

References NS_ABORT_MSG_UNLESS, and SetField().

Referenced by SetField(), and SetFields().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFields()

template<typename T, auto Constructor, typename... Fields>
template<std::size_t... Is>
void ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::SetFields ( T & object,
tuple_type && values,
std::index_sequence< Is... >  )
staticprivate

Set the fields of a structure from tuple elements.

Template Parameters
IsIndices of the fields to set.
Parameters
objectThe structure whose fields are set.
valuesThe tuple containing the field values.

Definition at line 585 of file struct.h.

References SetField().

Referenced by Construct().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ field_count

template<typename T, auto Constructor, typename... Fields>
std::size_t ns3::internal::StructValueTraitsBase< T, Constructor, Fields >::field_count = sizeof...(Fields)
staticconstexpr

Number of structure fields.

Definition at line 319 of file struct.h.


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