SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CVD::Thread Class Reference

#include <thread.h>

Inheritance diagram for CVD::Thread:
CVD::Runnable MapMaker

Public Member Functions

 Thread ()
 Construct a thread. If runnable != 0, use that runnable, else use our own "run" method. More...
 
virtual ~Thread ()
 This does not destroy the object until the thread has been terminated. More...
 
void start (Runnable *runnable=0)
 Start execution of "run" method in separate thread. More...
 
void stop ()
 Tell the thread to stop. More...
 
bool shouldStop () const
 Returns true if the stop() method been called, false otherwise. More...
 
bool isRunning () const
 Returns true if the thread is still running. More...
 
void join ()
 This blocks until the thread has actually terminated. More...
 
pthread_t getID ()
 Get the ID of this thread. More...
 
virtual void run ()
 Override this method to do whatever it is the thread should do. More...
 
- Public Member Functions inherited from CVD::Runnable
virtual ~Runnable ()
 

Static Public Member Functions

static unsigned int count ()
 Returns how many threads are actually running, not including the main thread. More...
 
static ThreadgetCurrent ()
 Returns a pointer to the currently running thread. More...
 
static void sleep (unsigned int milli)
 Tell the current thread to sleep for milli milliseconds. More...
 
static void yield ()
 Tell the current thread to yield the processor. More...
 

Static Private Member Functions

static bool init ()
 
static void * threadproc (void *param)
 

Private Attributes

RunnablemyRunnable
 
pthread_t myID
 
bool myRunningFlag
 
bool myStopFlag
 

Static Private Attributes

static bool ourInitializedFlag = false
 
static pthread_key_t ourKey
 
static unsigned int ourCount
 

Detailed Description

The Thread class encapsulates a thread of execution. It is implemented with POSIX threads. Code that uses this class should link with libpthread and librt (for nanosleep).

Definition at line 13 of file thread.h.

Constructor & Destructor Documentation

CVD::Thread::Thread ( )

Construct a thread. If runnable != 0, use that runnable, else use our own "run" method.

The constructor performs global initialization of the Thread class if necessary.

Definition at line 12 of file thread.cpp.

CVD::Thread::~Thread ( )
virtual

This does not destroy the object until the thread has been terminated.

Calls stop() and join() if the thread is alive.

Definition at line 22 of file thread.cpp.

Member Function Documentation

unsigned int CVD::Thread::count ( )
static

Returns how many threads are actually running, not including the main thread.

Definition at line 68 of file thread.cpp.

Thread * CVD::Thread::getCurrent ( )
static

Returns a pointer to the currently running thread.

Definition at line 73 of file thread.cpp.

pthread_t CVD::Thread::getID ( )

Get the ID of this thread.

Definition at line 63 of file thread.cpp.

bool CVD::Thread::init ( )
staticprivate

Definition at line 91 of file thread.cpp.

bool CVD::Thread::isRunning ( ) const

Returns true if the thread is still running.

Definition at line 53 of file thread.cpp.

void CVD::Thread::join ( )

This blocks until the thread has actually terminated.

If the thread is infinite looping, this will block forever!

Definition at line 58 of file thread.cpp.

virtual void CVD::Thread::run ( )
inlinevirtual

Override this method to do whatever it is the thread should do.

Implements CVD::Runnable.

Reimplemented in MapMaker.

Definition at line 43 of file thread.h.

bool CVD::Thread::shouldStop ( ) const

Returns true if the stop() method been called, false otherwise.

Definition at line 48 of file thread.cpp.

void CVD::Thread::sleep ( unsigned int  milli)
static

Tell the current thread to sleep for milli milliseconds.

Uses nanosleep.

Definition at line 79 of file thread.cpp.

void CVD::Thread::start ( Runnable runnable = 0)

Start execution of "run" method in separate thread.

Use PThreads to create a new thread.

Definition at line 32 of file thread.cpp.

void CVD::Thread::stop ( )

Tell the thread to stop.

This doesn't make the thread actually stop, it just causes shouldStop() to return true.

Definition at line 43 of file thread.cpp.

void * CVD::Thread::threadproc ( void *  param)
staticprivate

Definition at line 98 of file thread.cpp.

static void CVD::Thread::yield ( )
static

Tell the current thread to yield the processor.

Member Data Documentation

pthread_t CVD::Thread::myID
private

Definition at line 66 of file thread.h.

Runnable* CVD::Thread::myRunnable
private

Definition at line 65 of file thread.h.

bool CVD::Thread::myRunningFlag
private

Definition at line 67 of file thread.h.

bool CVD::Thread::myStopFlag
private

Definition at line 68 of file thread.h.

unsigned int CVD::Thread::ourCount
staticprivate

Definition at line 64 of file thread.h.

bool CVD::Thread::ourInitializedFlag = false
staticprivate

Definition at line 61 of file thread.h.

pthread_key_t CVD::Thread::ourKey
staticprivate

Definition at line 63 of file thread.h.


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