PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
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){
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){
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){
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){
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 
static bool data_stream(size_t &ds, std::list< T > &data)
Get the size of a class std::list T.
static bool data_stream(size_t &ds, std::map< T, U > &data)
Get the size of a class std::list T.
static bool data_stream(size_t &ds, std::pair< T, U > &data)
Get the size of a class std::list T.
static bool data_stream(size_t &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.