GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixString/src/print_string_impl.h
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 27 27 100.0%
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
2/2
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 8 times.
20 for(typename std::list<T>::const_iterator it(data.begin()); it != data.end(); ++it){
30
4/4
✓ Branch 1 taken 12 times.
✓ Branch 5 taken 12 times.
✓ Branch 8 taken 12 times.
✓ Branch 11 taken 12 times.
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 29 void phoenix_print(const std::vector<T> & data, const std::string& suffix, const std::string & prefix){
41
2/2
✓ Branch 4 taken 41 times.
✓ Branch 5 taken 29 times.
70 for(typename std::vector<T>::const_iterator it(data.begin()); it != data.end(); ++it){
42
4/4
✓ Branch 1 taken 41 times.
✓ Branch 5 taken 41 times.
✓ Branch 8 taken 41 times.
✓ Branch 11 taken 41 times.
41 std::cout << prefix << *it << suffix << std::endl;
43 }
44 29 }
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
2/2
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
6 for(typename std::vector<std::vector<T> >::const_iterator it(data.begin()); it != data.end(); ++it){
54
1/1
✓ Branch 2 taken 4 times.
4 phoenix_print(*it, suffix, prefix);
55
1/1
✓ Branch 1 taken 4 times.
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
2/2
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
12 for(typename std::map<T, U>::const_iterator it(data.begin()); it != data.end(); ++it){
67
6/6
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 6 times.
✓ Branch 11 taken 6 times.
✓ Branch 15 taken 6 times.
✓ Branch 18 taken 6 times.
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
2/2
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
12 for(typename std::map<T, std::vector<U> >::const_iterator itEntry(data.begin()); itEntry != data.end(); ++itEntry){
79
3/3
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 6 times.
6 std::cout << prefix << itEntry->first << " => ";
80
81
2/2
✓ Branch 6 taken 18 times.
✓ Branch 7 taken 6 times.
24 for(typename std::vector<U>::const_iterator it(itEntry->second.begin()); it != itEntry->second.end(); ++it){
82
2/2
✓ Branch 2 taken 18 times.
✓ Branch 5 taken 18 times.
18 std::cout << *it << ", ";
83 }
84
85
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 std::cout << suffix << std::endl;
86 }
87 6 }
88
89 #endif
90
91