opensurgsim
RecordPose.h
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 
21 #include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
22 #include "SurgSim/Framework/Timer.h"
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 
29 SURGSIM_STATIC_REGISTRATION(RecordPose);
30 
34 class RecordPose : public DeviceFilter
35 {
36 public:
39  explicit RecordPose(const std::string& name);
40 
42  ~RecordPose();
43 
45  void setFileName(const std::string& fileName);
46 
48  const std::string& getFileName() const;
49 
50  void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
51 
52  SURGSIM_CLASSNAME(SurgSim::Devices::RecordPose);
53 
54 private:
55  void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
56  DataStructures::DataGroup* result) override;
57 
59  Framework::Timer m_timer;
60 
62  double m_cumulativeTime;
63 
65  std::string m_fileName;
66 
68  std::ofstream m_outputFile;
69 };
70 
71 }; // namespace Devices
72 }; // namespace SurgSim
73 
74 #endif // SURGSIM_DEVICES_DEVICEFILTERS_RECORDPOSE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
~RecordPose()
Desctructor.
Definition: RecordPose.cpp:40
void initializeInput(const std::string &device, const DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: RecordPose.cpp:58
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
Timer class, measures execution times.
Definition: Timer.h:31
void setFileName(const std::string &fileName)
Definition: RecordPose.cpp:48
RecordPose(const std::string &name)
Constructor.
Definition: RecordPose.cpp:30
const std::string & getFileName() const
Definition: RecordPose.cpp:53
A collection of NamedData objects.
Definition: DataGroup.h:68
An input device filter that record the input pose along with the relative time.
Definition: RecordPose.h:34