GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/src/convertToString_impl.h Lines: 9 9 100.0 %
Date: 2024-12-09 15:30:52 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
61
std::string convertToString(const T & val){
18
122
	std::stringstream str;
19
61
	str << val;
20
122
	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
9
T stringToValue(const std::string & str){
29
9
	std::stringstream strStream;
30
9
	strStream << str;
31
	T val;
32
9
	strStream >> val;
33
18
	return val;
34
}
35
36
37
#endif
38