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
Pb
offset_of.h
1
/// @file meta/offset_of.h
2
///
3
/// Calculates the offset in bytes of the type at the specified index in the
4
/// Type Container.
5
///
6
/// The MIT License(MIT)
7
/// @copyright 2014 Paul M Watt
8
// ****************************************************************************
9
#ifndef OFFSET_OF_H_INCLUDED
10
#define OFFSET_OF_H_INCLUDED
11
// Includes ******************************************************************
12
#include <Pb/size_at.h>
13
#include <
Pb/detail/offset_of.h
>
14
15
namespace
Hg
16
{
17
18
// ****************************************************************************
19
/// Calculate the pointer offset in bytes for the specified type.
20
///
21
/// One definition is required for every specialization of the array.
22
/// The array currently supports 32 index entries. The hand written version of
23
/// this function for the array is 500 lines longs. Therefore, the following
24
/// MACRO will be used to create the required definitions:
25
///
26
/// tmp_ALCHEMY_TYPELIST_OFFSETOF(...)
27
///
28
/// More details further below.
29
///
30
// Forward Declaration ********************************************************
31
template
<
size_t
Index,
32
typename
ContainerT>
33
struct
OffsetOf
34
{
35
enum
{ value = 0 };
36
};
37
38
// ****************************************************************************
39
/// The item at index 0 will always have an offset of 0.
40
///
41
template
<
typename
ContainerT>
42
struct
OffsetOf
<0, ContainerT>
43
{
44
enum
{ value = 0 };
45
};
46
47
}
// namespace Hg
48
49
// Include Type Container specific implementations.
50
#include <Pb/type_list/offset_of.h>
51
52
#endif
Generated on Sat May 9 2015 21:25:05 for Alchemy by
1.8.3.1