opensurgsim
OculusScaffold.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 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_OCULUS_OCULUSSCAFFOLD_H
17 #define SURGSIM_DEVICES_OCULUS_OCULUSSCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/DataStructures/DataGroup.h"
22 #include "SurgSim/Framework/BasicThread.h"
23 
24 namespace SurgSim
25 {
26 namespace Framework
27 {
28 class Logger;
29 }
30 };
31 
32 namespace SurgSim
33 {
34 
35 namespace Devices
36 {
37 class OculusDevice;
38 
43 {
44 public:
46  ~OculusScaffold();
47 
48 protected:
49  bool doInitialize() override;
50  bool doStartUp() override;
51  bool doUpdate(double dt) override;
52 
53 private:
55  struct StateData;
56 
58  struct DeviceData;
59 
60  friend class OculusDevice;
61 
64 
68  static std::shared_ptr<OculusScaffold> getOrCreateSharedInstance();
69 
73  bool registerDevice(OculusDevice* device);
74 
78  bool doRegisterDevice(DeviceData* info);
79 
83  bool unregisterDevice(const OculusDevice* device);
84 
87  bool initializeSdk();
88 
91  bool finalizeSdk();
92 
94  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
95 
97  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
98 
100  std::unique_ptr<StateData> m_state;
101 };
102 
103 }; // namespace Devices
104 }; // namespace SurgSim
105 
106 #endif // SURGSIM_DEVICES_OCULUS_OCULUSSCAFFOLD_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A class that manages Oculus Rift DK2 devices.
Definition: OculusScaffold.h:42
Definition: OculusScaffold.cpp:51
A class implementing the communication with Oculus Rift DK2.
Definition: OculusDevice.h:48
Definition: OculusScaffold.cpp:81
A collection of NamedData objects.
Definition: DataGroup.h:68
Basic thread implementation, tries to maintain a constant rate, supplies startup an initialization...
Definition: BasicThread.h:48