PhoenixDataStream
2.1.0
PhoenixDataStream is a 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 : LGPL-3.0-only
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, T* >{
16
20
static
bool
data_stream
(
size_t
& ds, T* & data){
21
ds +=
sizeof
(T*);
22
return
true
;
23
}
24
};
25
27
template
<
typename
T>
28
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::vector<T> >{
30
34
static
bool
data_stream
(
size_t
& ds, std::vector<T> & data){
35
ds +=
sizeof
(size_t);
36
for
(
typename
std::vector<T>::iterator it(data.begin()); it != data.end(); ++it){
37
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, *it);
38
}
39
return
true
;
40
}
41
};
42
44
template
<
typename
T>
45
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::list<T> >{
47
51
static
bool
data_stream
(
size_t
& ds, std::list<T> & data){
52
ds +=
sizeof
(size_t);
53
for
(
typename
std::list<T>::iterator it(data.begin()); it != data.end(); ++it){
54
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, *it);
55
}
56
return
true
;
57
}
58
};
59
61
template
<
typename
T,
typename
U>
62
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::map<T, U> >{
64
68
static
bool
data_stream
(
size_t
& ds, std::map<T, U> & data){
69
ds +=
sizeof
(size_t);
70
for
(
typename
std::map<T, U>::iterator it(data.begin()); it != data.end(); ++it){
71
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, (T&)it->first);
72
DataStream<size_t, DataStreamMode::WRITE, U>::data_stream
(ds, it->second);
73
}
74
return
true
;
75
}
76
};
77
79
template
<
typename
T,
typename
U>
80
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::pair<T, U> >{
82
86
static
bool
data_stream
(
size_t
& ds, std::pair<T, U> & data){
87
DataStream<size_t, DataStreamMode::WRITE, T>::data_stream
(ds, (T&)data.first);
88
DataStream<size_t, DataStreamMode::WRITE, U>::data_stream
(ds, data.second);
89
return
true
;
90
}
91
};
92
94
template
<>
95
struct
DataStream
<size_t,
DataStreamMode
::WRITE, bool>{
96
static
bool
data_stream
(
size_t
& ds,
bool
& data);
97
static
bool
data_stream
(
size_t
& ds,
bool
* data,
size_t
nbElement);
98
};
99
101
template
<>
102
struct
DataStream
<size_t,
DataStreamMode
::WRITE, std::string>{
103
static
bool
data_stream
(
size_t
& ds, std::string & data);
104
};
105
106
#endif
107
data_stream_include.h
DataStreamMode
Definition
data_stream_include.h:18
DataStream< size_t, DataStreamMode::WRITE, T * >::data_stream
static bool data_stream(size_t &ds, T *&data)
Get the size of a class T*.
Definition
data_stream_size.h:20
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:51
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:68
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:86
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:34
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