All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DeviceInterface.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_DEVICEINTERFACE_H
17 #define SURGSIM_INPUT_DEVICEINTERFACE_H
18 
19 #include <memory>
20 #include <string>
21 
24 
25 namespace SurgSim
26 {
27 namespace Input
28 {
29 
30 
40 {
41 public:
43  virtual ~DeviceInterface()
44  {
45  }
46 
48  virtual std::string getName() const = 0;
49 
54  virtual bool initialize() = 0;
55 
60  virtual bool addInputConsumer(std::shared_ptr<InputConsumerInterface> inputConsumer) = 0;
61 
64  virtual bool removeInputConsumer(std::shared_ptr<InputConsumerInterface> inputConsumer) = 0;
65 
71  virtual bool setOutputProducer(std::shared_ptr<OutputProducerInterface> outputProducer) = 0;
72 
75  virtual bool removeOutputProducer(std::shared_ptr<OutputProducerInterface> outputProducer) = 0;
76 
79  virtual bool hasOutputProducer() = 0;
80 
81 protected:
83  virtual bool finalize() = 0;
84 };
85 
86 
87 }; // namespace Input
88 }; // namespace SurgSim
89 
90 #endif // SURGSIM_INPUT_DEVICEINTERFACE_H
virtual bool setOutputProducer(std::shared_ptr< OutputProducerInterface > outputProducer)=0
Sets an output producer that will be asked for application output state when the device needs it...
virtual ~DeviceInterface()
Virtual destructor (empty).
Definition: DeviceInterface.h:43
virtual bool addInputConsumer(std::shared_ptr< InputConsumerInterface > inputConsumer)=0
Adds an input consumer that will be notified when the application input state is updated.
virtual bool hasOutputProducer()=0
Query if this object has output producer.
virtual std::string getName() const =0
Return a (hopefully unique) device name.
virtual bool removeInputConsumer(std::shared_ptr< InputConsumerInterface > inputConsumer)=0
Removes an input consumer previously added via addInputConsumer.
virtual bool removeOutputProducer(std::shared_ptr< OutputProducerInterface > outputProducer)=0
Removes an output producer previously added via setOutputProducer.
virtual bool finalize()=0
Finalize (de-initialize) the device.
Interface used to communicate with user-interface hardware devices.
Definition: DeviceInterface.h:39
virtual bool initialize()=0
Fully initialize the device.