A class implementing some basic data poller behavior. More...
#include <datapoller.h>
Public Member Functions | |
DataPoller (DataParser &parser) | |
Create a DataPoller with a parser. More... | |
virtual | ~DataPoller () |
Destroy the data poller. More... | |
![]() | |
XsThreadId | getThreadId (void) const |
bool | isAlive (void) volatile const noexcept |
bool | isRunning (void) volatile const noexcept |
Returns whether the thread is currently running. More... | |
bool | isTerminating () volatile const noexcept |
Returns whether the thread should (have) terminate(d) More... | |
bool | setPriority (XsThreadPriority pri) |
Sets the priority of the thread. More... | |
virtual void | signalStopThread (void) |
Tells the thread to stop but does not wait for it to end. More... | |
StandardThread () | |
bool | startThread (const char *name=NULL) |
Starts the thread. More... | |
void | stopThread (void) noexcept |
Tells the thread to stop and waits for it to end. More... | |
virtual | ~StandardThread () |
Protected Member Functions | |
void | cleanup () |
Clean up the DataPoller. More... | |
virtual int32_t | conjureUpWaitTime (const XsByteArray &bytes) const |
Conjure up the time to wait based on properties of the received data (like the length) More... | |
void | initFunction () override |
Init function for the thread, sets the priority higher. More... | |
int32_t | innerFunction () override |
The inner thread function. More... | |
![]() | |
virtual void | exitFunction (void) |
Virtual exit function. More... | |
XsThread | threadHandle () const |
Return the thread handle. More... | |
Private Attributes | |
DataParser & | m_parser |
Additional Inherited Members | |
![]() | |
pthread_attr_t | m_attr |
Duplicates m_stop functionality for external dependent classes such as Semaphore. More... | |
bool | m_running |
Indicates that the thread is running. More... | |
volatile std::atomic_bool | m_stop |
Indicates that the thread should stop. Derived classes should check isTerminating() instead of directly polling this value when checking if the thread should stop. However, there are some cases (tests, SignallingThread) where direct access from within the class is desired, which is why the vlaue is protected instead of private. More... | |
volatile std::atomic_bool | m_yieldOnZeroSleep |
When true, a sleep value of 0 returned by innerFunction will trigger a thread yield operation. When false, the next cycle is started immediately. More... | |
A class implementing some basic data poller behavior.
Definition at line 77 of file datapoller.h.
|
virtual |
Destroy the data poller.
Definition at line 77 of file datapoller.cpp.
|
explicit |
Create a DataPoller with a parser.
Definition at line 70 of file datapoller.cpp.
|
protected |
Clean up the DataPoller.
Definition at line 111 of file datapoller.cpp.
|
protectedvirtual |
Conjure up the time to wait based on properties of the received data (like the length)
Definition at line 89 of file datapoller.cpp.
|
overrideprotectedvirtual |
Init function for the thread, sets the priority higher.
Reimplemented from xsens::StandardThread.
Definition at line 101 of file datapoller.cpp.
|
overrideprotectedvirtual |
The inner thread function.
Reimplemented from xsens::StandardThread.
Reimplemented in MtThread.
Definition at line 119 of file datapoller.cpp.
|
private |
Definition at line 91 of file datapoller.h.