InputComponent.h
Go to the documentation of this file.
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_INPUT_INPUTCOMPONENT_H
17 #define SURGSIM_INPUT_INPUTCOMPONENT_H
18 
19 #include <string>
20 #include <memory>
22 
23 namespace SurgSim
24 {
25 
26 namespace DataStructures
27 {
28 class DataGroup;
29 }
30 
31 namespace Input
32 {
33 class DeviceInterface;
34 class InputConsumer;
35 
36 SURGSIM_STATIC_REGISTRATION(InputComponent);
37 
42 {
43 public:
46  explicit InputComponent(const std::string& name);
47 
49  virtual ~InputComponent();
50 
52 
55  void setDeviceName(const std::string& deviceName);
56 
59  bool isDeviceConnected();
60 
64  void connectDevice(std::shared_ptr<SurgSim::Input::DeviceInterface> device);
65 
69  void disconnectDevice(std::shared_ptr<SurgSim::Input::DeviceInterface> device);
70 
74  void getData(SurgSim::DataStructures::DataGroup* dataGroup);
75 
77  virtual bool doInitialize() override;
78 
80  virtual bool doWakeUp() override;
81 
84  std::string getDeviceName() const;
85 
86 private:
92  std::shared_ptr<InputConsumer> m_input;
93 };
94 
95 }; // namespace Input
96 }; // namespace SurgSim
97 
98 
99 #endif
Definition: DriveElementFromInputBehavior.cpp:27
SURGSIM_STATIC_REGISTRATION(SerializationMockComponent)
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:43
InputComponent combines the Component interface and the InputConsumerInterface so that input devices ...
Definition: InputComponent.h:41
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::string m_deviceName
Name of the device to which this input component connects.
Definition: InputComponent.h:88
A collection of NamedData objects.
Definition: DataGroup.h:66
std::shared_ptr< InputConsumer > m_input
Input consumer which brings in information from hardware device.
Definition: InputComponent.h:92
bool m_deviceConnected
Indicates if this input component is connected to a device.
Definition: InputComponent.h:90