Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Hg::detail::FieldTypes< FieldT, TraitT > Struct Template Reference

Provides the data field type definitions. More...

#include <basic_datum.h>

Inheritance diagram for Hg::detail::FieldTypes< FieldT, TraitT >:
Hg::Datum< IdxT, FormatT > Hg::Datum< kt_idx, format_t > Hg::Datum< Idx, format_t > Hg::detail::DataProxy< array_trait, IdxT, FormatT > Hg::detail::DataProxy< vector_trait, IdxT, FormatT > Hg::detail::DataProxy< datum_trait, kt_idx, format_t > Hg::detail::DataProxy< packed_trait, kt_idx, format_t > Hg::detail::DataProxy< opaque_vector_trait, IdxT, FormatT >

Public Types

typedef FieldT index_type
        The type at the index of the

parent type container.

typedef field_data_t
< index_type >::value_type 
        The specified value type for 

the current Datum.


Public Member Functions

const value_typedata () const
 Returns the value of the data buffer.
void data (const value_type &value)
 Returns the value of the data buffer.
value_typereference ()
 Returns a reference to the internal data storage. More...

Protected Attributes

value_type m_data
            This is a local copy of the data

value to shadow the value held in the buffer.


Detailed Description

template<class FieldT, class TraitT = typename Hg::detail::DeduceTypeTrait<FieldT>::type>
struct Hg::detail::FieldTypes< FieldT, TraitT >

Provides the data field type definitions.

This class acts as a discriminator object to choose the proper msg field types. This method of field and data definition allows the use of virtual interfaces to be avoided for message fields.

In cases such as a uint8_t, this would cause a 400% increase in size for no value. This extra hidden complexity of implementation is well worth the runtime value of the final structure.

The template defaults use field_t for both index_type and value_type. These definitions determine the data managed within a Datum. This template should be specialized if a different value_type is desired.
The simplest method to specialize the value_type is to create a specialization of the field_data_t template.

FieldT This parameterized type declares the type at the associated location in the parent type container.

Definition at line 236 of file basic_datum.h.

Member Function Documentation

template<class FieldT , class TraitT = typename Hg::detail::DeduceTypeTrait<FieldT>::type>
value_type& Hg::detail::FieldTypes< FieldT, TraitT >::reference ( )

Returns a reference to the internal data storage.

Returns a reference to the internal data storage managed by this Datum. The reference to the data can be useful, and necessary for

Definition at line 252 of file basic_datum.h.

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