SurgSim::Devices::TrackIRThread Class Reference

A class implementing the thread context for sampling TrackIR devices. More...

`#include <SurgSim/Devices/TrackIR/TrackIRThread.h>`

Inheritance diagram for SurgSim::Devices::TrackIRThread:

## Public Member Functions

| TrackIRThread (TrackIRScaffold *scaffold, TrackIRScaffold::DeviceData *deviceData)
| Constructor TrackIR sample rate: 120FPS. More...
virtual | ~TrackIRThread ()
| Destructor. More...
Public Member Functions inherited from SurgSim::Framework::BasicThread
| BasicThread (const std::string &name="Unknown Thread")
virtual | ~BasicThread () noexcept(false)
| C++11 introduced noexcept. More...
void | start (std::shared_ptr< Barrier > startupBarrier=nullptr, bool isSynchronous=false)
| C++11 introduced noexcept. More...
void | stop ()
| Stopping the execution, blocks until the running thread has actually stopped,. More...
void | setIdle (bool isIdle)
| Set/Unset the thread in an idle state (doUpdate() called or not in the update() method) More...
bool | isIdle ()
| Query if this thread is in idle state or not. More...
bool | isInitialized ()
| Query if this object is initialized. More...
bool | isRunning () const
| Query if this object is running. More...
void | operator() ()
| This is what boost::thread executes on thread creation. More...
boost::thread & | getThread ()
std::string | getName () const
void | setRate (double val)
| Set the update rate of the thread. More...
bool | setSynchronous (bool val)
| Sets the thread to synchronized execution in concert with the startup barrier, the startup barrier has to exist for this call to succeed. More...
bool | isSynchronous ()
| Query if this object is synchronized. More...
double | getCpuTime () const
size_t | getUpdateCount () const
void | resetCpuTimeAndUpdateCount ()
| Reset the cpu time and the update count to 0. More...

## Protected Member Functions

bool | doInitialize () override
| Initialize this thread. More...
bool | doStartUp () override
| Start up this thread. More...
bool | doUpdate (double dt) override
| Update work of this thread. More...
Protected Member Functions inherited from SurgSim::Framework::BasicThread
bool | initialize ()
| Trigger the initialization of this object, this will be called before all other threads doStartup() are called. More...
bool | startUp ()
| Trigger the startup of this object, this will be called after all other threads doInit() was called the thread will only enter the run loop triggering upated() if all threads doInit() and doStartup() returned true. More...
bool | waitForBarrier (bool success)
virtual bool | executeInitialization ()

## Private Attributes

TrackIRScaffold * | m_scaffold
TrackIRScaffold::DeviceData * | m_deviceData

## Additional Inherited Members

Protected Attributes inherited from SurgSim::Framework::BasicThread
Timer | m_timer
| Timer to measure the actual time taken to doUpdate. More...
std::shared_ptr< SurgSim::Framework::Logger > | m_logger
| Logger for this thread. More...

## Detailed Description

A class implementing the thread context for sampling TrackIR devices.

See also
  SurgSim::Devices::TrackIRScaffold

## Constructor & Destructor Documentation

## TrackIRThread()

SurgSim::Devices::TrackIRThread::TrackIRThread | ( | TrackIRScaffold * | scaffold,
|  | TrackIRScaffold::DeviceData * | deviceData
| ) |  |

Constructor TrackIR sample rate: 120FPS.

Default update rate is set by BasicThread constructor to 30Hz

Parameters

  scaffold | The TrackIRScaffold updated by this thread
  deviceData | Corresponds to the TrackIRScaffold::DeviceData updated by this thread

## ~TrackIRThread()

SurgSim::Devices::TrackIRThread::~TrackIRThread | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## doInitialize()

bool SurgSim::Devices::TrackIRThread::doInitialize | ( |  | ) |

override protected virtual

Initialize this thread.

Returns
  True on success, false otherwise.

Implements SurgSim::Framework::BasicThread.

## doStartUp()

bool SurgSim::Devices::TrackIRThread::doStartUp | ( |  | ) |

override protected virtual

Start up this thread.

Returns
  True on success, false otherwise.

Implements SurgSim::Framework::BasicThread.

## doUpdate()

bool SurgSim::Devices::TrackIRThread::doUpdate | ( | double | dt | ) |

override protected virtual

Update work of this thread.

Parameters

  dt | The time step.

Returns
  True on success, false otherwise.

Reimplemented from SurgSim::Framework::BasicThread.

## Member Data Documentation

## m_deviceData

TrackIRScaffold::DeviceData* SurgSim::Devices::TrackIRThread::m_deviceData

private

## m_scaffold

TrackIRScaffold* SurgSim::Devices::TrackIRThread::m_scaffold

private

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

- SurgSim/Devices/TrackIR/TrackIRThread.h
- SurgSim/Devices/TrackIR/TrackIRThread.cpp