COMMS
Template library intended to help with implementation of communication protocols.
comms::option::def::DefaultValueInitialiser< T > Struct Template Reference

#include "comms/options.h"

Detailed Description

template<typename T>
struct comms::option::def::DefaultValueInitialiser< T >

Option that specifies default initialisation class.

Use this option when default constructor of the field must assign some special value. The initialiser class provided as template argument must define the following member function:

struct MyInitialiser
{
template <typename TField>
void operator()(TField& field) {...}
};

For example, we want string field that will have "hello" as its default value. The provided initialiser class with the option will be instantiated and its operator() is invoked which is responsible to assign proper value to the field.

struct MyStringInitialiser
{
template <typename TField>
void operator()(TField& field) const
{
field.value() = hello;
}
};
using MyField =
MyFieldBase,
>;
Base class to all the field classes.
Definition: Field.h:33
Field that represents a string.
Definition: String.h:159
Option that specifies default initialisation class.
Definition: options.h:616
Template Parameters
TType of the initialiser class.

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