RTC Toolkit  1.0.0
Public Member Functions | List of all members
rtctk::dataTask::ReaderThread< TopicType, ReaderType > Class Template Reference

ReaderThread for the Data Class. More...

#include <readerThread.hpp>

Public Member Functions

 ReaderThread ()
 
 ~ReaderThread ()
 
void Spawn ()
 Spawn the reader thread. More...
 
void Join ()
 waits for thread to complete and rejoins More...
 
void Run ()
 send synchronous run request to readerThread. More...
 
void Idle ()
 send Idle request to readerThread. More...
 
void WaitUntilComputationAllowed ()
 wait until the computation can be launched. More...
 
void WaitUntilComputationAllowed (rtctk::componentFramework::StopToken st)
 
void SignalComputationDone ()
 returns from the buisness logic that te calculation has completed so that the readerThread is safe to begin reading again once the specified skip samples has completed More...
 
void SetQueueName (std::string const &name)
 required setter sets the queue name to be used if unlocked. More...
 
void SetMode (ReaderMode mode)
 optional setter sets the mode of the reader. More...
 
void SetThreadName (std::string const &name)
 optional setter sets the thread name to be used, if unlocked. More...
 
void SetCpuAffinity (int affinity)
 optional setter sets the cpu affinity name, if unlocked. More...
 
void SetSamplesToRead (size_t value)
 required setter sets the number of samples to be read, if unlocked. More...
 
void SetSamplesToSkip (size_t value)
 required setter sets the number of samples to skip, if unlocked. More...
 
void SetLoopFrequency (size_t value)
 required setter sets the loop frequency, if unlocked. More...
 
void SetErrorMargin (float value)
 optional setter sets the timeout tolerance. More...
 
void RegisterOnDataCallback (std::function< void(const TopicType &sample)> callback)
 required callback More...
 
void RegisterInitThreadCallback (std::function< void()> callback)
 optional callback More...
 

Detailed Description

template<typename TopicType, template< typename > typename ReaderType = ipcq::Reader>
class rtctk::dataTask::ReaderThread< TopicType, ReaderType >

ReaderThread for the Data Class.

Thread class for the reading of data out of the ipcq shared memory and handling state.

Template Parameters
TopicTypethe queue topic.
Readertype of ipcq writer to be used defaults to ipcq::Reader<TopicType>

Constructor & Destructor Documentation

◆ ReaderThread()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
rtctk::dataTask::ReaderThread< TopicType, ReaderType >::ReaderThread ( )
inline

◆ ~ReaderThread()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
rtctk::dataTask::ReaderThread< TopicType, ReaderType >::~ReaderThread ( )
inline

Member Function Documentation

◆ Idle()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::Idle ( )
inline

send Idle request to readerThread.

◆ Join()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::Join ( )
inline

waits for thread to complete and rejoins

sends Async request to reader thread to exit. Wait for it to be acknowledge for timeout Thread is rejoined and variables are unclocked. see parameter

Note
timeout set for 1200 ms

◆ RegisterInitThreadCallback()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::RegisterInitThreadCallback ( std::function< void()>  callback)
inline

optional callback

Sets the callback to be invoked by reader thread for any calculation specific initalisation. This is though to be used by GPUs to initalised for specific thread.

◆ RegisterOnDataCallback()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::RegisterOnDataCallback ( std::function< void(const TopicType &sample)>  callback)
inline

required callback

Sets the callback to pass to shm. to processes data and copy to calculation buffers

◆ Run()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::Run ( )
inline

send synchronous run request to readerThread.

◆ SetCpuAffinity()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetCpuAffinity ( int  affinity)
inline

optional setter sets the cpu affinity name, if unlocked.

see parameter

◆ SetErrorMargin()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetErrorMargin ( float  value)
inline

optional setter sets the timeout tolerance.

see parameter This is used for setting timeouts on reading from shm

◆ SetLoopFrequency()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetLoopFrequency ( size_t  value)
inline

required setter sets the loop frequency, if unlocked.

see parameter This is used for setting timeouts on reading from shm

◆ SetMode()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetMode ( ReaderMode  mode)
inline

optional setter sets the mode of the reader.

see parameter

◆ SetQueueName()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetQueueName ( std::string const &  name)
inline

required setter sets the queue name to be used if unlocked.

see parameter

◆ SetSamplesToRead()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetSamplesToRead ( size_t  value)
inline

required setter sets the number of samples to be read, if unlocked.

see parameter

◆ SetSamplesToSkip()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetSamplesToSkip ( size_t  value)
inline

required setter sets the number of samples to skip, if unlocked.

see parameter

◆ SetThreadName()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SetThreadName ( std::string const &  name)
inline

optional setter sets the thread name to be used, if unlocked.

see parameter

◆ SignalComputationDone()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::SignalComputationDone ( )
inline

returns from the buisness logic that te calculation has completed so that the readerThread is safe to begin reading again once the specified skip samples has completed

◆ Spawn()

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::Spawn ( )
inline

Spawn the reader thread.

Checks correct values have been set then creates and locks values see messageQueue. Launches thread and waits for thread to be launched and acknowledges Async Request within timeout.

Note
Timeout set to 1200 ms
Asserts that OnDataAvailable Callback must be set.

◆ WaitUntilComputationAllowed() [1/2]

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::WaitUntilComputationAllowed ( )
inline

wait until the computation can be launched.

checks state to check if the specified numner of data samples have been recieved and processed.

Note
this is to be called by the buisness logic.

◆ WaitUntilComputationAllowed() [2/2]

template<typename TopicType , template< typename > typename ReaderType = ipcq::Reader>
void rtctk::dataTask::ReaderThread< TopicType, ReaderType >::WaitUntilComputationAllowed ( rtctk::componentFramework::StopToken  st)
inline

The documentation for this class was generated from the following file: