RecordPose.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, 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_RECORDPOSE_H
#define SURGSIM_DEVICES_DEVICEFILTERS_RECORDPOSE_H
#include <string>
#include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
#include "SurgSim/Framework/Timer.h"
namespace SurgSim
{
namespace Devices
{
SURGSIM_STATIC_REGISTRATION(RecordPose);
class RecordPose : public DeviceFilter
{
public:
explicit RecordPose(const std::string& name);
~RecordPose();
void setFileName(const std::string& fileName);
const std::string& getFileName() const;
void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
SURGSIM_CLASSNAME(SurgSim::Devices::RecordPose);
private:
void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result) override;
Framework::Timer m_timer;
double m_cumulativeTime;
std::string m_fileName;
std::ofstream m_outputFile;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_DEVICEFILTERS_RECORDPOSE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::RecordPose::~RecordPose
~RecordPose()
Desctructor.
Definition: RecordPose.cpp:40
SurgSim::Devices::RecordPose::initializeInput
void initializeInput(const std::string &device, const DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: RecordPose.cpp:58
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::RecordPose::m_timer
Framework::Timer m_timer
Timer to keep the recording real-time.
Definition: RecordPose.h:58
Timer.h
SurgSim::Framework::Timer
Timer class, measures execution times.
Definition: Timer.h:30
SurgSim::Devices::RecordPose::setFileName
void setFileName(const std::string &fileName)
Definition: RecordPose.cpp:48
SurgSim::Devices::RecordPose::RecordPose
RecordPose(const std::string &name)
Constructor.
Definition: RecordPose.cpp:30
SurgSim::Devices::RecordPose::getFileName
const std::string & getFileName() const
Definition: RecordPose.cpp:53
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Devices::RecordPose::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::RecordPose)
SurgSim::Devices::RecordPose::m_cumulativeTime
double m_cumulativeTime
Cumulative time elapsed since the timer started (on creation of the instance, in ctor) ...
Definition: RecordPose.h:61
SurgSim::Devices::RecordPose
An input device filter that record the input pose along with the relative time.
Definition: RecordPose.h:33
SurgSim::Devices::RecordPose::m_fileName
std::string m_fileName
Filename where the poses will be recorded.
Definition: RecordPose.h:64
SurgSim::Devices::RecordPose::filterInput
void filterInput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the input data.
Definition: RecordPose.cpp:71
SurgSim::Devices::RecordPose::m_outputFile
std::ofstream m_outputFile
Output stream to the file &#39;m_fileName&#39;, the entire content is replaced at each run.
Definition: RecordPose.h:67
DeviceFilter.h