opensurgsim
KeyboardScaffold.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_KEYBOARD_KEYBOARDSCAFFOLD_H
17 #define SURGSIM_DEVICES_KEYBOARD_KEYBOARDSCAFFOLD_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 KeyboardDevice;
34 class OsgKeyboardHandler;
35 
39 {
40  friend class KeyboardDevice;
41  friend class KeyboardDeviceTest;
42  friend class OsgKeyboardHandler;
43 
44 public:
49 
53  static std::shared_ptr<KeyboardScaffold> getOrCreateSharedInstance();
54 
55 private:
57  struct DeviceData;
58 
63  bool registerDevice(KeyboardDevice* device);
64 
68  bool unregisterDevice();
69 
74  bool updateDevice(int key, int modifierMask);
75 
78  OsgKeyboardHandler* getKeyboardHandler() const;
79 
81  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
82 
84  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
86  std::unique_ptr<DeviceData> m_device;
87 };
88 
89 }; // namespace Devices
90 }; // namespace SurgSim
91 
92 #endif // SURGSIM_DEVICES_KEYBOARD_KEYBOARDSCAFFOLD_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A class implementing the communication with a keyboard.
Definition: KeyboardDevice.h:46
A class that implements the behavior of KeyboardDevice objects.
Definition: KeyboardScaffold.h:38
A collection of NamedData objects.
Definition: DataGroup.h:68
Definition: OsgKeyboardHandler.h:30
Definition: KeyboardDeviceTest.cpp:35
Struct to hold a KeyboardDevice object, a KeyboardHandler object, and a mutex for data passing...
Definition: KeyboardScaffold.cpp:31