PhoenixDataStream  2.1.0
PhoenixDataStream is a 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 : LGPL-3.0-only
5****************************************/
6
7#ifndef __DATA_STREAM_WRITE_MESSAGE_H__
8#define __DATA_STREAM_WRITE_MESSAGE_H__
9
10#include "data_stream_include.h"
11
13template<typename T>
16
20 static bool data_stream(DataStreamIter & ds, T* & data){
21 size_t value = (size_t)data;
23 return b;
24 }
25};
26
28template<typename T>
29struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::vector<T> >{
31
35 static bool data_stream(DataStreamIter & ds, std::vector<T> & data){
36 //Save the size of the data
37 size_t nbElement(data.size());
39 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
40 for(typename std::vector<T>::iterator it(data.begin()); it != data.end(); ++it){
42 }
43 return b;
44 }
45};
46
48template<typename T>
49struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::list<T> >{
51
55 static bool data_stream(DataStreamIter & ds, std::list<T> & data){
56 //Save the size of the data
57 size_t nbElement(data.size());
59 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
60 for(typename std::list<T>::iterator it(data.begin()); it != data.end(); ++it){
62 }
63 return b;
64 }
65};
66
68template<typename T, typename U>
69struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::map<T, U> >{
71
75 static bool data_stream(DataStreamIter & ds, std::map<T, U> & data){
76 //Save the size of the data
77 size_t nbElement(data.size());
79 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
80 for(typename std::map<T, U>::iterator it(data.begin()); it != data.end(); ++it){
83 }
84 return b;
85 }
86};
87
89template<typename T, typename U>
90struct DataStream<DataStreamIter, DataStreamMode::WRITE, std::pair<T, U> >{
92
96 static bool data_stream(DataStreamIter & ds, std::pair<T, U> & data){
99 return b;
100 }
101};
102
103
104
105#endif
106
107
DataStreamType * DataStreamIter
static bool data_stream(DataStreamIter &ds, T *&data)
Write a pointer address in a message.
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.