Alchemy
1.0
A framework to robustly process network messages and structured data
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Hg
datum
deduce_array_type.h
1
/// @file detail/deduce_array_type.h
2
///
3
/// A type function to deduce the correct definition for a Hg array.
4
///
5
/// A template meta-function that selects the appropriate type of declaration
6
/// required for an array of types. In order to provide an interface that
7
/// feels transparent and natural to the application programmer, it is sometimes
8
/// necessary to introduce proxy-types to provide the natural interface.
9
///
10
/// The MIT License(MIT)
11
/// @copyright 2014 Paul M Watt
12
// ****************************************************************************
13
#ifndef DEDUCE_PROXY_TYPE_H_INCLUDED
14
#define DEDUCE_PROXY_TYPE_H_INCLUDED
15
// Includes ******************************************************************
16
#include <Hg/deduce_type_trait.h>
17
#include <Hg/datum/basic_datum.h>
18
#include <meta/bit_field/bit_field_array.h>
19
20
21
namespace
Hg
22
{
23
24
namespace
detail
25
{
26
27
// ****************************************************************************
28
/// A convenience meta-function to define the correct type of array for a msg field.
29
/// The deduced type can be accessed through the public typedef *type*.
30
///
31
/// @paramt IdxT
32
/// @paramt FormatT
33
/// @paramt OffsetT
34
///
35
template
<
typename
T,
36
size_t
N
37
>
38
struct
DeduceArrayType
39
{
40
// **************************************************************************
41
// Identify the traits of the value type for selection of the best array type.
42
typedef
typename
43
DeduceTypeTrait < T >::type
selected_type;
44
45
// **************************************************************************
46
// The selected array type definition for the specified input type.
47
typedef
typename
48
std::conditional< std::is_same< selected_type,
49
bitfield_trait
50
>::value,
51
BitFieldArray<T,N>
,
52
std::array<T,N>
53
>::type type;
54
};
55
56
57
}
// namespace detail
58
59
}
// namespace Hg
60
61
#endif
Generated on Sat May 9 2015 21:25:05 for Alchemy by
1.8.3.1