ApraLinuxUtils 1.0.0
C++ utility library for embedded Linux systems
 
Loading...
Searching...
No Matches
apra::ProcessThread Class Referenceabstract

#include <ProcessThread.h>

Inheritance diagram for apra::ProcessThread:
apra::I2C_Interface

Public Member Functions

 ProcessThread (string name, int64_t freq=0)
 
virtual ~ProcessThread ()
 
void setType (THREAD_TYPE t)
 
int32_t begin ()
 
virtual int32_t end ()
 
virtual void process (Message *obj)=0
 
bool shouldIquit ()
 
string getName ()
 
void enque (Message *p)
 
THREAD_TYPE getType ()
 
void setFPS (int64_t fps)
 
Messagedequeue ()
 

Protected Member Functions

int32_t mainLoop ()
 
void someFunction (bool &executedOnce)
 
void enqueResponse (Message *message)
 
void trimQueue (std::queue< Message * > &queue)
 

Static Protected Member Functions

static void * beginProxy (void *arg)
 

Protected Attributes

string m_threadname
 
pthread_t m_threadID
 
int64_t m_frequSec
 
std::queue< Message * > m_requestQueue
 
std::queue< Message * > m_responseQueue
 
THREAD_TYPE m_typeofThread
 
Mutex m_requestLock
 
Mutex m_responseLock
 
bool m_shouldIquit
 
uint32_t m_queueSizeLimit
 

Detailed Description

Definition at line 33 of file ProcessThread.h.

Constructor & Destructor Documentation

◆ ProcessThread()

apra::ProcessThread::ProcessThread ( string  name,
int64_t  freq = 0 
)

Definition at line 22 of file ProcessThread.cpp.

References setFPS().

◆ ~ProcessThread()

apra::ProcessThread::~ProcessThread ( )
virtual

Definition at line 30 of file ProcessThread.cpp.

References getName().

Member Function Documentation

◆ begin()

int32_t apra::ProcessThread::begin ( )

Definition at line 78 of file ProcessThread.cpp.

References beginProxy(), m_shouldIquit, and m_threadID.

◆ beginProxy()

void * apra::ProcessThread::beginProxy ( void *  arg)
staticprotected

Definition at line 64 of file ProcessThread.cpp.

References getName(), m_threadID, and mainLoop().

Referenced by begin().

◆ dequeue()

Message * apra::ProcessThread::dequeue ( )

Definition at line 216 of file ProcessThread.cpp.

References m_responseLock, and m_responseQueue.

◆ end()

int32_t apra::ProcessThread::end ( )
virtual

Definition at line 86 of file ProcessThread.cpp.

References getName(), m_shouldIquit, and m_threadID.

◆ enque()

void apra::ProcessThread::enque ( Message p)

Definition at line 111 of file ProcessThread.cpp.

References m_requestLock, m_requestQueue, and trimQueue().

◆ enqueResponse()

void apra::ProcessThread::enqueResponse ( Message message)
protected

Definition at line 157 of file ProcessThread.cpp.

References m_responseLock, m_responseQueue, and trimQueue().

Referenced by apra::I2C_Interface::processMessage().

◆ getName()

string apra::ProcessThread::getName ( )

Definition at line 49 of file ProcessThread.cpp.

References m_threadname.

Referenced by beginProxy(), end(), mainLoop(), and ~ProcessThread().

◆ getType()

THREAD_TYPE apra::ProcessThread::getType ( void  )

Definition at line 59 of file ProcessThread.cpp.

References m_typeofThread.

◆ mainLoop()

int32_t apra::ProcessThread::mainLoop ( )
protected

Definition at line 117 of file ProcessThread.cpp.

References getName(), m_frequSec, m_threadID, PROCESSTIME, shouldIquit(), and someFunction().

Referenced by beginProxy().

◆ process()

virtual void apra::ProcessThread::process ( Message obj)
pure virtual

Implemented in apra::I2C_Interface.

Referenced by someFunction().

◆ setFPS()

void apra::ProcessThread::setFPS ( int64_t  fps)

Definition at line 37 of file ProcessThread.cpp.

References m_frequSec.

Referenced by ProcessThread().

◆ setType()

void apra::ProcessThread::setType ( THREAD_TYPE  t)

Definition at line 54 of file ProcessThread.cpp.

References m_typeofThread.

◆ shouldIquit()

bool apra::ProcessThread::shouldIquit ( )

Definition at line 45 of file ProcessThread.cpp.

References m_shouldIquit.

Referenced by mainLoop().

◆ someFunction()

void apra::ProcessThread::someFunction ( bool &  executedOnce)
protected

◆ trimQueue()

void apra::ProcessThread::trimQueue ( std::queue< Message * > &  queue)
protected

Definition at line 202 of file ProcessThread.cpp.

References m_queueSizeLimit.

Referenced by enque(), and enqueResponse().

Member Data Documentation

◆ m_frequSec

int64_t apra::ProcessThread::m_frequSec
protected

◆ m_queueSizeLimit

uint32_t apra::ProcessThread::m_queueSizeLimit
protected

Definition at line 64 of file ProcessThread.h.

Referenced by trimQueue().

◆ m_requestLock

Mutex apra::ProcessThread::m_requestLock
protected

Definition at line 61 of file ProcessThread.h.

Referenced by enque(), apra::I2C_Interface::process(), and someFunction().

◆ m_requestQueue

std::queue<Message*> apra::ProcessThread::m_requestQueue
protected

Definition at line 58 of file ProcessThread.h.

Referenced by enque(), apra::I2C_Interface::process(), and someFunction().

◆ m_responseLock

Mutex apra::ProcessThread::m_responseLock
protected

Definition at line 62 of file ProcessThread.h.

Referenced by dequeue(), and enqueResponse().

◆ m_responseQueue

std::queue<Message*> apra::ProcessThread::m_responseQueue
protected

Definition at line 59 of file ProcessThread.h.

Referenced by dequeue(), and enqueResponse().

◆ m_shouldIquit

bool apra::ProcessThread::m_shouldIquit
protected

Definition at line 63 of file ProcessThread.h.

Referenced by begin(), end(), and shouldIquit().

◆ m_threadID

pthread_t apra::ProcessThread::m_threadID
protected

Definition at line 56 of file ProcessThread.h.

Referenced by begin(), beginProxy(), end(), and mainLoop().

◆ m_threadname

string apra::ProcessThread::m_threadname
protected

Definition at line 55 of file ProcessThread.h.

Referenced by getName().

◆ m_typeofThread

THREAD_TYPE apra::ProcessThread::m_typeofThread
protected

Definition at line 60 of file ProcessThread.h.

Referenced by getType(), setType(), and someFunction().


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