PhoenixDataStream
1.3.0
Framework to save/load/serialize/deserialize data
Toggle main menu visibility
Loading...
Searching...
No Matches
data_stream_size.h
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : CeCILL-C
5
****************************************/
6
7
#ifndef __DATA_STREAM_SIZE_H__
8
#define __DATA_STREAM_SIZE_H__
9
10
#include "
data_stream_include.h
"
11
13
template
<
typename
T>
14
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::vector<T> >{
16
20
static
bool
data_stream
(
size_t
& ds, std::vector<T> & data){
21
ds +=
sizeof
(size_t);
22
for
(
typename
std::vector<T>::iterator it(data.begin()); it != data.end(); ++it){
23
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, *it);
24
}
25
return
true
;
26
}
27
};
28
30
template
<
typename
T>
31
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::list<T> >{
33
37
static
bool
data_stream
(
size_t
& ds, std::list<T> & data){
38
ds +=
sizeof
(size_t);
39
for
(
typename
std::list<T>::iterator it(data.begin()); it != data.end(); ++it){
40
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, *it);
41
}
42
return
true
;
43
}
44
};
45
47
template
<
typename
T,
typename
U>
48
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::map<T, U> >{
50
54
static
bool
data_stream
(
size_t
& ds, std::map<T, U> & data){
55
ds +=
sizeof
(size_t);
56
for
(
typename
std::map<T, U>::iterator it(data.begin()); it != data.end(); ++it){
57
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, (T&)it->first);
58
DataStream<size_t, DataStreamMode::WRITE, U>::data_stream
(ds, it->second);
59
}
60
return
true
;
61
}
62
};
63
65
template
<
typename
T,
typename
U>
66
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::pair<T, U> >{
68
72
static
bool
data_stream
(
size_t
& ds, std::pair<T, U> & data){
73
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, (T&)data.first);
74
DataStream<size_t, DataStreamMode::WRITE, U>::data_stream
(ds, data.second);
75
return
true
;
76
}
77
};
78
80
template
<>
81
struct
DataStream
<size_t,
DataStreamMode
::WRITE, bool>{
82
static
bool
data_stream
(
size_t
& ds,
bool
& data);
83
static
bool
data_stream
(
size_t
& ds,
bool
* data,
size_t
nbElement);
84
};
85
87
template
<>
88
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::string>{
89
static
bool
data_stream
(
size_t
& ds, std::string & data);
90
};
91
92
#endif
93
data_stream_include.h
DataStreamMode
Definition
data_stream_include.h:18
DataStream< size_t, DataStreamMode::WRITE, std::list< T > >::data_stream
static bool data_stream(size_t &ds, std::list< T > &data)
Get the size of a class std::list T.
Definition
data_stream_size.h:37
DataStream< size_t, DataStreamMode::WRITE, std::map< T, U > >::data_stream
static bool data_stream(size_t &ds, std::map< T, U > &data)
Get the size of a class std::list T.
Definition
data_stream_size.h:54
DataStream< size_t, DataStreamMode::WRITE, std::pair< T, U > >::data_stream
static bool data_stream(size_t &ds, std::pair< T, U > &data)
Get the size of a class std::list T.
Definition
data_stream_size.h:72
DataStream< size_t, DataStreamMode::WRITE, std::vector< T > >::data_stream
static bool data_stream(size_t &ds, std::vector< T > &data)
Get the size of a class std::vector T.
Definition
data_stream_size.h:20
DataStream
Generic DataStream class.
Definition
data_stream_include.h:32
DataStream::data_stream
static bool data_stream(Stream &ds, T &data)
Dummy function to catch if a type is not specialised.
Definition
data_stream_include.h:37
src
data_stream_size.h
Generated by
1.17.0