opensurgsim
OutputComponent.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2016, 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_INPUT_OUTPUTCOMPONENT_H
17 #define SURGSIM_INPUT_OUTPUTCOMPONENT_H
18 
19 #include <string>
20 #include <memory>
21 
22 #include "SurgSim/DataStructures/DataGroup.h"
23 #include "SurgSim/Framework/LockedContainer.h"
24 #include "SurgSim/Framework/Representation.h"
25 #include "SurgSim/Input/OutputProducerInterface.h"
26 
27 
28 namespace SurgSim
29 {
30 
31 namespace Input
32 {
33 class DeviceInterface;
34 
35 SURGSIM_STATIC_REGISTRATION(OutputComponent);
36 
42 {
43 public:
46  explicit OutputComponent(const std::string& name);
48  virtual ~OutputComponent();
49 
50  SURGSIM_CLASSNAME(SurgSim::Input::OutputComponent);
51 
54  void setDeviceName(const std::string& deviceName);
55 
58  std::string getDeviceName() const;
59 
62  virtual void setData(const SurgSim::DataStructures::DataGroup& dataGroup);
63 
65  virtual bool doInitialize();
66 
68  virtual bool doWakeUp();
69 
70  bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData) override;
71 
74 
78 
81 
85 
86 private:
88  std::string m_deviceName;
89 
92 
94  bool m_haveData;
95 
96  SurgSim::Math::RigidTransform3d m_toElementTransform;
97 };
98 
99 }; // namespace Input
100 }; // namespace SurgSim
101 
102 
103 #endif
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
SurgSim::Math::RigidTransform3d getToDeviceTransform() const
Definition: OutputComponent.cpp:90
virtual bool doWakeUp()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:69
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
virtual ~OutputComponent()
Destructor.
Definition: OutputComponent.cpp:47
std::string getDeviceName() const
Gets device name.
Definition: OutputComponent.cpp:74
bool requestOutput(const std::string &device, SurgSim::DataStructures::DataGroup *outputData) override
Asks the producer to provide output state to the device.
Definition: OutputComponent.cpp:79
void setDeviceName(const std::string &deviceName)
Set name of the device of output component.
Definition: OutputComponent.cpp:51
void setToDeviceTransform(const SurgSim::Math::RigidTransform3d &val)
Sets the offset of the device pose to the scene.
Definition: OutputComponent.cpp:95
void setToElementTransform(const SurgSim::Math::RigidTransform3d &val)
Sets the offset of the device to the element origin.
Definition: OutputComponent.cpp:105
virtual void setData(const SurgSim::DataStructures::DataGroup &dataGroup)
Sets the output data.
Definition: OutputComponent.cpp:58
OutputComponent(const std::string &name)
Constructor.
Definition: OutputComponent.cpp:30
OutputComponents connect SceneElements to devices, facilitating data transfer from a SceneElement to ...
Definition: OutputComponent.h:41
virtual bool doInitialize()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:64
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Math::RigidTransform3d getToElementTransform() const
Definition: OutputComponent.cpp:100
Representations are manifestations of a SceneElement.
Definition: Representation.h:33