GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/DataStream/src/data_size.h Lines: 8 8 100.0 %
Date: 2024-12-09 15:30:52 Branches: 1 1 100.0 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
#ifndef __DATA_SIZE_H__
8
#define __DATA_SIZE_H__
9
10
#include "data_stream.h"
11
12
///Get size of data
13
/**	@param data : data to be used
14
 * 	@return size of data
15
*/
16
template<typename T>
17
99
size_t data_size(T & data){
18
99
	size_t sizeVal(0lu);
19
99
	DataStream<size_t, DataStreamMode::WRITE, T>::data_stream(sizeVal, data);
20
99
	return sizeVal;
21
}
22
23
///Get size of data
24
/**	@param data : data to be used
25
 * 	@return size of data
26
*/
27
template<typename T>
28
size_t data_size(const T & data){
29
	size_t sizeVal(0lu);
30
	DataStream<size_t, DataStreamMode::WRITE, T>::data_stream(sizeVal, (T&)data);
31
	return sizeVal;
32
}
33
34
///Get size of data
35
/**	@param data : data to be used
36
 * 	@param nbElement : number of elemnt of data
37
 * 	@return size of data
38
*/
39
template<typename T>
40
1518
size_t data_size(T * data, size_t nbElement){
41
1518
	size_t sizeVal(0lu);
42
1518
	DataStream<size_t, DataStreamMode::WRITE, T>::data_stream(sizeVal, data, nbElement);
43
1518
	return sizeVal;
44
}
45
46
///Get size of data
47
/**	@param data : data to be used
48
 * 	@param nbElement : number of elemnt of data
49
 * 	@return size of data
50
*/
51
template<typename T>
52
size_t data_size(const T * data, size_t nbElement){
53
	size_t sizeVal(0lu);
54
	DataStream<size_t, DataStreamMode::WRITE, T>::data_stream(sizeVal, (T*)data, nbElement);
55
	return sizeVal;
56
}
57
58
#endif