Skyward boardcore
|
Helper class to count how many events are sent to the topic(s) it is registered to. More...
#include <EventCounter.h>
Public Member Functions | |
EventCounter (EventBroker &broker) | |
Construct a new Event Counter object. | |
~EventCounter () | |
void | subscribe (uint8_t topic) |
Subscribes to a topic in the EventBroker. | |
void | postEvent (const Event &ev) override |
unsigned int | getCount (const Event &ev) |
Returns the number of times a specific event has been received. | |
unsigned int | getTotalCount () |
Returns how many events have been received in total. | |
uint8_t | getLastEvent () |
Returns the signature of the last event received (ev) | |
![]() | |
EventHandler (unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY) | |
virtual | ~EventHandler () |
void | postEvent (const Event &ev) override |
void | stop () override |
Signals the runner thread to terminate and joins the thread. | |
![]() | |
EventHandlerBase () | |
virtual | ~EventHandlerBase () |
![]() | |
ActiveObject (unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY) | |
virtual | ~ActiveObject () |
virtual bool | start () |
Start the thread associated with this active object. | |
bool | isRunning () |
Protected Member Functions | |
void | handleEvent (const Event &ev __attribute__((unused))) override |
![]() | |
virtual void | handleEvent (const Event &ev)=0 |
void | run () override |
![]() | |
bool | shouldStop () |
Tells whether or not the ActiveObject should stop its execution. | |
Additional Inherited Members | |
![]() | |
SynchronizedQueue< Event > | eventList |
![]() | |
miosix::Thread * | thread = nullptr |
Gives access to the thread object. | |
std::atomic< bool > | stopFlag {false} |
std::atomic< bool > | running {false} |
Helper class to count how many events are sent to the topic(s) it is registered to.
Useful if you want to check wether or not events are being effectively posted
Definition at line 38 of file EventCounter.h.
|
inline |
Construct a new Event Counter object.
broker | EventBroker to listen events to |
Definition at line 46 of file EventCounter.h.
|
inline |
Definition at line 48 of file EventCounter.h.
|
inline |
Returns the number of times a specific event has been received.
Definition at line 72 of file EventCounter.h.
|
inline |
Returns the signature of the last event received (ev)
Definition at line 90 of file EventCounter.h.
|
inline |
Returns how many events have been received in total.
Definition at line 85 of file EventCounter.h.
|
inlineoverrideprotected |
Definition at line 94 of file EventCounter.h.
|
inlineoverridevirtual |
Implements Boardcore::EventHandlerBase.
Definition at line 59 of file EventCounter.h.
|
inline |
Subscribes to a topic in the EventBroker.
topic |
Definition at line 55 of file EventCounter.h.