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

#include <SurgSim/Devices/ReplayPoseDevice/ReplayPoseScaffold.h>

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

Classes

struct  DeviceData
 

Public Member Functions

 ReplayPoseScaffold ()
 Constructor. More...
 
 ~ReplayPoseScaffold ()
 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...
 

Static Public Member Functions

static std::shared_ptr< ReplayPoseScaffoldgetOrCreateSharedInstance ()
 Gets or creates the scaffold shared by all RawMultiAxisDevice instances. 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...
 
- 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 Member Functions

bool registerDevice (ReplayPoseDevice *device)
 Registers the specified device object. More...
 
bool unregisterDevice ()
 Unregisters the specified device object. More...
 
bool updateDevice (ReplayPoseScaffold::DeviceData *info)
 Updates the device information for a single device. More...
 

Static Private Member Functions

static DataStructures::DataGroup buildDeviceInputData ()
 Builds the data layout for the application input (i.e. device output). More...
 

Private Attributes

std::shared_ptr< Framework::Loggerm_logger
 Logger used by the scaffold and all devices. More...
 
boost::mutex m_deviceLock
 The ReplayPose device locking mechanism. More...
 
std::unique_ptr< DeviceDatam_device
 The ReplayPose device managed by this scaffold. More...
 

Friends

class ReplayPoseDevice
 

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::Loggerm_logger
 Logger for this thread. More...
 

Constructor & Destructor Documentation

◆ ReplayPoseScaffold()

SurgSim::Devices::ReplayPoseScaffold::ReplayPoseScaffold ( )

Constructor.

◆ ~ReplayPoseScaffold()

SurgSim::Devices::ReplayPoseScaffold::~ReplayPoseScaffold ( )

Destructor.

Member Function Documentation

◆ buildDeviceInputData()

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

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

◆ doInitialize()

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

◆ doStartUp()

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

◆ doUpdate()

bool SurgSim::Devices::ReplayPoseScaffold::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.

◆ getOrCreateSharedInstance()

std::shared_ptr< ReplayPoseScaffold > SurgSim::Devices::ReplayPoseScaffold::getOrCreateSharedInstance ( )
static

Gets or creates the scaffold shared by all RawMultiAxisDevice instances.

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

Returns
the scaffold object.

◆ registerDevice()

bool SurgSim::Devices::ReplayPoseScaffold::registerDevice ( ReplayPoseDevice device)
private

Registers the specified device object.

If successful, the device object will become connected to an hardware device.

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::ReplayPoseScaffold::unregisterDevice ( )
private

Unregisters the specified device object.

The corresponding controller will become unused, and can be re-registered later.

Returns
True on success, false on failure.

◆ updateDevice()

bool SurgSim::Devices::ReplayPoseScaffold::updateDevice ( ReplayPoseScaffold::DeviceData info)
private

Updates the device information for a single device.

Parameters
infoThe information to update the device from
Returns
True on success.

Friends And Related Function Documentation

◆ ReplayPoseDevice

friend class ReplayPoseDevice
friend

Member Data Documentation

◆ m_device

std::unique_ptr<DeviceData> SurgSim::Devices::ReplayPoseScaffold::m_device
private

The ReplayPose device managed by this scaffold.

◆ m_deviceLock

boost::mutex SurgSim::Devices::ReplayPoseScaffold::m_deviceLock
private

The ReplayPose device locking mechanism.

◆ m_logger

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

Logger used by the scaffold and all devices.


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