framework
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
framework
serializable
containers
bit_field.hpp
Go to the documentation of this file.
1
// Copyright (C) 2012 iwg molw5
2
// For conditions of distribution and use, see copyright notice in COPYING
3
13
#pragma once
14
15
#include <
framework/serializable/base_types.hpp
>
16
#include <
framework/serializable/streams/bit_stream.hpp
>
17
18
namespace
framework
19
{
20
namespace
serializable
21
{
26
template
<
typename
Block,
typename
... Specification>
27
struct
bit_field
:
public
container_type
<
28
pack_container <Specification...>,
29
pack_container <Specification...>,
30
false>
31
{
32
};
33
41
template
<
42
typename
Input,
43
typename
Output,
44
typename
Block,
45
typename
... Specification>
46
bool
read_dispatch
(
47
bit_field <Block, Specification...>
*,
48
Input& in, Output& out)
49
{
50
bit_stream <Input, Block>
wrapper(in);
51
return
dispatch_read
<
alias
<Specification...>> (wrapper, out);
52
}
53
61
template
<
62
typename
Input,
63
typename
Output,
64
typename
Block,
65
typename
... Specification>
66
bool
write_dispatch
(
67
bit_field <Block, Specification...>
*,
68
Input
const
& in, Output& out)
69
{
70
bit_stream <Output, Block>
wrapper(out);
71
if
(!
dispatch_write
<
alias <Specification...>
> (in, wrapper))
72
return
false
;
73
74
if
(!wrapper.
flush
())
75
return
false
;
76
77
return
true
;
78
}
79
}
80
}
Generated on Wed Apr 10 2013 20:49:42 for framework by
1.8.3.1-20130402