GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/src/print_string_impl.h Lines: 27 27 100.0 %
Date: 2023-10-11 10:52:07 Branches: 35 35 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 __PRINT_STRING_IMPL_H__
8
#define __PRINT_STRING_IMPL_H__
9
10
#include "print_string.h"
11
12
///Print data
13
/**	@param data : data to be printed
14
 * 	@param suffix : suffix to be printed on each string
15
 * 	@param prefix : prefix to be printed on each string
16
*/
17
template<typename T>
18
42
void phoenix_print(const T & data, const std::string& suffix, const std::string & prefix){
19
42
	std::cout << prefix << data << suffix << std::endl;
20
42
}
21
22
///Print data
23
/**	@param data : data to be printed
24
 * 	@param suffix : suffix to be printed on each string
25
 * 	@param prefix : prefix to be printed on each string
26
*/
27
template<typename T>
28
8
void phoenix_print(const std::list<T> & data, const std::string& suffix, const std::string & prefix){
29
20
	for(typename std::list<T>::const_iterator it(data.begin()); it != data.end(); ++it){
30

12
		std::cout << prefix << *it << suffix << std::endl;
31
	}
32
8
}
33
34
///Print data
35
/**	@param data : data to be printed
36
 * 	@param suffix : suffix to be printed on each string
37
 * 	@param prefix : prefix to be printed on each string
38
*/
39
template<typename T>
40
39
void phoenix_print(const std::vector<T> & data, const std::string& suffix, const std::string & prefix){
41
103
	for(typename std::vector<T>::const_iterator it(data.begin()); it != data.end(); ++it){
42

64
		std::cout << prefix << *it << suffix << std::endl;
43
	}
44
39
}
45
46
///Print data
47
/**	@param data : data to be printed
48
 * 	@param suffix : suffix to be printed on each string
49
 * 	@param prefix : prefix to be printed on each string
50
*/
51
template<typename T>
52
2
void phoenix_print(const std::vector<std::vector<T> > & data, const std::string& suffix, const std::string & prefix){
53
6
	for(typename std::vector<std::vector<T> >::const_iterator it(data.begin()); it != data.end(); ++it){
54
4
		phoenix_print(*it, suffix, prefix);
55
4
		std::cout << std::endl;
56
	}
57
2
}
58
59
///Print data
60
/**	@param data : data to be printed
61
 * 	@param suffix : suffix to be printed on each string
62
 * 	@param prefix : prefix to be printed on each string
63
*/
64
template<typename T, typename U>
65
6
void phoenix_print(const std::map<T, U> & data, const std::string& suffix, const std::string & prefix){
66
12
	for(typename std::map<T, U>::const_iterator it(data.begin()); it != data.end(); ++it){
67

6
		std::cout << prefix << it->first << suffix << " => " << it->second << std::endl;
68
	}
69
6
}
70
71
///Print data
72
/**	@param data : data to be printed
73
 * 	@param suffix : suffix to be printed on each string
74
 * 	@param prefix : prefix to be printed on each string
75
*/
76
template<typename T, typename U>
77
6
void phoenix_print(const std::map<T, std::vector<U> > & data, const std::string& suffix, const std::string & prefix){
78
12
	for(typename std::map<T, std::vector<U> >::const_iterator itEntry(data.begin()); itEntry != data.end(); ++itEntry){
79
6
		std::cout << prefix << itEntry->first << " => ";
80
81
24
		for(typename std::vector<U>::const_iterator it(itEntry->second.begin()); it != itEntry->second.end(); ++it){
82
18
			std::cout << *it << ", ";
83
		}
84
85
6
		std::cout << suffix << std::endl;
86
	}
87
6
}
88
89
#endif
90