17 #include <HAL/Notifier.h> 18 #include <wpi/mutex.h> 20 #include "ErrorBase.h" 24 typedef std::function<void()> TimerEventHandler;
34 explicit Notifier(TimerEventHandler handler);
36 template <
typename Callable,
typename Arg,
typename... Args>
37 Notifier(Callable&& f, Arg&& arg, Args&&... args)
38 :
Notifier(std::bind(std::forward<Callable>(f), std::forward<Arg>(arg),
39 std::forward<Args>(args)...)) {}
47 Notifier& operator=(
const Notifier&) =
delete;
98 wpi::mutex m_processMutex;
101 std::atomic<HAL_NotifierHandle> m_notifier{0};
104 TimerEventHandler m_handler;
107 double m_expirationTime = 0;
113 bool m_periodic =
false;
Definition: Utility.cpp:119
void Stop()
Stop timer events from occuring.
Definition: Notifier.cpp:84
Definition: Notifier.h:26
void StartPeriodic(double period)
Register for periodic event notification.
Definition: Notifier.cpp:76
void StartSingle(double delay)
Register for single event notification.
Definition: Notifier.cpp:68
Base class for most objects.
Definition: ErrorBase.h:74
Notifier(TimerEventHandler handler)
Create a Notifier for timer event notification.
Definition: Notifier.cpp:18
void SetHandler(TimerEventHandler handler)
Change the handler function.
Definition: Notifier.cpp:63
virtual ~Notifier()
Free the resources for a timer event.
Definition: Notifier.cpp:50