ReplayPoseScaffold.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
#define SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
#include <boost/thread/mutex.hpp>
#include <memory>
#include "SurgSim/DataStructures/DataGroup.h"
#include "SurgSim/Framework/BasicThread.h"
#include "SurgSim/Framework/Logger.h"
#include "SurgSim/Math/RigidTransform.h"
namespace SurgSim
{
namespace Devices
{
class ReplayPoseDevice;
class ReplayPoseScaffold : public SurgSim::Framework::BasicThread
{
friend class ReplayPoseDevice;
public:
ReplayPoseScaffold();
~ReplayPoseScaffold();
static std::shared_ptr<ReplayPoseScaffold> getOrCreateSharedInstance();
protected:
bool doInitialize() override;
bool doStartUp() override;
bool doUpdate(double dt) override;
private:
struct DeviceData;
bool registerDevice(ReplayPoseDevice* device);
bool unregisterDevice();
bool updateDevice(ReplayPoseScaffold::DeviceData* info);
static DataStructures::DataGroup buildDeviceInputData();
std::shared_ptr<Framework::Logger> m_logger;
boost::mutex m_deviceLock;
std::unique_ptr<DeviceData> m_device;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
SurgSim::Devices::ReplayPoseScaffold::DeviceData
Definition: ReplayPoseScaffold.cpp:91
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::ReplayPoseScaffold::ReplayPoseScaffold
ReplayPoseScaffold()
Constructor.
Definition: ReplayPoseScaffold.cpp:50
SurgSim::Devices::ReplayPoseScaffold::buildDeviceInputData
static DataStructures::DataGroup buildDeviceInputData()
Builds the data layout for the application input (i.e. device output).
Definition: ReplayPoseScaffold.cpp:273
DataGroup.h
SurgSim::Devices::ReplayPoseScaffold::doInitialize
bool doInitialize() override
Definition: ReplayPoseScaffold.cpp:72
SurgSim::Devices::ReplayPoseScaffold::unregisterDevice
bool unregisterDevice()
Unregisters the specified device object.
Definition: ReplayPoseScaffold.cpp:243
SurgSim::Devices::ReplayPoseScaffold::updateDevice
bool updateDevice(ReplayPoseScaffold::DeviceData *info)
Updates the device information for a single device.
Definition: ReplayPoseScaffold.cpp:258
SurgSim::Devices::ReplayPoseScaffold::registerDevice
bool registerDevice(ReplayPoseDevice *device)
Registers the specified device object.
Definition: ReplayPoseScaffold.cpp:207
SurgSim::Devices::ReplayPoseScaffold::getOrCreateSharedInstance
static std::shared_ptr< ReplayPoseScaffold > getOrCreateSharedInstance()
Gets or creates the scaffold shared by all RawMultiAxisDevice instances.
Definition: ReplayPoseScaffold.cpp:66
SurgSim::Devices::ReplayPoseScaffold::m_deviceLock
boost::mutex m_deviceLock
The ReplayPose device locking mechanism.
Definition: ReplayPoseScaffold.h:82
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
RigidTransform.h
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
SurgSim::Devices::ReplayPoseScaffold::doUpdate
bool doUpdate(double dt) override
Implementation of actual work function for this thread, this has a default implementation to handle d...
Definition: ReplayPoseScaffold.cpp:82
SurgSim::Framework::BasicThread
Basic thread implementation, tries to maintain a constant rate, supplies startup an initialization...
Definition: BasicThread.h:48
Logger.h
SurgSim::Devices::ReplayPoseScaffold
Definition: ReplayPoseScaffold.h:34
SurgSim::Devices::ReplayPoseScaffold::m_device
std::unique_ptr< DeviceData > m_device
The ReplayPose device managed by this scaffold.
Definition: ReplayPoseScaffold.h:85
SurgSim::Devices::ReplayPoseScaffold::~ReplayPoseScaffold
~ReplayPoseScaffold()
Destructor.
Definition: ReplayPoseScaffold.cpp:57
SurgSim::Devices::ReplayPoseScaffold::doStartUp
bool doStartUp() override
Definition: ReplayPoseScaffold.cpp:77
SurgSim::Devices::ReplayPoseDevice
A class implementing the replay pose device, which is a pretend device that replays a recorded motion...
Definition: ReplayPoseDevice.h:44
SurgSim::Devices::ReplayPoseScaffold::m_logger
std::shared_ptr< Framework::Logger > m_logger
Logger used by the scaffold and all devices.
Definition: ReplayPoseScaffold.h:79
BasicThread.h