![]() |
|
PhoenixClock
2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
|
Generic clock which can use several backends (real clock backend and a mock of clock) More...
#include <PGenericClock.h>
Public Member Functions | |
| PClockMode::PClockMode | getMode () const |
| Get the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD) | |
| time_t | now () |
| Get the current time of the clock. | |
| PGenericClock () | |
| Default constructor of PGenericClock. | |
| void | resetMockIndex () |
| Reset the mock clock to initial state. | |
| void | setMockPrefix (const std::string &mockPrefix) |
| Set the mock prefix to load and save the mock with a custom file. | |
| void | setMode (PClockMode::PClockMode mode) |
| Set the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD) | |
| void | sleep (EllapsedTime ellapsedTime) const |
| Sleep for a given ellapsed time. | |
| virtual | ~PGenericClock () |
| Destructor of PGenericClock. | |
Protected Member Functions | |
| void | copyPGenericClock (const PGenericClock< _TBackend, _TMockBackend > &other) |
| Copy function of PGenericClock. | |
Private Member Functions | |
| void | initialisationPGenericClock () |
| Initialisation function of the class PGenericClock. | |
| PGenericClock & | operator= (const PGenericClock< _TBackend, _TMockBackend > &other) |
| Definition of equal operator of PGenericClock. | |
| PGenericClock (const PGenericClock< _TBackend, _TMockBackend > &other) | |
| Copy constructor of PGenericClock. | |
Private Attributes | |
| _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) | |
Generic clock which can use several backends (real clock backend and a mock of clock)
Definition at line 16 of file PGenericClock.h.
| PGenericClock< _TBackend, _TMockBackend >::PGenericClock | ( | ) |
Default constructor of PGenericClock.
Definition at line 16 of file PGenericClock_impl.h.
References initialisationPGenericClock().
Referenced by copyPGenericClock(), operator=(), and PGenericClock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
|
private |
Copy constructor of PGenericClock.
| other | : class to copy |
Definition at line 24 of file PGenericClock_impl.h.
References copyPGenericClock(), and PGenericClock().
Here is the call graph for this function:
|
protected |
Copy function of PGenericClock.
| other | : class to copy |
Definition at line 108 of file PGenericClock_impl.h.
References p_mode, and PGenericClock().
Referenced by operator=(), and PGenericClock().
Here is the call graph for this function:
Here is the caller graph for this function:| PClockMode::PClockMode PGenericClock< _TBackend, _TMockBackend >::getMode | ( | ) | const |
Get the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD)
Definition at line 56 of file PGenericClock_impl.h.
References p_mode.
|
private |
Initialisation function of the class PGenericClock.
Definition at line 114 of file PGenericClock_impl.h.
References PClockMode::NO_MOCK, and p_mode.
Referenced by PGenericClock().
Here is the caller graph for this function:| time_t PGenericClock< _TBackend, _TMockBackend >::now | ( | ) |
Get the current time of the clock.
Definition at line 64 of file PGenericClock_impl.h.
References PClockMode::MOCK, PClockMode::NO_MOCK, p_clockBackend, p_mockBackend, and p_mode.
|
private |
Definition of equal operator of PGenericClock.
| other | : class to copy |
Definition at line 39 of file PGenericClock_impl.h.
References copyPGenericClock(), and PGenericClock().
Here is the call graph for this function:| void PGenericClock< _TBackend, _TMockBackend >::resetMockIndex | ( | ) |
Reset the mock clock to initial state.
Definition at line 98 of file PGenericClock_impl.h.
References PClockMode::MOCK, p_mockBackend, and p_mode.
| void PGenericClock< _TBackend, _TMockBackend >::setMockPrefix | ( | const std::string & | mockPrefix | ) |
Set the mock prefix to load and save the mock with a custom file.
| mockPrefix | : mock prefix |
Definition at line 92 of file PGenericClock_impl.h.
References p_mockBackend.
| void PGenericClock< _TBackend, _TMockBackend >::setMode | ( | PClockMode::PClockMode | mode | ) |
Set the mode of the PGenericClock (NO_MOCK, MOCK or MOCK_RECORD)
| mode | : mode of the PGenericClock |
Definition at line 48 of file PGenericClock_impl.h.
References p_mode.
| void PGenericClock< _TBackend, _TMockBackend >::sleep | ( | EllapsedTime | ellapsedTime | ) | const |
Sleep for a given ellapsed time.
| ellapsedTime | : time to sleep (the unit is given by the used backend, second for clock, ns for system_clock, etc) |
Definition at line 80 of file PGenericClock_impl.h.
References PClockMode::MOCK, PClockMode::MOCK_RECORD, PClockMode::NO_MOCK, p_clockBackend, p_mockBackend, and p_mode.
|
private |
Instance of the clock backend (necessary for some clock backends)
Definition at line 39 of file PGenericClock.h.
|
private |
Instance of the clock backend (necessary for some clock backends)
Definition at line 41 of file PGenericClock.h.
Referenced by now(), resetMockIndex(), setMockPrefix(), and sleep().
|
private |
Mode of the Clock (no mock, mock, mock_record)
Definition at line 37 of file PGenericClock.h.
Referenced by copyPGenericClock(), getMode(), initialisationPGenericClock(), now(), resetMockIndex(), setMode(), and sleep().