DeviceInterface.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_INPUT_DEVICEINTERFACE_H
#define SURGSIM_INPUT_DEVICEINTERFACE_H
#include <memory>
#include <string>
#include "SurgSim/Input/InputConsumerInterface.h"
#include "SurgSim/Input/OutputProducerInterface.h"
#include "SurgSim/Framework/Accessible.h"
#include "SurgSim/Framework/ObjectFactory.h"
namespace SurgSim
{
namespace Input
{
class DeviceInterface : public Framework::Accessible, public Framework::FactoryBase1<DeviceInterface, std::string>
{
public:
virtual ~DeviceInterface()
{
}
virtual std::string getName() const = 0;
virtual std::string getClassName() const = 0;
virtual bool initialize() = 0;
virtual bool isInitialized() const = 0;
virtual bool addInputConsumer(std::shared_ptr<InputConsumerInterface> inputConsumer) = 0;
virtual bool removeInputConsumer(std::shared_ptr<InputConsumerInterface> inputConsumer) = 0;
virtual void clearInputConsumers() = 0;
virtual bool setOutputProducer(std::shared_ptr<OutputProducerInterface> outputProducer) = 0;
virtual bool removeOutputProducer(std::shared_ptr<OutputProducerInterface> outputProducer) = 0;
virtual bool hasOutputProducer() = 0;
virtual void clearOutputProducer() = 0;
private:
virtual bool finalize() = 0;
};
}; // namespace Input
}; // namespace SurgSim
#endif // SURGSIM_INPUT_DEVICEINTERFACE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Input::DeviceInterface::setOutputProducer
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...
SurgSim::Input::DeviceInterface::~DeviceInterface
virtual ~DeviceInterface()
Virtual destructor (empty).
Definition: DeviceInterface.h:45
SurgSim::Input::DeviceInterface::addInputConsumer
virtual bool addInputConsumer(std::shared_ptr< InputConsumerInterface > inputConsumer)=0
Adds an input consumer that will be notified when the application input state is updated.
SurgSim::Framework::FactoryBase1
CRTP Base class to implement Object Factory functionality on a base class, use this rather than writi...
Definition: ObjectFactory.h:140
Accessible.h
SurgSim::Input::DeviceInterface::hasOutputProducer
virtual bool hasOutputProducer()=0
Query if this object has output producer.
SurgSim::Input::DeviceInterface::getName
virtual std::string getName() const =0
Return a (hopefully unique) device name.
ObjectFactory.h
SurgSim::Input::DeviceInterface::isInitialized
virtual bool isInitialized() const =0
SurgSim::Input::DeviceInterface::getClassName
virtual std::string getClassName() const =0
The class name for this class.
SurgSim::Input::DeviceInterface::removeInputConsumer
virtual bool removeInputConsumer(std::shared_ptr< InputConsumerInterface > inputConsumer)=0
Removes an input consumer previously added via addInputConsumer.
SurgSim::Input::DeviceInterface::removeOutputProducer
virtual bool removeOutputProducer(std::shared_ptr< OutputProducerInterface > outputProducer)=0
Removes an output producer previously added via setOutputProducer.
InputConsumerInterface.h
OutputProducerInterface.h
SurgSim::Input::DeviceInterface::finalize
virtual bool finalize()=0
Finalize (de-initialize) the device.
SurgSim::Input::DeviceInterface::clearOutputProducer
virtual void clearOutputProducer()=0
Removes any OutputProducer.
SurgSim::Input::DeviceInterface
Interface used to communicate with user-interface hardware devices.
Definition: DeviceInterface.h:41
SurgSim::Framework::Accessible
Mixin class for enabling a property system on OSS classes, the instance still needs to initialize pro...
Definition: Accessible.h:37
SurgSim::Input::DeviceInterface::clearInputConsumers
virtual void clearInputConsumers()=0
Removes all InputConsumers.
SurgSim::Input::DeviceInterface::initialize
virtual bool initialize()=0
Fully initialize the device.