PhoenixClockMock  2.0.0
Tool to manipulate mock of clock (split, merge and get info)
PGenericClock_impl.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __PGENERICCLOCK_H_IMPL__
8 #define __PGENERICCLOCK_H_IMPL__
9 
10 
11 
12 #include "PGenericClock.h"
13 
15 template<typename _TBackend, typename _TMockBackend>
17  initialisationPGenericClock();
18 }
19 
21 
23 template<typename _TBackend, typename _TMockBackend>
25  copyPGenericClock(other);
26 }
27 
29 template<typename _TBackend, typename _TMockBackend>
31 
32 }
33 
35 
38 template<typename _TBackend, typename _TMockBackend>
40  copyPGenericClock(other);
41  return *this;
42 }
43 
45 
47 template<typename _TBackend, typename _TMockBackend>
49  p_mode = mode;
50 }
51 
53 
55 template<typename _TBackend, typename _TMockBackend>
57  return p_mode;
58 }
59 
61 
63 template<typename _TBackend, typename _TMockBackend>
65  if(p_mode == PClockMode::NO_MOCK){
66  return p_clockBackend.now();
67  }else if(p_mode == PClockMode::MOCK){
68  return p_mockBackend.now();
69  }else{
70  time_t currentTime = p_clockBackend.now();
71  p_mockBackend.setCurrentTime(currentTime);
72  return currentTime;
73  }
74 }
75 
77 
79 template<typename _TBackend, typename _TMockBackend>
81  p_mode = other.p_mode;
82 }
83 
85 template<typename _TBackend, typename _TMockBackend>
87  p_mode = PClockMode::NO_MOCK;
88 }
89 
90 
91 
92 
93 
94 #endif
95 
96 
97 
Generic clock which can use several backends (real clock backend and a mock of clock)
Definition: PGenericClock.h:17
void copyPGenericClock(const PGenericClock< _TBackend, _TMockBackend > &other)
Copy function of PGenericClock.
PGenericClock()
Default constructor of PGenericClock.
PClockMode::PClockMode getMode() const
Get the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD)
void setMode(PClockMode::PClockMode mode)
Set the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD)
virtual ~PGenericClock()
Destructor of PGenericClock.
PGenericClock & operator=(const PGenericClock< _TBackend, _TMockBackend > &other)
Definition of equal operator of PGenericClock.
time_t now()
Get the current time of the clock.
void initialisationPGenericClock()
Initialisation function of the class PGenericClock.
PClockMode::PClockMode p_mode
Mode of the Clock (no mock, mock, mock_record)
Definition: PGenericClock.h:35
PClockMode
describe the mode of the Socket
Definition: PClockMode.h:12