PhoenixClock  2.2.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
Loading...
Searching...
No Matches
PClockMock.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 __PCLOCKMOCK_H__
8#define __PCLOCKMOCK_H__
9
10#include "ellapsedTime.h"
11#include "phoenix_generic_mock.h"
12
15 public:
16 PClockMock();
17 virtual ~PClockMock();
18
19 //clock API
20 time_t now();
21 void sleep(EllapsedTime sleepTime) const;
22
23 //mock API
24 void setCurrentTime(time_t currentTime);
25 void setMockPrefix(const std::string & mockPrefix);
26 void resetIndex();
27 void close();
28 private:
31 PGenericVecMock<time_t> p_mock;
32};
33
34bool phoenix_createMockBackend(PClockMock & mock, const std::string & prefix = "");
35
36#endif
37
bool phoenix_createMockBackend(PClockMock &mock, const std::string &prefix="")
Create a mock backend for clock.
Mock of a clock.
Definition PClockMock.h:14
void resetIndex()
Reset the mock index to the beginning.
void close()
Close the mock.
PClockMock()
Default constructor of PClockMock.
time_t now()
Get the mocked current time.
virtual ~PClockMock()
Destructor of PClockMock.
void setCurrentTime(time_t currentTime)
Set the current time to be recorded.
void initialisationPClockMock()
Initialisation function of the class PClockMock.
PGenericVecMock< time_t > p_mock
Mock handler.
Definition PClockMock.h:31
void setMockPrefix(const std::string &mockPrefix)
Set the mock directory.
void sleep(EllapsedTime sleepTime) const
Sleep for the given time.
time_t EllapsedTime