opensurgsim
DeviceFilter.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_DEVICEFILTERS_DEVICEFILTER_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_DEVICEFILTER_H
18 
19 #include <string>
20 
21 #include "SurgSim/Input/CommonDevice.h"
22 #include "SurgSim/Input/InputConsumerInterface.h"
23 #include "SurgSim/Input/OutputProducerInterface.h"
24 
25 namespace SurgSim
26 {
27 namespace DataStructures
28 {
29 class DataGroup;
30 }
31 
32 namespace Devices
33 {
34 
37 class DeviceFilter :
39 {
40 public:
43  explicit DeviceFilter(const std::string& name);
44 
45  SURGSIM_CLASSNAME(SurgSim::Devices::DeviceFilter);
46 
47  bool initialize() override;
48 
49  bool isInitialized() const override;
50 
51  void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
52 
53  void handleInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
54 
55  bool requestOutput(const std::string& device, DataStructures::DataGroup* outputData) override;
56 
57 protected:
63  virtual void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
65 
71  virtual void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
73 
74 protected:
75  bool finalize() override;
76 
79 };
80 
81 }; // namespace Devices
82 }; // namespace SurgSim
83 
84 #endif // SURGSIM_DEVICES_DEVICEFILTERS_DEVICEFILTER_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
bool m_initialized
true if initialized and not finalized.
Definition: DeviceFilter.h:78
A device filter can be connected between a device and the InputConsumerInterface (e.g., InputComponent) and/or the OutputProducerInterface (e.g., OutputComponent), and can alter the data being passed from/to the device.
Definition: DeviceFilter.h:37
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
A collection of NamedData objects.
Definition: DataGroup.h:68
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35