DeviceFilter.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DEVICES_DEVICEFILTERS_DEVICEFILTER_H
#define SURGSIM_DEVICES_DEVICEFILTERS_DEVICEFILTER_H
#include <string>
#include "SurgSim/Input/CommonDevice.h"
#include "SurgSim/Input/InputConsumerInterface.h"
#include "SurgSim/Input/OutputProducerInterface.h"
namespace SurgSim
{
namespace DataStructures
{
class DataGroup;
}
namespace Devices
{
class DeviceFilter :
public Input::CommonDevice, public Input::InputConsumerInterface, public Input::OutputProducerInterface
{
public:
explicit DeviceFilter(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Devices::DeviceFilter);
bool initialize() override;
bool isInitialized() const override;
void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
void handleInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
bool requestOutput(const std::string& device, DataStructures::DataGroup* outputData) override;
protected:
virtual void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result);
virtual void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result);
protected:
bool finalize() override;
bool m_initialized;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_DEVICEFILTERS_DEVICEFILTER_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Input::OutputProducerInterface
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
SurgSim::Devices::DeviceFilter::m_initialized
bool m_initialized
true if initialized and not finalized.
Definition: DeviceFilter.h:78
SurgSim::Devices::DeviceFilter
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
SURGSIM_CLASSNAME
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
SurgSim::Input::InputConsumerInterface
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
InputConsumerInterface.h
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
OutputProducerInterface.h
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
CommonDevice.h