MADARA  3.1.8
madara::threads::WorkerThread Class Reference

A thread that executes BaseThread logic. More...

#include <WorkerThread.h>

Inheritance diagram for madara::threads::WorkerThread:
Collaboration diagram for madara::threads::WorkerThread:

Public Member Functions

 WorkerThread ()
 Default constructor. More...
 
 WorkerThread (const std::string &name, BaseThread *thread, knowledge::KnowledgeBase *control, knowledge::KnowledgeBase *data, double hertz=-1.0)
 Constructor. More...
 
 WorkerThread (const WorkerThread &input)=delete
 Copy constructor deleted, because ACE_Task doesn't support it. More...
 
 ~WorkerThread ()
 Destructor. More...
 
void operator= (const WorkerThread &input)
 Assignment operator. More...
 
void run (void)
 Runs the thread once. More...
 
int svc (void)
 Reads messages from a socket. More...
 

Protected Member Functions

void change_frequency (double hertz, ACE_Time_Value &current, ACE_Time_Value &frequency, ACE_Time_Value &next_epoch, bool &one_shot, bool &blaster)
 Changes the frequency given a hertz rate. More...
 

Protected Attributes

knowledge::KnowledgeBasecontrol_
 the control plane to the knowledge base More...
 
knowledge::KnowledgeBasedata_
 the data plane (the knowledge base) More...
 
knowledge::containers::Integer finished_
 thread safe finished flag that will be sent to the knowledge base on completion of the thread More...
 
double hertz_
 hertz rate for worker thread executions More...
 
std::string name_
 the name of the contained thread More...
 
knowledge::containers::Double new_hertz_
 thread safe hertz reference More...
 
knowledge::containers::Integer started_
 thread safe start flag that will be sent to the knowledge base on launch of the thread More...
 
BaseThreadthread_
 the contained thread More...
 

Friends

class Threader
 give access to our status flags to the Threader class More...
 

Detailed Description

A thread that executes BaseThread logic.

Users should

Definition at line 31 of file WorkerThread.h.

Constructor & Destructor Documentation

madara::threads::WorkerThread::WorkerThread ( )

Default constructor.

Definition at line 37 of file WorkerThread.cpp.

madara::threads::WorkerThread::WorkerThread ( const std::string &  name,
BaseThread thread,
knowledge::KnowledgeBase control,
knowledge::KnowledgeBase data,
double  hertz = -1.0 
)

Constructor.

Parameters
namethe name of the user thread
threadthe user thread
controlthe knowledge base that provides a control plane between the data knowledge base and threads
datathe knowledge base that provides user data access
hertzthe hertz rate to run the thread

Definition at line 43 of file WorkerThread.cpp.

madara::threads::WorkerThread::WorkerThread ( const WorkerThread input)
delete

Copy constructor deleted, because ACE_Task doesn't support it.

madara::threads::WorkerThread::~WorkerThread ( )

Destructor.

Definition at line 73 of file WorkerThread.cpp.

Member Function Documentation

void madara::threads::WorkerThread::change_frequency ( double  hertz,
ACE_Time_Value &  current,
ACE_Time_Value &  frequency,
ACE_Time_Value &  next_epoch,
bool &  one_shot,
bool &  blaster 
)
inlineprotected

Changes the frequency given a hertz rate.

Parameters
hertzthe new hertz rate
currentcurrent time
frequencyan updated frequency value
next_epochnext time to trigger execution
one_shotif hertz rate is less than 0, true. Otherwise, false
blasterif hertz rate is 0, true. Otherwise, false.

Definition at line 15 of file WorkerThread.inl.

void madara::threads::WorkerThread::operator= ( const WorkerThread input)

Assignment operator.

Parameters
inputthread information to copy

Definition at line 78 of file WorkerThread.cpp.

void madara::threads::WorkerThread::run ( void  )

Runs the thread once.

Definition at line 94 of file WorkerThread.cpp.

int madara::threads::WorkerThread::svc ( void  )

Reads messages from a socket.

Definition at line 121 of file WorkerThread.cpp.

Friends And Related Function Documentation

friend class Threader
friend

give access to our status flags to the Threader class

Definition at line 35 of file WorkerThread.h.

Member Data Documentation

knowledge::KnowledgeBase* madara::threads::WorkerThread::control_
protected

the control plane to the knowledge base

Definition at line 108 of file WorkerThread.h.

knowledge::KnowledgeBase* madara::threads::WorkerThread::data_
protected

the data plane (the knowledge base)

Definition at line 111 of file WorkerThread.h.

knowledge::containers::Integer madara::threads::WorkerThread::finished_
protected

thread safe finished flag that will be sent to the knowledge base on completion of the thread

Definition at line 117 of file WorkerThread.h.

double madara::threads::WorkerThread::hertz_
protected

hertz rate for worker thread executions

Definition at line 133 of file WorkerThread.h.

std::string madara::threads::WorkerThread::name_
protected

the name of the contained thread

Definition at line 102 of file WorkerThread.h.

knowledge::containers::Double madara::threads::WorkerThread::new_hertz_
protected

thread safe hertz reference

Definition at line 128 of file WorkerThread.h.

knowledge::containers::Integer madara::threads::WorkerThread::started_
protected

thread safe start flag that will be sent to the knowledge base on launch of the thread

Definition at line 123 of file WorkerThread.h.

BaseThread* madara::threads::WorkerThread::thread_
protected

the contained thread

Definition at line 105 of file WorkerThread.h.


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