RecordPose.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, 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_RECORDPOSE_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_RECORDPOSE_H
18 
19 #include <string>
20 
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 
29 SURGSIM_STATIC_REGISTRATION(RecordPose);
30 
33 class RecordPose : public DeviceFilter
34 {
35 public:
38  explicit RecordPose(const std::string& name);
39 
41  ~RecordPose();
42 
44  void setFileName(const std::string& fileName);
45 
47  const std::string& getFileName() const;
48 
49  void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
50 
52 
53 private:
54  void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
55  DataStructures::DataGroup* result) override;
56 
59 
62 
64  std::string m_fileName;
65 
67  std::ofstream m_outputFile;
68 };
69 
70 }; // namespace Devices
71 }; // namespace SurgSim
72 
73 #endif // SURGSIM_DEVICES_DEVICEFILTERS_RECORDPOSE_H
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::Framework::Timer
Timer class, measures execution times.
Definition: Timer.h:30
SurgSim::Devices::DeviceFilter
A device filter can be connected between a device and the InputConsumerInterface (e....
Definition: DeviceFilter.h:37
SurgSim::Devices::RecordPose::m_fileName
std::string m_fileName
Filename where the poses will be recorded.
Definition: RecordPose.h:64
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::RecordPose
An input device filter that record the input pose along with the relative time.
Definition: RecordPose.h:33
SurgSim::Devices::RecordPose::RecordPose
RecordPose(const std::string &name)
Constructor.
Definition: RecordPose.cpp:30
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::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
Timer.h
SurgSim::Devices::RecordPose::m_outputFile
std::ofstream m_outputFile
Output stream to the file 'm_fileName', the entire content is replaced at each run.
Definition: RecordPose.h:67
SurgSim::Devices::RecordPose::getFileName
const std::string & getFileName() const
Definition: RecordPose.cpp:53
SurgSim::Devices::RecordPose::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::RecordPose)
SurgSim::Devices::RecordPose::setFileName
void setFileName(const std::string &fileName)
Definition: RecordPose.cpp:48
SurgSim::Devices::RecordPose::~RecordPose
~RecordPose()
Desctructor.
Definition: RecordPose.cpp:40
SurgSim::Devices::RecordPose::m_timer
Framework::Timer m_timer
Timer to keep the recording real-time.
Definition: RecordPose.h:58
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
DeviceFilter.h