GCC Code Coverage Report


Directory: ./
File: build/tmp_project/DataStream/src/data_stream_file_simple_type.cpp
Date: 2024-12-09 11:00:39
Exec Total Coverage
Lines: 190 190 100.0%
Branches: 90 130 69.2%

Line Branch Exec Source
1
2 /***************************************
3 Auteur : Pierre Aubert
4 Mail : pierre.aubert@lapp.in2p3.fr
5 Licence : CeCILL-C
6 ****************************************/
7
8
9 #include "data_stream_file_simple_type.h"
10
11 ///Read the data char in the file
12 /** @param[out] ds : file to be read
13 * @param[out] data : data to be set
14 * @return true on success, false otherwise
15 */
16 663 bool DataStream<FILE*, DataStreamMode::READ, char>::data_stream(FILE* & ds, char & data){
17 663 return fread((void*)&data, sizeof(char), 1lu, ds) == 1lu;
18 }
19
20 ///Read the data char in the file
21 /** @param[out] ds : file to be read
22 * @param[out] data : data to be set
23 * @param nbElement : number of element of this data
24 * @return true on success, false otherwise
25 */
26 98 bool DataStream<FILE*, DataStreamMode::READ, char>::data_stream(FILE* & ds, char * data, size_t nbElement){
27 98 return fread((void*)data, sizeof(char), nbElement, ds) == nbElement;
28 }
29
30 ///Read the data std::vector of char in the file
31 /** @param[out] ds : file to be read
32 * @param[out] data : data to be set
33 * @return true on success, false otherwise
34 */
35 121 bool DataStream<FILE*, DataStreamMode::READ, std::vector<char> >::data_stream(FILE* & ds, std::vector<char> & data){
36 121 size_t nbElement(data.size());
37
1/1
✓ Branch 1 taken 121 times.
121 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
38
2/4
✓ Branch 0 taken 121 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 121 times.
121 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
39
1/1
✓ Branch 1 taken 121 times.
121 data.resize(nbElement);
40
1/1
✓ Branch 2 taken 121 times.
121 return fread((void*)data.data(), sizeof(char), nbElement, ds) == nbElement;
41 }
42
43 ///Save the data char in the file
44 /** @param[out] ds : file to be written
45 * @param data : data to be saved in the file
46 * @return true on success, false otherwise
47 */
48 663 bool DataStream<FILE*, DataStreamMode::WRITE, char>::data_stream(FILE* & ds, char & data){
49 663 return fwrite((const void*)&data, sizeof(char), 1lu, ds) == 1lu;
50 }
51
52 ///Save the data char in the file
53 /** @param[out] ds : file to be written
54 * @param data : data to be saved in the file
55 * @param nbElement : number of element of this data
56 * @return true on success, false otherwise
57 */
58 98 bool DataStream<FILE*, DataStreamMode::WRITE, char>::data_stream(FILE* & ds, char * data, size_t nbElement){
59 98 return fwrite((const void*)data, sizeof(char), nbElement, ds) == nbElement;
60 }
61
62 ///Save the data std::vector of data in the file
63 /** @param[out] ds : file to be written
64 * @param data : data to be saved in the file
65 * @return true on success, false otherwise
66 */
67 182 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<char> >::data_stream(FILE* & ds, std::vector<char> & data){
68 182 size_t nbElement(data.size());
69
1/1
✓ Branch 1 taken 182 times.
182 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
70
2/4
✓ Branch 0 taken 182 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 182 times.
182 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
71
1/1
✓ Branch 2 taken 182 times.
182 return fwrite((const void*)data.data(), sizeof(char), nbElement, ds) == nbElement;
72 }
73
74
75 ///Read the data short in the file
76 /** @param[out] ds : file to be read
77 * @param[out] data : data to be set
78 * @return true on success, false otherwise
79 */
80 663 bool DataStream<FILE*, DataStreamMode::READ, short>::data_stream(FILE* & ds, short & data){
81 663 return fread((void*)&data, sizeof(short), 1lu, ds) == 1lu;
82 }
83
84 ///Read the data short in the file
85 /** @param[out] ds : file to be read
86 * @param[out] data : data to be set
87 * @param nbElement : number of element of this data
88 * @return true on success, false otherwise
89 */
90 98 bool DataStream<FILE*, DataStreamMode::READ, short>::data_stream(FILE* & ds, short * data, size_t nbElement){
91 98 return fread((void*)data, sizeof(short), nbElement, ds) == nbElement;
92 }
93
94 ///Read the data std::vector of short in the file
95 /** @param[out] ds : file to be read
96 * @param[out] data : data to be set
97 * @return true on success, false otherwise
98 */
99 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<short> >::data_stream(FILE* & ds, std::vector<short> & data){
100 1 size_t nbElement(data.size());
101
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
102
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
103
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
104
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(short), nbElement, ds) == nbElement;
105 }
106
107 ///Save the data short in the file
108 /** @param[out] ds : file to be written
109 * @param data : data to be saved in the file
110 * @return true on success, false otherwise
111 */
112 663 bool DataStream<FILE*, DataStreamMode::WRITE, short>::data_stream(FILE* & ds, short & data){
113 663 return fwrite((const void*)&data, sizeof(short), 1lu, ds) == 1lu;
114 }
115
116 ///Save the data short in the file
117 /** @param[out] ds : file to be written
118 * @param data : data to be saved in the file
119 * @param nbElement : number of element of this data
120 * @return true on success, false otherwise
121 */
122 98 bool DataStream<FILE*, DataStreamMode::WRITE, short>::data_stream(FILE* & ds, short * data, size_t nbElement){
123 98 return fwrite((const void*)data, sizeof(short), nbElement, ds) == nbElement;
124 }
125
126 ///Save the data std::vector of data in the file
127 /** @param[out] ds : file to be written
128 * @param data : data to be saved in the file
129 * @return true on success, false otherwise
130 */
131 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<short> >::data_stream(FILE* & ds, std::vector<short> & data){
132 1 size_t nbElement(data.size());
133
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
134
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
135
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(short), nbElement, ds) == nbElement;
136 }
137
138
139 ///Read the data int in the file
140 /** @param[out] ds : file to be read
141 * @param[out] data : data to be set
142 * @return true on success, false otherwise
143 */
144 664 bool DataStream<FILE*, DataStreamMode::READ, int>::data_stream(FILE* & ds, int & data){
145 664 return fread((void*)&data, sizeof(int), 1lu, ds) == 1lu;
146 }
147
148 ///Read the data int in the file
149 /** @param[out] ds : file to be read
150 * @param[out] data : data to be set
151 * @param nbElement : number of element of this data
152 * @return true on success, false otherwise
153 */
154 98 bool DataStream<FILE*, DataStreamMode::READ, int>::data_stream(FILE* & ds, int * data, size_t nbElement){
155 98 return fread((void*)data, sizeof(int), nbElement, ds) == nbElement;
156 }
157
158 ///Read the data std::vector of int in the file
159 /** @param[out] ds : file to be read
160 * @param[out] data : data to be set
161 * @return true on success, false otherwise
162 */
163 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<int> >::data_stream(FILE* & ds, std::vector<int> & data){
164 1 size_t nbElement(data.size());
165
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
166
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
167
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
168
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(int), nbElement, ds) == nbElement;
169 }
170
171 ///Save the data int in the file
172 /** @param[out] ds : file to be written
173 * @param data : data to be saved in the file
174 * @return true on success, false otherwise
175 */
176 664 bool DataStream<FILE*, DataStreamMode::WRITE, int>::data_stream(FILE* & ds, int & data){
177 664 return fwrite((const void*)&data, sizeof(int), 1lu, ds) == 1lu;
178 }
179
180 ///Save the data int in the file
181 /** @param[out] ds : file to be written
182 * @param data : data to be saved in the file
183 * @param nbElement : number of element of this data
184 * @return true on success, false otherwise
185 */
186 98 bool DataStream<FILE*, DataStreamMode::WRITE, int>::data_stream(FILE* & ds, int * data, size_t nbElement){
187 98 return fwrite((const void*)data, sizeof(int), nbElement, ds) == nbElement;
188 }
189
190 ///Save the data std::vector of data in the file
191 /** @param[out] ds : file to be written
192 * @param data : data to be saved in the file
193 * @return true on success, false otherwise
194 */
195 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<int> >::data_stream(FILE* & ds, std::vector<int> & data){
196 1 size_t nbElement(data.size());
197
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
198
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
199
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(int), nbElement, ds) == nbElement;
200 }
201
202
203 ///Read the data long in the file
204 /** @param[out] ds : file to be read
205 * @param[out] data : data to be set
206 * @return true on success, false otherwise
207 */
208 663 bool DataStream<FILE*, DataStreamMode::READ, long>::data_stream(FILE* & ds, long & data){
209 663 return fread((void*)&data, sizeof(long), 1lu, ds) == 1lu;
210 }
211
212 ///Read the data long in the file
213 /** @param[out] ds : file to be read
214 * @param[out] data : data to be set
215 * @param nbElement : number of element of this data
216 * @return true on success, false otherwise
217 */
218 98 bool DataStream<FILE*, DataStreamMode::READ, long>::data_stream(FILE* & ds, long * data, size_t nbElement){
219 98 return fread((void*)data, sizeof(long), nbElement, ds) == nbElement;
220 }
221
222 ///Read the data std::vector of long in the file
223 /** @param[out] ds : file to be read
224 * @param[out] data : data to be set
225 * @return true on success, false otherwise
226 */
227 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<long> >::data_stream(FILE* & ds, std::vector<long> & data){
228 1 size_t nbElement(data.size());
229
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
230
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
231
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
232
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(long), nbElement, ds) == nbElement;
233 }
234
235 ///Save the data long in the file
236 /** @param[out] ds : file to be written
237 * @param data : data to be saved in the file
238 * @return true on success, false otherwise
239 */
240 663 bool DataStream<FILE*, DataStreamMode::WRITE, long>::data_stream(FILE* & ds, long & data){
241 663 return fwrite((const void*)&data, sizeof(long), 1lu, ds) == 1lu;
242 }
243
244 ///Save the data long in the file
245 /** @param[out] ds : file to be written
246 * @param data : data to be saved in the file
247 * @param nbElement : number of element of this data
248 * @return true on success, false otherwise
249 */
250 98 bool DataStream<FILE*, DataStreamMode::WRITE, long>::data_stream(FILE* & ds, long * data, size_t nbElement){
251 98 return fwrite((const void*)data, sizeof(long), nbElement, ds) == nbElement;
252 }
253
254 ///Save the data std::vector of data in the file
255 /** @param[out] ds : file to be written
256 * @param data : data to be saved in the file
257 * @return true on success, false otherwise
258 */
259 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<long> >::data_stream(FILE* & ds, std::vector<long> & data){
260 1 size_t nbElement(data.size());
261
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
262
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
263
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(long), nbElement, ds) == nbElement;
264 }
265
266
267 ///Read the data unsigned char in the file
268 /** @param[out] ds : file to be read
269 * @param[out] data : data to be set
270 * @return true on success, false otherwise
271 */
272 663 bool DataStream<FILE*, DataStreamMode::READ, unsigned char>::data_stream(FILE* & ds, unsigned char & data){
273 663 return fread((void*)&data, sizeof(unsigned char), 1lu, ds) == 1lu;
274 }
275
276 ///Read the data unsigned char in the file
277 /** @param[out] ds : file to be read
278 * @param[out] data : data to be set
279 * @param nbElement : number of element of this data
280 * @return true on success, false otherwise
281 */
282 98 bool DataStream<FILE*, DataStreamMode::READ, unsigned char>::data_stream(FILE* & ds, unsigned char * data, size_t nbElement){
283 98 return fread((void*)data, sizeof(unsigned char), nbElement, ds) == nbElement;
284 }
285
286 ///Read the data std::vector of unsigned char in the file
287 /** @param[out] ds : file to be read
288 * @param[out] data : data to be set
289 * @return true on success, false otherwise
290 */
291 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<unsigned char> >::data_stream(FILE* & ds, std::vector<unsigned char> & data){
292 1 size_t nbElement(data.size());
293
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
294
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
295
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
296
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(unsigned char), nbElement, ds) == nbElement;
297 }
298
299 ///Save the data unsigned char in the file
300 /** @param[out] ds : file to be written
301 * @param data : data to be saved in the file
302 * @return true on success, false otherwise
303 */
304 663 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned char>::data_stream(FILE* & ds, unsigned char & data){
305 663 return fwrite((const void*)&data, sizeof(unsigned char), 1lu, ds) == 1lu;
306 }
307
308 ///Save the data unsigned char in the file
309 /** @param[out] ds : file to be written
310 * @param data : data to be saved in the file
311 * @param nbElement : number of element of this data
312 * @return true on success, false otherwise
313 */
314 98 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned char>::data_stream(FILE* & ds, unsigned char * data, size_t nbElement){
315 98 return fwrite((const void*)data, sizeof(unsigned char), nbElement, ds) == nbElement;
316 }
317
318 ///Save the data std::vector of data in the file
319 /** @param[out] ds : file to be written
320 * @param data : data to be saved in the file
321 * @return true on success, false otherwise
322 */
323 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<unsigned char> >::data_stream(FILE* & ds, std::vector<unsigned char> & data){
324 1 size_t nbElement(data.size());
325
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
326
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
327
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(unsigned char), nbElement, ds) == nbElement;
328 }
329
330
331 ///Read the data unsigned short in the file
332 /** @param[out] ds : file to be read
333 * @param[out] data : data to be set
334 * @return true on success, false otherwise
335 */
336 663 bool DataStream<FILE*, DataStreamMode::READ, unsigned short>::data_stream(FILE* & ds, unsigned short & data){
337 663 return fread((void*)&data, sizeof(unsigned short), 1lu, ds) == 1lu;
338 }
339
340 ///Read the data unsigned short in the file
341 /** @param[out] ds : file to be read
342 * @param[out] data : data to be set
343 * @param nbElement : number of element of this data
344 * @return true on success, false otherwise
345 */
346 98 bool DataStream<FILE*, DataStreamMode::READ, unsigned short>::data_stream(FILE* & ds, unsigned short * data, size_t nbElement){
347 98 return fread((void*)data, sizeof(unsigned short), nbElement, ds) == nbElement;
348 }
349
350 ///Read the data std::vector of unsigned short in the file
351 /** @param[out] ds : file to be read
352 * @param[out] data : data to be set
353 * @return true on success, false otherwise
354 */
355 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<unsigned short> >::data_stream(FILE* & ds, std::vector<unsigned short> & data){
356 1 size_t nbElement(data.size());
357
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
358
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
359
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
360
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(unsigned short), nbElement, ds) == nbElement;
361 }
362
363 ///Save the data unsigned short in the file
364 /** @param[out] ds : file to be written
365 * @param data : data to be saved in the file
366 * @return true on success, false otherwise
367 */
368 663 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned short>::data_stream(FILE* & ds, unsigned short & data){
369 663 return fwrite((const void*)&data, sizeof(unsigned short), 1lu, ds) == 1lu;
370 }
371
372 ///Save the data unsigned short in the file
373 /** @param[out] ds : file to be written
374 * @param data : data to be saved in the file
375 * @param nbElement : number of element of this data
376 * @return true on success, false otherwise
377 */
378 98 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned short>::data_stream(FILE* & ds, unsigned short * data, size_t nbElement){
379 98 return fwrite((const void*)data, sizeof(unsigned short), nbElement, ds) == nbElement;
380 }
381
382 ///Save the data std::vector of data in the file
383 /** @param[out] ds : file to be written
384 * @param data : data to be saved in the file
385 * @return true on success, false otherwise
386 */
387 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<unsigned short> >::data_stream(FILE* & ds, std::vector<unsigned short> & data){
388 1 size_t nbElement(data.size());
389
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
390
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
391
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(unsigned short), nbElement, ds) == nbElement;
392 }
393
394
395 ///Read the data unsigned int in the file
396 /** @param[out] ds : file to be read
397 * @param[out] data : data to be set
398 * @return true on success, false otherwise
399 */
400 663 bool DataStream<FILE*, DataStreamMode::READ, unsigned int>::data_stream(FILE* & ds, unsigned int & data){
401 663 return fread((void*)&data, sizeof(unsigned int), 1lu, ds) == 1lu;
402 }
403
404 ///Read the data unsigned int in the file
405 /** @param[out] ds : file to be read
406 * @param[out] data : data to be set
407 * @param nbElement : number of element of this data
408 * @return true on success, false otherwise
409 */
410 98 bool DataStream<FILE*, DataStreamMode::READ, unsigned int>::data_stream(FILE* & ds, unsigned int * data, size_t nbElement){
411 98 return fread((void*)data, sizeof(unsigned int), nbElement, ds) == nbElement;
412 }
413
414 ///Read the data std::vector of unsigned int in the file
415 /** @param[out] ds : file to be read
416 * @param[out] data : data to be set
417 * @return true on success, false otherwise
418 */
419 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<unsigned int> >::data_stream(FILE* & ds, std::vector<unsigned int> & data){
420 1 size_t nbElement(data.size());
421
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
422
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
423
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
424
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(unsigned int), nbElement, ds) == nbElement;
425 }
426
427 ///Save the data unsigned int in the file
428 /** @param[out] ds : file to be written
429 * @param data : data to be saved in the file
430 * @return true on success, false otherwise
431 */
432 663 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned int>::data_stream(FILE* & ds, unsigned int & data){
433 663 return fwrite((const void*)&data, sizeof(unsigned int), 1lu, ds) == 1lu;
434 }
435
436 ///Save the data unsigned int in the file
437 /** @param[out] ds : file to be written
438 * @param data : data to be saved in the file
439 * @param nbElement : number of element of this data
440 * @return true on success, false otherwise
441 */
442 98 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned int>::data_stream(FILE* & ds, unsigned int * data, size_t nbElement){
443 98 return fwrite((const void*)data, sizeof(unsigned int), nbElement, ds) == nbElement;
444 }
445
446 ///Save the data std::vector of data in the file
447 /** @param[out] ds : file to be written
448 * @param data : data to be saved in the file
449 * @return true on success, false otherwise
450 */
451 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<unsigned int> >::data_stream(FILE* & ds, std::vector<unsigned int> & data){
452 1 size_t nbElement(data.size());
453
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
454
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
455
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(unsigned int), nbElement, ds) == nbElement;
456 }
457
458
459 ///Read the data unsigned long in the file
460 /** @param[out] ds : file to be read
461 * @param[out] data : data to be set
462 * @return true on success, false otherwise
463 */
464 1399 bool DataStream<FILE*, DataStreamMode::READ, unsigned long>::data_stream(FILE* & ds, unsigned long & data){
465 1399 return fread((void*)&data, sizeof(unsigned long), 1lu, ds) == 1lu;
466 }
467
468 ///Read the data unsigned long in the file
469 /** @param[out] ds : file to be read
470 * @param[out] data : data to be set
471 * @param nbElement : number of element of this data
472 * @return true on success, false otherwise
473 */
474 98 bool DataStream<FILE*, DataStreamMode::READ, unsigned long>::data_stream(FILE* & ds, unsigned long * data, size_t nbElement){
475 98 return fread((void*)data, sizeof(unsigned long), nbElement, ds) == nbElement;
476 }
477
478 ///Read the data std::vector of unsigned long in the file
479 /** @param[out] ds : file to be read
480 * @param[out] data : data to be set
481 * @return true on success, false otherwise
482 */
483 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<unsigned long> >::data_stream(FILE* & ds, std::vector<unsigned long> & data){
484 1 size_t nbElement(data.size());
485
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
486
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
487
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
488
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(unsigned long), nbElement, ds) == nbElement;
489 }
490
491 ///Save the data unsigned long in the file
492 /** @param[out] ds : file to be written
493 * @param data : data to be saved in the file
494 * @return true on success, false otherwise
495 */
496 1577 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned long>::data_stream(FILE* & ds, unsigned long & data){
497 1577 return fwrite((const void*)&data, sizeof(unsigned long), 1lu, ds) == 1lu;
498 }
499
500 ///Save the data unsigned long in the file
501 /** @param[out] ds : file to be written
502 * @param data : data to be saved in the file
503 * @param nbElement : number of element of this data
504 * @return true on success, false otherwise
505 */
506 98 bool DataStream<FILE*, DataStreamMode::WRITE, unsigned long>::data_stream(FILE* & ds, unsigned long * data, size_t nbElement){
507 98 return fwrite((const void*)data, sizeof(unsigned long), nbElement, ds) == nbElement;
508 }
509
510 ///Save the data std::vector of data in the file
511 /** @param[out] ds : file to be written
512 * @param data : data to be saved in the file
513 * @return true on success, false otherwise
514 */
515 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<unsigned long> >::data_stream(FILE* & ds, std::vector<unsigned long> & data){
516 1 size_t nbElement(data.size());
517
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
518
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
519
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(unsigned long), nbElement, ds) == nbElement;
520 }
521
522
523 ///Read the data float in the file
524 /** @param[out] ds : file to be read
525 * @param[out] data : data to be set
526 * @return true on success, false otherwise
527 */
528 664 bool DataStream<FILE*, DataStreamMode::READ, float>::data_stream(FILE* & ds, float & data){
529 664 return fread((void*)&data, sizeof(float), 1lu, ds) == 1lu;
530 }
531
532 ///Read the data float in the file
533 /** @param[out] ds : file to be read
534 * @param[out] data : data to be set
535 * @param nbElement : number of element of this data
536 * @return true on success, false otherwise
537 */
538 98 bool DataStream<FILE*, DataStreamMode::READ, float>::data_stream(FILE* & ds, float * data, size_t nbElement){
539 98 return fread((void*)data, sizeof(float), nbElement, ds) == nbElement;
540 }
541
542 ///Read the data std::vector of float in the file
543 /** @param[out] ds : file to be read
544 * @param[out] data : data to be set
545 * @return true on success, false otherwise
546 */
547 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<float> >::data_stream(FILE* & ds, std::vector<float> & data){
548 1 size_t nbElement(data.size());
549
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
550
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
551
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
552
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(float), nbElement, ds) == nbElement;
553 }
554
555 ///Save the data float in the file
556 /** @param[out] ds : file to be written
557 * @param data : data to be saved in the file
558 * @return true on success, false otherwise
559 */
560 664 bool DataStream<FILE*, DataStreamMode::WRITE, float>::data_stream(FILE* & ds, float & data){
561 664 return fwrite((const void*)&data, sizeof(float), 1lu, ds) == 1lu;
562 }
563
564 ///Save the data float in the file
565 /** @param[out] ds : file to be written
566 * @param data : data to be saved in the file
567 * @param nbElement : number of element of this data
568 * @return true on success, false otherwise
569 */
570 98 bool DataStream<FILE*, DataStreamMode::WRITE, float>::data_stream(FILE* & ds, float * data, size_t nbElement){
571 98 return fwrite((const void*)data, sizeof(float), nbElement, ds) == nbElement;
572 }
573
574 ///Save the data std::vector of data in the file
575 /** @param[out] ds : file to be written
576 * @param data : data to be saved in the file
577 * @return true on success, false otherwise
578 */
579 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<float> >::data_stream(FILE* & ds, std::vector<float> & data){
580 1 size_t nbElement(data.size());
581
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
582
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
583
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(float), nbElement, ds) == nbElement;
584 }
585
586
587 ///Read the data double in the file
588 /** @param[out] ds : file to be read
589 * @param[out] data : data to be set
590 * @return true on success, false otherwise
591 */
592 662 bool DataStream<FILE*, DataStreamMode::READ, double>::data_stream(FILE* & ds, double & data){
593 662 return fread((void*)&data, sizeof(double), 1lu, ds) == 1lu;
594 }
595
596 ///Read the data double in the file
597 /** @param[out] ds : file to be read
598 * @param[out] data : data to be set
599 * @param nbElement : number of element of this data
600 * @return true on success, false otherwise
601 */
602 98 bool DataStream<FILE*, DataStreamMode::READ, double>::data_stream(FILE* & ds, double * data, size_t nbElement){
603 98 return fread((void*)data, sizeof(double), nbElement, ds) == nbElement;
604 }
605
606 ///Read the data std::vector of double in the file
607 /** @param[out] ds : file to be read
608 * @param[out] data : data to be set
609 * @return true on success, false otherwise
610 */
611 1 bool DataStream<FILE*, DataStreamMode::READ, std::vector<double> >::data_stream(FILE* & ds, std::vector<double> & data){
612 1 size_t nbElement(data.size());
613
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::READ, size_t>::data_stream(ds, nbElement);
614
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
615
1/1
✓ Branch 1 taken 1 times.
1 data.resize(nbElement);
616
1/1
✓ Branch 2 taken 1 times.
1 return fread((void*)data.data(), sizeof(double), nbElement, ds) == nbElement;
617 }
618
619 ///Save the data double in the file
620 /** @param[out] ds : file to be written
621 * @param data : data to be saved in the file
622 * @return true on success, false otherwise
623 */
624 662 bool DataStream<FILE*, DataStreamMode::WRITE, double>::data_stream(FILE* & ds, double & data){
625 662 return fwrite((const void*)&data, sizeof(double), 1lu, ds) == 1lu;
626 }
627
628 ///Save the data double in the file
629 /** @param[out] ds : file to be written
630 * @param data : data to be saved in the file
631 * @param nbElement : number of element of this data
632 * @return true on success, false otherwise
633 */
634 98 bool DataStream<FILE*, DataStreamMode::WRITE, double>::data_stream(FILE* & ds, double * data, size_t nbElement){
635 98 return fwrite((const void*)data, sizeof(double), nbElement, ds) == nbElement;
636 }
637
638 ///Save the data std::vector of data in the file
639 /** @param[out] ds : file to be written
640 * @param data : data to be saved in the file
641 * @return true on success, false otherwise
642 */
643 1 bool DataStream<FILE*, DataStreamMode::WRITE, std::vector<double> >::data_stream(FILE* & ds, std::vector<double> & data){
644 1 size_t nbElement(data.size());
645
1/1
✓ Branch 1 taken 1 times.
1 bool b = DataStream<FILE*, DataStreamMode::WRITE, size_t>::data_stream(ds, nbElement);
646
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1 if(nbElement == 0lu || !b){return b;} //If there is no element, quit now
647
1/1
✓ Branch 2 taken 1 times.
1 return fwrite((const void*)data.data(), sizeof(double), nbElement, ds) == nbElement;
648 }
649
650
651
652
653