opensurgsim
OpenNIScaffold.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, 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_OPENNI_OPENNISCAFFOLD_H
17 #define SURGSIM_DEVICES_OPENNI_OPENNISCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/DataStructures/DataGroup.h"
22 #include "SurgSim/Framework/BasicThread.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Framework
28 {
29 class Logger;
30 };
31 
32 namespace Devices
33 {
34 
35 class OpenNIDevice;
36 
41 {
42 public:
44  virtual ~OpenNIScaffold();
45 
46 protected:
47  bool doInitialize() override;
48 
49  bool doStartUp() override;
50 
51  bool doUpdate(double dt) override;
52 
53 private:
55  struct StateData;
56 
58  struct DeviceData;
59 
60  friend class OpenNIDevice;
61 
64 
68  static std::shared_ptr<OpenNIScaffold> getOrCreateSharedInstance();
69 
73  bool registerDevice(OpenNIDevice* device);
74 
78  bool unregisterDevice(const OpenNIDevice* device);
79 
83  bool doRegisterDevice(DeviceData* info);
84 
88  bool doUnregisterDevice(DeviceData* info);
89 
91  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
92 
94  std::unique_ptr<StateData> m_state;
95 
97  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
98 };
99 
100 }; // namespace Devices
101 }; // namespace SurgSim
102 
103 #endif // SURGSIM_DEVICES_OPENNI_OPENNISCAFFOLD_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 OpenNI devices.
Definition: OpenNIScaffold.h:40
Definition: OpenNIScaffold.cpp:52
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
Definition: OpenNIScaffold.cpp:35
A class implementing the communication with one OpenNI compatible depth camera.
Definition: OpenNIDevice.h:41