CppELib 1.7.0
Loading...
Searching...
No Matches
TestDoubleOneShotTimerFactory.h
Go to the documentation of this file.
1#ifndef TEST_DOUBLE_OS_WRAPPER_TEST_DOUBLE_ONESHOT_TIMER_FACTORY_H_INCLUDED
2#define TEST_DOUBLE_OS_WRAPPER_TEST_DOUBLE_ONESHOT_TIMER_FACTORY_H_INCLUDED
3
7
8namespace TestDoubleOSWrapper {
9
11protected:
13 const char* m_name;
14
15public:
17 : OneShotTimer(0)
18 , m_runnable(0)
19 , m_name(0)
20 {
21 }
22
23 void setCreateArgs(OSWrapper::Runnable* r, const char* name)
24 {
25 m_runnable = r;
26 m_name = name;
27 }
28
30 {
31 }
32
33 virtual void start(unsigned long timeInMillis)
34 {
35 (void) timeInMillis;
36 }
37
38 virtual void stop()
39 {
40 }
41
42 virtual bool isStarted() const
43 {
44 return false;
45 }
46
47 virtual void setName(const char* name)
48 {
49 m_name = name;
50 }
51
52 virtual const char* getName() const
53 {
54 return m_name;
55 }
56};
57
58template <typename T = TestDoubleOneShotTimer>
60public:
63
64 virtual OSWrapper::OneShotTimer* create(OSWrapper::Runnable* r, const char* name)
65 {
66 T* obj = new T();
67 obj->setCreateArgs(r, name);
68 return obj;
69 }
70
72 {
73 delete static_cast<T*>(t);
74 }
75
76private:
79};
80
81}
82
83#endif // TEST_DOUBLE_OS_WRAPPER_TEST_DOUBLE_ONESHOT_TIMER_FACTORY_H_INCLUDED
Definition OneShotTimerFactory.h:9
Abstract class that has functions of common RTOS's one-shot timer.
Definition OneShotTimer.h:20
OneShotTimer(Runnable *r)
Definition OneShotTimer.h:22
Interface for implementing an active class.
Definition Runnable.h:9
Definition TestDoubleOneShotTimerFactory.h:59
virtual ~TestDoubleOneShotTimerFactory()
Definition TestDoubleOneShotTimerFactory.h:62
TestDoubleOneShotTimerFactory()
Definition TestDoubleOneShotTimerFactory.h:61
virtual OSWrapper::OneShotTimer * create(OSWrapper::Runnable *r, const char *name)
Definition TestDoubleOneShotTimerFactory.h:64
virtual void destroy(OSWrapper::OneShotTimer *t)
Definition TestDoubleOneShotTimerFactory.h:71
Definition TestDoubleOneShotTimerFactory.h:10
virtual void setName(const char *name)
Set the object's name.
Definition TestDoubleOneShotTimerFactory.h:47
virtual ~TestDoubleOneShotTimer()
Definition TestDoubleOneShotTimerFactory.h:29
virtual void stop()
Stop the timer.
Definition TestDoubleOneShotTimerFactory.h:38
virtual bool isStarted() const
Return true if the timer is started.
Definition TestDoubleOneShotTimerFactory.h:42
virtual const char * getName() const
Get the object's name.
Definition TestDoubleOneShotTimerFactory.h:52
OSWrapper::Runnable * m_runnable
Definition TestDoubleOneShotTimerFactory.h:12
const char * m_name
Definition TestDoubleOneShotTimerFactory.h:13
virtual void start(unsigned long timeInMillis)
Start the timer.
Definition TestDoubleOneShotTimerFactory.h:33
TestDoubleOneShotTimer()
Definition TestDoubleOneShotTimerFactory.h:16
void setCreateArgs(OSWrapper::Runnable *r, const char *name)
Definition TestDoubleOneShotTimerFactory.h:23
Implementation of OSWrapper for Test Double.
Definition TestDoubleEventFlagFactory.h:7