opensurgsim
ReplayPoseScaffold.h
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 
22 #include "SurgSim/DataStructures/DataGroup.h"
23 #include "SurgSim/Framework/BasicThread.h"
24 #include "SurgSim/Framework/Logger.h"
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 
73  bool updateDevice(ReplayPoseScaffold::DeviceData* info);
74 
76  static DataStructures::DataGroup buildDeviceInputData();
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:93
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
ReplayPoseScaffold()
Constructor.
Definition: ReplayPoseScaffold.cpp:52
static std::shared_ptr< ReplayPoseScaffold > getOrCreateSharedInstance()
Gets or creates the scaffold shared by all ReplayPoseDevice instances.
Definition: ReplayPoseScaffold.cpp:68
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:84
Basic thread implementation, tries to maintain a constant rate, supplies startup an initialization...
Definition: BasicThread.h:48
Definition: ReplayPoseScaffold.h:34
~ReplayPoseScaffold()
Destructor.
Definition: ReplayPoseScaffold.cpp:59
A class implementing the replay pose device, which is a pretend device that replays a recorded motion...
Definition: ReplayPoseDevice.h:46