Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
SurgSim::Devices::OculusScaffold Class Reference

A class that manages Oculus Rift DK2 devices. More...

#include <SurgSim/Devices/Oculus/OculusScaffold.h>

Inheritance diagram for SurgSim::Devices::OculusScaffold:
SurgSim::Framework::BasicThread

Classes

struct  DeviceData
 
struct  StateData
 

Public Member Functions

 ~OculusScaffold ()
 Destructor. More...
 

Protected Member Functions

bool doInitialize () override
 
bool doStartUp () override
 
bool doUpdate (double dt) override
 Implementation of actual work function for this thread, this has a default implementation to handle destruction better, as it could be called while the thread is under destruction, if left unimplemented this would trigger a call to a pure virtual function. More...
 

Private Member Functions

 OculusScaffold ()
 Constructor. More...
 
bool registerDevice (OculusDevice *device)
 Registers the specified device object. More...
 
bool doRegisterDevice (DeviceData *info)
 Do the Oculus SDK specific registration. More...
 
bool unregisterDevice (const OculusDevice *device)
 Unregisters the specified device object. More...
 
bool initializeSdk ()
 Initializes Oculus SDK. More...
 
bool finalizeSdk ()
 Finalizes (de-initializes) Oculus SDK. More...
 
- Private 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...
 
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 ()
 

Static Private Member Functions

static std::shared_ptr< OculusScaffoldgetOrCreateSharedInstance ()
 Gets or creates the scaffold shared by all OculusDevice instances. More...
 
static SurgSim::DataStructures::DataGroup buildDeviceInputData ()
 Builds the data layout for the application input (i.e. device output). More...
 

Private Attributes

std::shared_ptr< SurgSim::Framework::Loggerm_logger
 Logger used by the scaffold and all devices. More...
 
std::unique_ptr< StateDatam_state
 Internal scaffold state. More...
 
- Private Attributes inherited from SurgSim::Framework::BasicThread
Timer m_timer
 Timer to measure the actual time taken to doUpdate. More...
 
std::shared_ptr< SurgSim::Framework::Loggerm_logger
 Logger for this thread. More...
 

Friends

class OculusDevice
 

Detailed Description

A class that manages Oculus Rift DK2 devices.

See also
SurgSim::Devices::OculusDevice

Constructor & Destructor Documentation

§ ~OculusScaffold()

SurgSim::Devices::OculusScaffold::~OculusScaffold ( )

Destructor.

§ OculusScaffold()

SurgSim::Devices::OculusScaffold::OculusScaffold ( )
private

Constructor.

Member Function Documentation

§ buildDeviceInputData()

SurgSim::DataStructures::DataGroup SurgSim::Devices::OculusScaffold::buildDeviceInputData ( )
staticprivate

Builds the data layout for the application input (i.e. device output).

§ doInitialize()

bool SurgSim::Devices::OculusScaffold::doInitialize ( )
overrideprotectedvirtual

§ doRegisterDevice()

bool SurgSim::Devices::OculusScaffold::doRegisterDevice ( DeviceData info)
private

Do the Oculus SDK specific registration.

Parameters
infoThe device data
Returns
true on success, false on failure.

§ doStartUp()

bool SurgSim::Devices::OculusScaffold::doStartUp ( )
overrideprotectedvirtual

§ doUpdate()

bool SurgSim::Devices::OculusScaffold::doUpdate ( double  dt)
overrideprotectedvirtual

Implementation of actual work function for this thread, this has a default implementation to handle destruction better, as it could be called while the thread is under destruction, if left unimplemented this would trigger a call to a pure virtual function.

Returns
false when the thread is done, this will stop execution

Reimplemented from SurgSim::Framework::BasicThread.

§ finalizeSdk()

bool SurgSim::Devices::OculusScaffold::finalizeSdk ( )
private

Finalizes (de-initializes) Oculus SDK.

Returns
true on success; false otherwise.

§ getOrCreateSharedInstance()

std::shared_ptr< OculusScaffold > SurgSim::Devices::OculusScaffold::getOrCreateSharedInstance ( )
staticprivate

Gets or creates the scaffold shared by all OculusDevice instances.

The scaffold is managed using a SharedInstance object, so it will be destroyed when all devices are released.

Returns
the scaffold object.

§ initializeSdk()

bool SurgSim::Devices::OculusScaffold::initializeSdk ( )
private

Initializes Oculus SDK.

Returns
true on success; false otherwise.

§ registerDevice()

bool SurgSim::Devices::OculusScaffold::registerDevice ( OculusDevice device)
private

Registers the specified device object.

Parameters
deviceThe device object to be used, which should have a unique name.
Returns
True if the initialization succeeds, false if it fails.

§ unregisterDevice()

bool SurgSim::Devices::OculusScaffold::unregisterDevice ( const OculusDevice device)
private

Unregisters the specified device object.

Parameters
deviceThe device object.
Returns
true on success, false on failure.

Friends And Related Function Documentation

§ OculusDevice

friend class OculusDevice
friend

Member Data Documentation

§ m_logger

std::shared_ptr<SurgSim::Framework::Logger> SurgSim::Devices::OculusScaffold::m_logger
private

Logger used by the scaffold and all devices.

§ m_state

std::unique_ptr<StateData> SurgSim::Devices::OculusScaffold::m_state
private

Internal scaffold state.


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