3D Forest
Software for analysis of Lidar data from forest environment.
ThreadLoop Class Referenceabstract

#include <ThreadLoop.hpp>

Inherited by RenderThread.

Public Member Functions

 ThreadLoop ()
 
virtual ~ThreadLoop ()
 
void setCallback (ThreadCallbackInterface *callback)
 
void create ()
 
void start ()
 
void cancel ()
 
void stop ()
 
void wait ()
 
bool isRunning ()
 
virtual bool next ()=0
 

Protected Types

enum  State { STATE_RUN , STATE_CANCEL , STATE_EXIT }
 

Protected Member Functions

void setState (State state)
 
void runLoop ()
 

Protected Attributes

std::shared_ptr< std::thread > thread_
 
ThreadCallbackInterfacecallback_
 
std::mutex mutex_
 
std::condition_variable condition_
 
State state_
 
bool finished_
 
bool waiting_
 
std::mutex mutexCaller_
 
std::condition_variable conditionCaller_
 
bool received_
 

Member Enumeration Documentation

◆ State

enum ThreadLoop::State
protected

Thread state.

Enumerator
STATE_RUN 
STATE_CANCEL 
STATE_EXIT 

Constructor & Destructor Documentation

◆ ThreadLoop()

ThreadLoop::ThreadLoop ( )

◆ ~ThreadLoop()

ThreadLoop::~ThreadLoop ( )
virtual

Member Function Documentation

◆ cancel()

void ThreadLoop::cancel ( )

◆ create()

void ThreadLoop::create ( )

Referenced by MainWindow::MainWindow().

◆ isRunning()

bool ThreadLoop::isRunning ( )

◆ next()

virtual bool ThreadLoop::next ( )
pure virtual

Implemented in RenderThread.

Referenced by runLoop().

◆ runLoop()

void ThreadLoop::runLoop ( )
protected

Referenced by create().

◆ setCallback()

void ThreadLoop::setCallback ( ThreadCallbackInterface callback)

Referenced by MainWindow::MainWindow().

◆ setState()

void ThreadLoop::setState ( State  state)
protected

Referenced by cancel(), start(), and stop().

◆ start()

void ThreadLoop::start ( )

Referenced by RenderThread::render().

◆ stop()

void ThreadLoop::stop ( )

Referenced by MainWindow::~MainWindow().

◆ wait()

void ThreadLoop::wait ( )

Member Data Documentation

◆ callback_

ThreadCallbackInterface* ThreadLoop::callback_
protected

Referenced by RenderThread::next(), and setCallback().

◆ condition_

std::condition_variable ThreadLoop::condition_
protected

Referenced by runLoop(), setState(), and wait().

◆ conditionCaller_

std::condition_variable ThreadLoop::conditionCaller_
protected

Referenced by cancel(), and runLoop().

◆ finished_

bool ThreadLoop::finished_
protected

Referenced by runLoop(), and setState().

◆ mutex_

std::mutex ThreadLoop::mutex_
protected

Referenced by isRunning(), runLoop(), setState(), and wait().

◆ mutexCaller_

std::mutex ThreadLoop::mutexCaller_
protected

Referenced by cancel(), and runLoop().

◆ received_

bool ThreadLoop::received_
protected

Referenced by cancel(), and runLoop().

◆ state_

State ThreadLoop::state_
protected

Referenced by isRunning(), runLoop(), and setState().

◆ thread_

std::shared_ptr<std::thread> ThreadLoop::thread_
protected

Referenced by create(), stop(), and wait().

◆ waiting_

bool ThreadLoop::waiting_
protected

Referenced by runLoop(), and wait().


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