GCC Code Coverage Report


Directory: ./
File: src/PGenericInternalVar_impl.h
Date: 2024-12-09 11:00:39
Exec Total Coverage
Lines: 13 13 100.0%
Branches: 2 2 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 __PGENERICINTERNALVAR_H_IMPL__
8 #define __PGENERICINTERNALVAR_H_IMPL__
9
10 #include "PGenericInternalVar.h"
11
12 ///Default constructor of PGenericInternalVar
13 /** @param mode : Mode of the PGenericInternalVar (no mock, mock, mock_record)
14 * @param mockParam : parameters of the mock backend
15 */
16 template<typename _TBackend, typename _TMockBackend>
17
1/1
✓ Branch 2 taken 2 times.
2 PGenericInternalVar<_TBackend, _TMockBackend>::PGenericInternalVar(ConnectorMode::ConnectorMode mode, const typename _TMockBackend::Param & mockParam){
18
1/1
✓ Branch 1 taken 2 times.
2 initialisationPGenericInternalVar(mode, mockParam);
19 2 }
20
21 ///Destructor of PGenericInternalVar
22 template<typename _TBackend, typename _TMockBackend>
23 4 PGenericInternalVar<_TBackend, _TMockBackend>::~PGenericInternalVar(){
24
25 }
26
27 ///Set the PComposeVar of the variable to be managed
28 /** @param composeVar : type of the variable to be managed
29 */
30 template<typename _TBackend, typename _TMockBackend>
31 2 void PGenericInternalVar<_TBackend, _TMockBackend>::setComposeVar(const PComposeVar & composeVar){
32 2 p_composeVar = composeVar;
33 2 }
34
35 ///Get the PComposeVar of the current variable
36 /** @return PComposeVar of the current variable
37 */
38 template<typename _TBackend, typename _TMockBackend>
39 const PComposeVar & PGenericInternalVar<_TBackend, _TMockBackend>::getComposeVar() const{
40 return p_composeVar;
41 }
42
43 ///Get the PComposeVar of the current variable
44 /** @return PComposeVar of the current variable
45 */
46 template<typename _TBackend, typename _TMockBackend>
47 103 PComposeVar & PGenericInternalVar<_TBackend, _TMockBackend>::getComposeVar(){
48 103 return p_composeVar;
49 }
50
51 ///Read variable from message
52 /** @param msg : message to be read
53 * @return true on success, false otherwise
54 */
55 template<typename _TBackend, typename _TMockBackend>
56 bool PGenericInternalVar<_TBackend, _TMockBackend>::readVar(const typename _TBackend::Message & msg){
57 bool b(true);
58 if(p_mode != ConnectorMode::MOCK){
59 b &= readBackend(msg);
60 }
61 if(p_mode == ConnectorMode::MOCK){
62 typename _TMockBackend::Message vecTmp;
63 phoenix_copy<_TMockBackend, _TBackend>(vecTmp, msg);
64 b &= readMockBackend(vecTmp);
65 }
66 if(p_mode == ConnectorMode::MOCK_RECORD){
67 typename _TMockBackend::Message vecTmp;
68 phoenix_copy<_TMockBackend, _TBackend>(vecTmp, msg);
69 b &= readMockBackend(vecTmp);
70 }
71 return b;
72 }
73
74 ///Write variable in message
75 /** @param[out] msg : message to be written
76 * @return true on success, false otherwise
77 */
78 template<typename _TBackend, typename _TMockBackend>
79 bool PGenericInternalVar<_TBackend, _TMockBackend>::writeVar(typename _TBackend::Message & msg) const{
80 bool b(true);
81 if(p_mode != ConnectorMode::MOCK){
82 b &= writeBackend(msg);
83 }
84 if(p_mode == ConnectorMode::MOCK){
85 typename _TMockBackend::Message vecTmp;
86 b &= writeMockBackend(vecTmp);
87 phoenix_copy<_TBackend, _TMockBackend>(msg, vecTmp);
88 }
89 if(p_mode == ConnectorMode::MOCK_RECORD){
90 typename _TMockBackend::Message vecTmp;
91 phoenix_copy<_TMockBackend, _TBackend>(vecTmp, msg);
92 b &= writeMockBackend(vecTmp);
93 }
94 return b;
95 }
96
97 ///Initialisation function of the class PGenericInternalVar
98 /** @param mode : Mode of the PGenericInternalVar (no mock, mock, mock_record)
99 * @param mockParam : parameters of the mock backend
100 */
101 template<typename _TBackend, typename _TMockBackend>
102 2 void PGenericInternalVar<_TBackend, _TMockBackend>::initialisationPGenericInternalVar(ConnectorMode::ConnectorMode mode, const typename _TMockBackend::Param & mockParam){
103 2 p_mode = mode;
104 2 p_mockParam = mockParam;
105 2 }
106
107
108
109
110
111 #endif
112
113
114
115