opensurgsim
TrackIRScaffold.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_TRACKIR_TRACKIRSCAFFOLD_H
17 #define SURGSIM_DEVICES_TRACKIR_TRACKIRSCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/Logger.h"
22 
23 namespace SurgSim
24 {
25 
26 namespace DataStructures
27 {
28 class DataGroup;
29 }
30 
31 namespace Devices
32 {
33 class TrackIRDevice;
34 
39 {
40 public:
43 
45  ~TrackIRScaffold();
46 
50  static std::shared_ptr<TrackIRScaffold> getOrCreateSharedInstance();
51 
52 private:
54  struct StateData;
56  struct DeviceData;
57 
58  friend class TrackIRDevice;
59  friend class TrackIRThread;
60  friend struct StateData;
61 
67  bool registerDevice(TrackIRDevice* device);
73  bool unregisterDevice(const TrackIRDevice* device);
74 
78  void setPositionScale(const TrackIRDevice* device, double scale);
82  void setOrientationScale(const TrackIRDevice* device, double scale);
83 
86  bool initializeSdk();
89  bool finalizeSdk();
90 
94  bool startCamera(DeviceData* info);
98  bool stopCamera(DeviceData* info);
99 
104  bool runInputFrame(DeviceData* info);
105 
109  bool updateDevice(DeviceData* info);
110 
114  bool createPerDeviceThread(DeviceData* data);
118  bool destroyPerDeviceThread(DeviceData* data);
119 
121  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
122 
124  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
125 
127  std::unique_ptr<StateData> m_state;
128 };
129 
130 }; // namespace Devices
131 }; // namespace SurgSim
132 
133 #endif // SURGSIM_DEVICES_TRACKIR_TRACKIRSCAFFOLD_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 Natural Point TRACKIR devices.
Definition: TrackIRScaffold.h:38
A class implementing the communication with Natural Point TrackIR camera.
Definition: TrackIRDevice.h:44
Definition: TrackIRScaffold.cpp:49
A collection of NamedData objects.
Definition: DataGroup.h:68
A class implementing the thread context for sampling TrackIR devices.
Definition: TrackIRThread.h:29
Definition: TrackIRScaffold.cpp:80