PhoenixClock  2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
Loading...
Searching...
No Matches
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
15template<typename _TBackend, typename _TMockBackend>
19
21
23template<typename _TBackend, typename _TMockBackend>
27
29template<typename _TBackend, typename _TMockBackend>
33
35
38template<typename _TBackend, typename _TMockBackend>
43
45
47template<typename _TBackend, typename _TMockBackend>
51
53
55template<typename _TBackend, typename _TMockBackend>
59
61
63template<typename _TBackend, typename _TMockBackend>
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
79template<typename _TBackend, typename _TMockBackend>
82 p_clockBackend.sleep(ellapsedTime);
83 }else if(p_mode == PClockMode::MOCK){
84 p_mockBackend.sleep(ellapsedTime);
85 }
86}
87
89
91template<typename _TBackend, typename _TMockBackend>
92void PGenericClock<_TBackend, _TMockBackend>::setMockPrefix(const std::string & mockPrefix){
93 p_mockBackend.setMockPrefix(mockPrefix);
94}
95
97template<typename _TBackend, typename _TMockBackend>
103
105
107template<typename _TBackend, typename _TMockBackend>
111
113template<typename _TBackend, typename _TMockBackend>
117
118
119
120
121
122#endif
123
124
125
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 resetMockIndex()
Reset the mock clock to initial state.
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.
void setMockPrefix(const std::string &mockPrefix)
Set the mock prefix to load and save the mock with a custom file.
time_t now()
Get the current time of the clock.
void initialisationPGenericClock()
Initialisation function of the class PGenericClock.
_TBackend p_clockBackend
Instance of the clock backend (necessary for some clock backends)
_TMockBackend p_mockBackend
Instance of the clock backend (necessary for some clock backends)
PClockMode::PClockMode p_mode
Mode of the Clock (no mock, mock, mock_record)
void sleep(EllapsedTime ellapsedTime) const
Sleep for a given ellapsed time.
time_t EllapsedTime
PClockMode
describe the mode of the Socket
Definition PClockMode.h:12