opensurgsim
TrakstarScaffold.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_TRAKSTAR_TRAKSTARSCAFFOLD_H
17 #define SURGSIM_DEVICES_TRAKSTAR_TRAKSTARSCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/BasicThread.h"
22 
23 namespace SurgSim
24 {
25 
26 namespace DataStructures
27 {
28 class DataGroup;
29 }
30 namespace Framework
31 {
32 class Barrier;
33 }
34 
35 namespace Devices
36 {
37 class TrakstarDevice;
38 
43 {
44 public:
47 
50 
54  static std::shared_ptr<TrakstarScaffold> getOrCreateSharedInstance();
55 
56 private:
58  struct StateData;
60  struct DeviceData;
61 
62  friend class TrakstarDevice;
63  friend struct StateData;
64 
68  bool isSuccess(int error);
69 
72  bool initializeSdk();
75  bool finalizeSdk();
76 
82  bool registerDevice(TrakstarDevice* device);
88  bool unregisterDevice(const TrakstarDevice* device);
89 
92  bool doInitialize() override;
95  bool doStartUp() override;
99  bool doUpdate(double dt) override;
102  void updateDevice(DeviceData* info);
103 
105  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
106 
108  std::unique_ptr<StateData> m_state;
109 
111  std::shared_ptr<Framework::Barrier> m_barrier;
112 };
113 
114 }; // namespace Devices
115 }; // namespace SurgSim
116 
117 #endif // SURGSIM_DEVICES_TRAKSTAR_TRAKSTARSCAFFOLD_H
A class implementing the communication with NDI&#39;s Trakstar electromagnetic tracker.
Definition: TrakstarDevice.h:46
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 TRAKSTAR devices.
Definition: TrakstarScaffold.h:42
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: TrakstarScaffold.cpp:63
Definition: TrakstarScaffold.cpp:90