GCC Code Coverage Report


Directory: ./
File: tmp_project/DataStream/src/data_stream_size.cpp
Date: 2024-12-09 11:00:39
Exec Total Coverage
Lines: 69 69 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "data_stream_size.h"
8
9 ///Get the size of a type bool
10 /** @param[out] ds : size of the type
11 * @param data : data to be used
12 * @return true on success, false otherwise
13 */
14 1 bool DataStream<size_t, DataStreamMode::WRITE, bool>::data_stream(size_t & ds, bool & data){
15 1 ds += sizeof(bool);
16 1 return true;
17 }
18
19 ///Get the size of a type bool
20 /** @param[out] ds : size of the type
21 * @param data : data to be used
22 * @param nbElement : number of element of the data
23 * @return true on success, false otherwise
24 */
25 138 bool DataStream<size_t, DataStreamMode::WRITE, bool>::data_stream(size_t & ds, bool * data, size_t nbElement){
26 138 ds += sizeof(bool)*nbElement;
27 138 return true;
28 }
29
30 ///Get the size of a type char
31 /** @param[out] ds : size of the type
32 * @param data : data to be used
33 * @return true on success, false otherwise
34 */
35 142 bool DataStream<size_t, DataStreamMode::WRITE, char>::data_stream(size_t & ds, char & data){
36 142 ds += sizeof(char);
37 142 return true;
38 }
39
40 ///Get the size of a type char
41 /** @param[out] ds : size of the type
42 * @param data : data to be used
43 * @param nbElement : number of element of the data
44 * @return true on success, false otherwise
45 */
46 138 bool DataStream<size_t, DataStreamMode::WRITE, char>::data_stream(size_t & ds, char * data, size_t nbElement){
47 138 ds += sizeof(char)*nbElement;
48 138 return true;
49 }
50
51 ///Get the size of a type short
52 /** @param[out] ds : size of the type
53 * @param data : data to be used
54 * @return true on success, false otherwise
55 */
56 152 bool DataStream<size_t, DataStreamMode::WRITE, short>::data_stream(size_t & ds, short & data){
57 152 ds += sizeof(short);
58 152 return true;
59 }
60
61 ///Get the size of a type short
62 /** @param[out] ds : size of the type
63 * @param data : data to be used
64 * @param nbElement : number of element of the data
65 * @return true on success, false otherwise
66 */
67 138 bool DataStream<size_t, DataStreamMode::WRITE, short>::data_stream(size_t & ds, short * data, size_t nbElement){
68 138 ds += sizeof(short)*nbElement;
69 138 return true;
70 }
71
72 ///Get the size of a type int
73 /** @param[out] ds : size of the type
74 * @param data : data to be used
75 * @return true on success, false otherwise
76 */
77 174 bool DataStream<size_t, DataStreamMode::WRITE, int>::data_stream(size_t & ds, int & data){
78 174 ds += sizeof(int);
79 174 return true;
80 }
81
82 ///Get the size of a type int
83 /** @param[out] ds : size of the type
84 * @param data : data to be used
85 * @param nbElement : number of element of the data
86 * @return true on success, false otherwise
87 */
88 138 bool DataStream<size_t, DataStreamMode::WRITE, int>::data_stream(size_t & ds, int * data, size_t nbElement){
89 138 ds += sizeof(int)*nbElement;
90 138 return true;
91 }
92
93 ///Get the size of a type long int
94 /** @param[out] ds : size of the type
95 * @param data : data to be used
96 * @return true on success, false otherwise
97 */
98 161 bool DataStream<size_t, DataStreamMode::WRITE, long int>::data_stream(size_t & ds, long int & data){
99 161 ds += sizeof(long int);
100 161 return true;
101 }
102
103 ///Get the size of a type long int
104 /** @param[out] ds : size of the type
105 * @param data : data to be used
106 * @param nbElement : number of element of the data
107 * @return true on success, false otherwise
108 */
109 138 bool DataStream<size_t, DataStreamMode::WRITE, long int>::data_stream(size_t & ds, long int * data, size_t nbElement){
110 138 ds += sizeof(long int)*nbElement;
111 138 return true;
112 }
113
114 ///Get the size of a type unsigned char
115 /** @param[out] ds : size of the type
116 * @param data : data to be used
117 * @return true on success, false otherwise
118 */
119 142 bool DataStream<size_t, DataStreamMode::WRITE, unsigned char>::data_stream(size_t & ds, unsigned char & data){
120 142 ds += sizeof(unsigned char);
121 142 return true;
122 }
123
124 ///Get the size of a type unsigned char
125 /** @param[out] ds : size of the type
126 * @param data : data to be used
127 * @param nbElement : number of element of the data
128 * @return true on success, false otherwise
129 */
130 138 bool DataStream<size_t, DataStreamMode::WRITE, unsigned char>::data_stream(size_t & ds, unsigned char * data, size_t nbElement){
131 138 ds += sizeof(unsigned char)*nbElement;
132 138 return true;
133 }
134
135 ///Get the size of a type unsigned short
136 /** @param[out] ds : size of the type
137 * @param data : data to be used
138 * @return true on success, false otherwise
139 */
140 152 bool DataStream<size_t, DataStreamMode::WRITE, unsigned short>::data_stream(size_t & ds, unsigned short & data){
141 152 ds += sizeof(unsigned short);
142 152 return true;
143 }
144
145 ///Get the size of a type unsigned short
146 /** @param[out] ds : size of the type
147 * @param data : data to be used
148 * @param nbElement : number of element of the data
149 * @return true on success, false otherwise
150 */
151 138 bool DataStream<size_t, DataStreamMode::WRITE, unsigned short>::data_stream(size_t & ds, unsigned short * data, size_t nbElement){
152 138 ds += sizeof(unsigned short)*nbElement;
153 138 return true;
154 }
155
156 ///Get the size of a type unsigned int
157 /** @param[out] ds : size of the type
158 * @param data : data to be used
159 * @return true on success, false otherwise
160 */
161 152 bool DataStream<size_t, DataStreamMode::WRITE, unsigned int>::data_stream(size_t & ds, unsigned int & data){
162 152 ds += sizeof(unsigned int);
163 152 return true;
164 }
165
166 ///Get the size of a type unsigned int
167 /** @param[out] ds : size of the type
168 * @param data : data to be used
169 * @param nbElement : number of element of the data
170 * @return true on success, false otherwise
171 */
172 138 bool DataStream<size_t, DataStreamMode::WRITE, unsigned int>::data_stream(size_t & ds, unsigned int * data, size_t nbElement){
173 138 ds += sizeof(unsigned int)*nbElement;
174 138 return true;
175 }
176
177 ///Get the size of a type long unsigned int
178 /** @param[out] ds : size of the type
179 * @param data : data to be used
180 * @return true on success, false otherwise
181 */
182 355 bool DataStream<size_t, DataStreamMode::WRITE, long unsigned int>::data_stream(size_t & ds, long unsigned int & data){
183 355 ds += sizeof(long unsigned int);
184 355 return true;
185 }
186
187 ///Get the size of a type long unsigned int
188 /** @param[out] ds : size of the type
189 * @param data : data to be used
190 * @param nbElement : number of element of the data
191 * @return true on success, false otherwise
192 */
193 138 bool DataStream<size_t, DataStreamMode::WRITE, long unsigned int>::data_stream(size_t & ds, long unsigned int * data, size_t nbElement){
194 138 ds += sizeof(long unsigned int)*nbElement;
195 138 return true;
196 }
197
198 ///Get the size of a type float
199 /** @param[out] ds : size of the type
200 * @param data : data to be used
201 * @return true on success, false otherwise
202 */
203 1 bool DataStream<size_t, DataStreamMode::WRITE, float>::data_stream(size_t & ds, float & data){
204 1 ds += sizeof(float);
205 1 return true;
206 }
207
208 ///Get the size of a type float
209 /** @param[out] ds : size of the type
210 * @param data : data to be used
211 * @param nbElement : number of element of the data
212 * @return true on success, false otherwise
213 */
214 138 bool DataStream<size_t, DataStreamMode::WRITE, float>::data_stream(size_t & ds, float * data, size_t nbElement){
215 138 ds += sizeof(float)*nbElement;
216 138 return true;
217 }
218
219 ///Get the size of a type double
220 /** @param[out] ds : size of the type
221 * @param data : data to be used
222 * @return true on success, false otherwise
223 */
224 1 bool DataStream<size_t, DataStreamMode::WRITE, double>::data_stream(size_t & ds, double & data){
225 1 ds += sizeof(double);
226 1 return true;
227 }
228
229 ///Get the size of a type double
230 /** @param[out] ds : size of the type
231 * @param data : data to be used
232 * @param nbElement : number of element of the data
233 * @return true on success, false otherwise
234 */
235 138 bool DataStream<size_t, DataStreamMode::WRITE, double>::data_stream(size_t & ds, double * data, size_t nbElement){
236 138 ds += sizeof(double)*nbElement;
237 138 return true;
238 }
239
240 ///Get the size of a std::string
241 /** @param[out] ds : size of the std::string
242 * @param data : data to be used
243 * @return true on success, false otherwise
244 */
245 4 bool DataStream<size_t, DataStreamMode::WRITE, std::string>::data_stream(size_t & ds, std::string & data){
246 4 ds += data.size() + sizeof(size_t); //Number of char + sizeof(size_t) to store the number of char
247 4 return true;
248 }
249
250
251