GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/src/convertToString_impl.h Lines: 9 9 100.0 %
Date: 2023-10-11 10:52:07 Branches: 6 9 66.7 %

Line Branch Exec Source
1
/***************************************
2
	Auteur : Pierre Aubert
3
	Mail : pierre.aubert@lapp.in2p3.fr
4
	Licence : CeCILL-C
5
****************************************/
6
7
#ifndef __CONVERTTOSTRING_IMPL_H__
8
#define __CONVERTTOSTRING_IMPL_H__
9
10
#include "convertToString.h"
11
12
///Convert a type into a string
13
/**	@param val : value to be converted
14
 * 	@return converted string
15
*/
16
template<typename T>
17
237
std::string convertToString(const T & val){
18
474
	std::stringstream str;
19
237
	str << val;
20
474
	return str.str();
21
}
22
23
///Convert a string into value
24
/**	@param str : string to be converted
25
 * 	@return converted value
26
*/
27
template<typename T>
28
86
T stringToValue(const std::string & str){
29
86
	std::stringstream strStream;
30
86
	strStream << str;
31
	T val;
32
86
	strStream >> val;
33
172
	return val;
34
}
35
36
37
#endif
38