PhoenixClock  2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
Loading...
Searching...
No Matches
PGenericClock.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__
8#define __PGENERICCLOCK_H__
9
10#include "PClockMode.h"
11#include "PClockBackend.h"
12#include "PClockMock.h"
13
15template<typename _TBackend, typename _TMockBackend>
17 public:
19 virtual ~PGenericClock();
20
23
24 time_t now();
25 void sleep(EllapsedTime ellapsedTime) const;
26 void setMockPrefix(const std::string & mockPrefix);
27 void resetMockIndex();
28
29 protected:
31 private:
35
39 _TBackend p_clockBackend;
41 _TMockBackend p_mockBackend;
42};
43
44#include "PGenericClock_impl.h"
45
46
47#endif
48
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