All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OutputComponent.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, 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>
22 
23 namespace SurgSim
24 {
25 
26 namespace DataStructures
27 {
28 class DataGroup;
29 }
30 
31 namespace Input
32 {
33 class DeviceInterface;
34 class OutputProducer;
35 
36 SURGSIM_STATIC_REGISTRATION(OutputComponent);
37 
41 {
42 public:
45  explicit OutputComponent(const std::string& name);
47  virtual ~OutputComponent();
48 
50 
53  void setDeviceName(const std::string& deviceName);
54 
57  bool isDeviceConnected();
58 
62  void connectDevice(std::shared_ptr<SurgSim::Input::DeviceInterface> device);
63 
67  void disconnectDevice(std::shared_ptr<SurgSim::Input::DeviceInterface> device);
68 
71  void setData(const SurgSim::DataStructures::DataGroup& dataGroup);
72 
74  virtual bool doInitialize();
75 
77  virtual bool doWakeUp();
78 
81  std::string getDeviceName() const;
82 
83 private:
85  std::string m_deviceName;
89  std::shared_ptr<OutputProducer> m_output;
90 };
91 
92 }; // namespace Input
93 }; // namespace SurgSim
94 
95 
96 #endif
virtual bool doWakeUp()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:107
std::shared_ptr< OutputProducer > m_output
Output producer which sends data to hardware device.
Definition: OutputComponent.h:89
virtual ~OutputComponent()
Destructor.
Definition: OutputComponent.cpp:83
void setDeviceName(const std::string &deviceName)
Set name of the device of output component.
Definition: OutputComponent.cpp:87
SURGSIM_STATIC_REGISTRATION(InputComponent)
void setData(const SurgSim::DataStructures::DataGroup &dataGroup)
Sets the output data.
Definition: OutputComponent.cpp:97
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:43
OutputComponent(const std::string &name)
Constructor.
Definition: OutputComponent.cpp:73
OutputComponent is a Component that has an OutputProducer, a concrete instance of OutputProducerInter...
Definition: OutputComponent.h:40
virtual bool doInitialize()
Overridden from Component, do nothing.
Definition: OutputComponent.cpp:102
std::string getDeviceName() const
Gets device name.
Definition: OutputComponent.cpp:112
SURGSIM_CLASSNAME(SurgSim::Input::OutputComponent)
A collection of NamedData objects.
Definition: DataGroup.h:66
std::string m_deviceName
Name of the device to which this output component connects.
Definition: OutputComponent.h:85
void disconnectDevice(std::shared_ptr< SurgSim::Input::DeviceInterface > device)
Disconnect from a device This call will be made by the InputManager, and should generally not be call...
Definition: OutputComponent.cpp:123
bool isDeviceConnected()
Is a device connected.
Definition: OutputComponent.cpp:92
void connectDevice(std::shared_ptr< SurgSim::Input::DeviceInterface > device)
Connect to a device This call will be made by the InputManager, and should generally not be called di...
Definition: OutputComponent.cpp:117
bool m_deviceConnected
Indicates if this output component is connected to a device.
Definition: OutputComponent.h:87