OutputComponent.h
Go to the documentation of this file.
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 
26 
27 
28 namespace SurgSim
29 {
30 
31 namespace Input
32 {
33 class DeviceInterface;
34 
35 SURGSIM_STATIC_REGISTRATION(OutputComponent);
36 
40 {
41 public:
44  explicit OutputComponent(const std::string& name);
46  virtual ~OutputComponent();
47 
49 
52  void setDeviceName(const std::string& deviceName);
53 
56  std::string getDeviceName() const;
57 
60  virtual void setData(const SurgSim::DataStructures::DataGroup& dataGroup);
61 
63  virtual bool doInitialize();
64 
66  virtual bool doWakeUp();
67 
68  bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData) override;
69 
70 private:
72  std::string m_deviceName;
73 
76 
78  bool m_haveData;
79 };
80 
81 }; // namespace Input
82 }; // namespace SurgSim
83 
84 
85 #endif
SurgSim::Input::OutputComponent::~OutputComponent
virtual ~OutputComponent()
Destructor.
Definition: OutputComponent.cpp:37
SurgSim::Input::OutputComponent::doWakeUp
virtual bool doWakeUp()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:59
SurgSim::Input::OutputComponent::getDeviceName
std::string getDeviceName() const
Gets device name.
Definition: OutputComponent.cpp:64
LockedContainer.h
SurgSim::Input::OutputComponent::setDeviceName
void setDeviceName(const std::string &deviceName)
Set name of the device of output component.
Definition: OutputComponent.cpp:41
SurgSim::Input::OutputComponent::requestOutput
bool requestOutput(const std::string &device, SurgSim::DataStructures::DataGroup *outputData) override
Asks the producer to provide output state to the device.
Definition: OutputComponent.cpp:69
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Input::OutputComponent::setData
virtual void setData(const SurgSim::DataStructures::DataGroup &dataGroup)
Sets the output data.
Definition: OutputComponent.cpp:48
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Input::OutputComponent::doInitialize
virtual bool doInitialize()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:54
SurgSim::Framework::LockedContainer< SurgSim::DataStructures::DataGroup >
SurgSim::Input::OutputComponent::m_haveData
bool m_haveData
True if there is data available.
Definition: OutputComponent.h:78
SurgSim::Input::OutputComponent::OutputComponent
OutputComponent(const std::string &name)
Constructor.
Definition: OutputComponent.cpp:29
SurgSim::Input::OutputProducerInterface
Interface for a producer that generates device output updates (forces, status LED state,...
Definition: OutputProducerInterface.h:33
SurgSim::Framework::Representation
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
SurgSim::Input::OutputComponent::m_lastOutput
SurgSim::Framework::LockedContainer< SurgSim::DataStructures::DataGroup > m_lastOutput
Thread safe container of most recent output data.
Definition: OutputComponent.h:75
SurgSim::Input::OutputComponent::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Input::OutputComponent)
SurgSim::Input::OutputComponent::m_deviceName
std::string m_deviceName
Name of the device to which this output component connects.
Definition: OutputComponent.h:72
Representation.h
SurgSim::Input::OutputComponent
OutputComponents connect SceneElements to devices, facilitating data transfer from a SceneElement to ...
Definition: OutputComponent.h:39
DataGroup.h
OutputProducerInterface.h