ReplayPoseScaffold.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
17 #define SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
18 
19 #include <boost/thread/mutex.hpp>
20 #include <memory>
21 
26 
27 namespace SurgSim
28 {
29 namespace Devices
30 {
31 
32 class ReplayPoseDevice;
33 
35 {
36  friend class ReplayPoseDevice;
37 
38 public:
41 
44 
48  static std::shared_ptr<ReplayPoseScaffold> getOrCreateSharedInstance();
49 
50 protected:
51  bool doInitialize() override;
52  bool doStartUp() override;
53  bool doUpdate(double dt) override;
54 
55 private:
57  struct DeviceData;
58 
63  bool registerDevice(ReplayPoseDevice* device);
64 
68  bool unregisterDevice();
69 
74 
77 
79  std::shared_ptr<Framework::Logger> m_logger;
80 
82  boost::mutex m_deviceLock;
83 
85  std::unique_ptr<DeviceData> m_device;
86 };
87 
88 }; // namespace Devices
89 }; // namespace SurgSim
90 
91 #endif // SURGSIM_DEVICES_REPLAYPOSEDEVICE_REPLAYPOSESCAFFOLD_H
Definition: ReplayPoseScaffold.cpp:91
Definition: CompoundShapeToGraphics.cpp:29
ReplayPoseScaffold()
Constructor.
Definition: ReplayPoseScaffold.cpp:50
static DataStructures::DataGroup buildDeviceInputData()
Builds the data layout for the application input (i.e. device output).
Definition: ReplayPoseScaffold.cpp:273
bool doInitialize() override
Definition: ReplayPoseScaffold.cpp:72
bool unregisterDevice()
Unregisters the specified device object.
Definition: ReplayPoseScaffold.cpp:243
bool updateDevice(ReplayPoseScaffold::DeviceData *info)
Updates the device information for a single device.
Definition: ReplayPoseScaffold.cpp:258
bool registerDevice(ReplayPoseDevice *device)
Registers the specified device object.
Definition: ReplayPoseScaffold.cpp:207
static std::shared_ptr< ReplayPoseScaffold > getOrCreateSharedInstance()
Gets or creates the scaffold shared by all RawMultiAxisDevice instances.
Definition: ReplayPoseScaffold.cpp:66
boost::mutex m_deviceLock
The ReplayPose device locking mechanism.
Definition: ReplayPoseScaffold.h:82
A collection of NamedData objects.
Definition: DataGroup.h:68
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
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
Basic thread implementation, tries to maintain a constant rate, supplies startup an initialization...
Definition: BasicThread.h:48
Definition: ReplayPoseScaffold.h:34
std::unique_ptr< DeviceData > m_device
The ReplayPose device managed by this scaffold.
Definition: ReplayPoseScaffold.h:85
~ReplayPoseScaffold()
Destructor.
Definition: ReplayPoseScaffold.cpp:57
bool doStartUp() override
Definition: ReplayPoseScaffold.cpp:77
A class implementing the replay pose device, which is a pretend device that replays a recorded motion...
Definition: ReplayPoseDevice.h:44
std::shared_ptr< Framework::Logger > m_logger
Logger used by the scaffold and all devices.
Definition: ReplayPoseScaffold.h:79