PhoenixDataStream  1.0.0
Framework to save/load/serialize/deserialize data
Loading...
Searching...
No Matches
data_stream_write_message.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_WRITE_MESSAGE_H__
8#define __DATA_STREAM_WRITE_MESSAGE_H__
9
10#include "data_stream_include.h"
11
12
14template<typename T>
15struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::vector<T> >{
17
21 static bool data_stream(DataStreamIter & ds, std::vector<T> & data){
22 //Save the size of the data
23 size_t nbElement(data.size());
25 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
26 for(typename std::vector<T>::iterator it(data.begin()); it != data.end(); ++it){
28 }
29 return b;
30 }
31};
32
34template<typename T>
35struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::list<T> >{
37
41 static bool data_stream(DataStreamIter & ds, std::list<T> & data){
42 //Save the size of the data
43 size_t nbElement(data.size());
45 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
46 for(typename std::list<T>::iterator it(data.begin()); it != data.end(); ++it){
48 }
49 return b;
50 }
51};
52
54template<typename T, typename U>
55struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::map<T, U> >{
57
61 static bool data_stream(DataStreamIter & ds, std::map<T, U> & data){
62 //Save the size of the data
63 size_t nbElement(data.size());
65 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
66 for(typename std::map<T, U>::iterator it(data.begin()); it != data.end(); ++it){
69 }
70 return b;
71 }
72};
73
75template<typename T, typename U>
76struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::pair<T, U> >{
78
82 static bool data_stream(DataStreamIter & ds, std::pair<T, U> & data){
85 return b;
86 }
87};
88
89
90
91#endif
92
93
DataStreamType * DataStreamIter
static bool data_stream(DataStreamIter &ds, std::list< T > &data)
Get the size of a class std::list T.
static bool data_stream(DataStreamIter &ds, std::map< T, U > &data)
Get the size of a class std::list T.
static bool data_stream(DataStreamIter &ds, std::pair< T, U > &data)
Get the size of a class std::list T.
static bool data_stream(DataStreamIter &ds, std::vector< T > &data)
Get the size of a class std::vector T.
Generic DataStream class.
static bool data_stream(Stream &ds, T &data)
Dummy function to catch if a type is not specialised.