BoolToScalar.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, 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_BOOLTOSCALAR_H
#define SURGSIM_DEVICES_DEVICEFILTERS_BOOLTOSCALAR_H
#include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
#include "SurgSim/Framework/Timer.h"
namespace SurgSim
{
namespace DataStructures
{
class DataGroupCopier;
}
namespace Devices
{
SURGSIM_STATIC_REGISTRATION(BoolToScalar);
class BoolToScalar : public DeviceFilter
{
public:
explicit BoolToScalar(const std::string& name);
~BoolToScalar();
SURGSIM_CLASSNAME(SurgSim::Devices::BoolToScalar);
void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result) override;
void setScale(double val);
double getScale() const;
void setRange(const std::pair<double, double>& val);
std::pair<double, double> getRange() const;
void setClamping(bool val);
bool isClamping();
void setIncreaseField(const std::string& val);
std::string getIncreaseField() const;
void setDecreaseField(const std::string& val);
std::string getDecreaseField() const;
void setScalar(double val);
double getScalar() const;
void setTargetField(const std::string& val);
std::string getTargetField() const;
private:
bool m_isClamping;
double m_value;
double m_scale;
std::pair<double, double> m_range;
std::string m_increaseField;
std::string m_decreaseField;
std::string m_targetField;
Framework::Timer m_timer;
std::shared_ptr<DataStructures::DataGroupCopier> m_copier;
};
}; // namespace Devices
}; // namespace SurgSim
#endif
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::BoolToScalar::m_timer
Framework::Timer m_timer
Definition: BoolToScalar.h:116
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::Devices::BoolToScalar::m_scale
double m_scale
Definition: BoolToScalar.h:108
SurgSim::Devices::BoolToScalar::m_isClamping
bool m_isClamping
Definition: BoolToScalar.h:104
SurgSim::Devices::BoolToScalar::m_targetField
std::string m_targetField
Definition: BoolToScalar.h:114
Timer.h
SurgSim::Framework::Timer
Timer class, measures execution times.
Definition: Timer.h:30
SurgSim::Devices::BoolToScalar::m_copier
std::shared_ptr< DataStructures::DataGroupCopier > m_copier
Definition: BoolToScalar.h:118
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::Devices::BoolToScalar::m_increaseField
std::string m_increaseField
Definition: BoolToScalar.h:112
SurgSim::Devices::BoolToScalar::m_decreaseField
std::string m_decreaseField
Definition: BoolToScalar.h:113
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Devices::BoolToScalar::m_range
std::pair< double, double > m_range
Definition: BoolToScalar.h:110
SurgSim::Devices::BoolToScalar
Maps the on and off state of two boolean values to the increase and decrease of a scalar field...
Definition: BoolToScalar.h:37
SurgSim::Devices::BoolToScalar::m_value
double m_value
Definition: BoolToScalar.h:106
DeviceFilter.h