GCC Code Coverage Report


Directory: ./
File: src/ConfigNodeIter_impl.h
Date: 2025-11-27 16:44:16
Exec Total Coverage
Lines: 21 25 84.0%
Functions: 6 6 100.0%
Branches: 24 31 77.4%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #ifndef __CONFIGNODEITER_IMPL_H__
8 #define __CONFIGNODEITER_IMPL_H__
9
10 #include "ConfigNode.h"
11
12
13 ///Get a value from the current ConfigNode
14 /** @param[out] data : value to get
15 * @return true if the value does exist, false otherwise
16 */
17 template<typename T>
18 6 bool ConfigNodeIter::getValue(T & data) const{
19
1/2
✓ Branch 0 (3→4) taken 6 times.
✗ Branch 1 (3→14) not taken.
6 if(p_current->hasValue()){
20
2/2
✓ Branch 0 (4→5) taken 2 times.
✓ Branch 1 (4→9) taken 4 times.
6 if(p_isWriteMode){
21
2/2
✓ Branch 0 (5→6) taken 2 times.
✓ Branch 2 (6→7) taken 2 times.
2 p_current->setValue(PString::toString(data));
22 }else{
23
3/3
✓ Branch 0 (9→10) taken 4 times.
✓ Branch 2 (10→11) taken 4 times.
✓ Branch 4 (11→12) taken 2 times.
4 data = PString::toValue<T>(p_current->getString());
24 }
25 6 return true;
26 }else{
27 *p_out << "ConfigNodeIter::getValue : no value in ConfigNode defined at " << p_current->getLocation() << std::endl;
28 return false;
29 }
30 }
31
32 ///Get a value from the current ConfigNode and check data
33 /** @param[out] data : value to get
34 * @param checker : checker of given data
35 * @return true if the value does exist, false otherwise
36 */
37 template<typename T>
38 6 bool ConfigNodeIter::getValue(T & data, const GenericConfigCheck * checker) const{
39
4/4
✓ Branch 0 (2→3) taken 3 times.
✓ Branch 1 (2→12) taken 3 times.
✓ Branch 2 (3→4) taken 1 times.
✓ Branch 3 (3→12) taken 2 times.
6 if(checker != NULL && p_isWriteMode){
40
1/2
✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→12) taken 1 times.
1 if(!checker->isOk(*p_out)){
41 *p_out << "\tdefined in ConfigNode '"<<p_current->getName()<<"'. I am sorry but since this is not yet a file I do not have any line numbers" << std::endl;
42 return false;
43 }
44 }
45
1/2
✓ Branch 0 (13→14) taken 6 times.
✗ Branch 1 (13→25) not taken.
6 if(getValue(data)){
46
2/2
✓ Branch 0 (14→15) taken 3 times.
✓ Branch 1 (14→24) taken 3 times.
6 if(checker != NULL){
47
2/2
✓ Branch 0 (16→17) taken 2 times.
✓ Branch 1 (16→18) taken 1 times.
3 if(checker->isOk(*p_out)){
48 2 return true;
49 }else{
50
3/3
✓ Branch 0 (19→20) taken 1 times.
✓ Branch 2 (20→21) taken 1 times.
✓ Branch 4 (21→22) taken 1 times.
1 *p_out << "\tdefined at " << p_current->getLocation() << std::endl;
51 }
52 }else{
53 3 return true;
54 }
55 }
56 1 return false;
57 }
58
59 ///Get a value from the current ConfigNode and check data
60 /** @param childName : name of the child to get value
61 * @param[out] data : value to get
62 * @param checker : checker of given data
63 * @return true if the value does exist, false otherwise
64 */
65 template<typename T>
66 6 bool ConfigNodeIter::getChildValue(const PString & childName, T & data, const GenericConfigCheck * checker){
67
1/2
✗ Branch 0 (3→4) not taken.
✓ Branch 1 (3→5) taken 6 times.
6 if(!down(childName)){return false;}
68
2/2
✓ Branch 0 (6→7) taken 1 times.
✓ Branch 1 (6→8) taken 5 times.
6 if(!getValue(data, checker)){return false;}
69 5 up();
70 5 return true;
71 }
72
73
74 #endif
75