opensurgsim
Public Member Functions | List of all members
SurgSim::Input::DeviceInterface Class Referenceabstract

Interface used to communicate with user-interface hardware devices. More...

#include <DeviceInterface.h>

Inheritance diagram for SurgSim::Input::DeviceInterface:
SurgSim::Framework::Accessible SurgSim::Framework::FactoryBase1< DeviceInterface, std::string > SurgSim::Devices::FilteredDevice SurgSim::Input::CommonDevice SurgSim::Devices::MultiAxisDevice SurgSim::Devices::DeviceFilter SurgSim::Devices::IdentityPoseDevice SurgSim::Devices::KeyboardDevice SurgSim::Devices::LabJackDevice SurgSim::Devices::LeapDevice SurgSim::Devices::MouseDevice SurgSim::Devices::NimbleDevice SurgSim::Devices::NovintDevice SurgSim::Devices::OculusDevice SurgSim::Devices::OpenNIDevice SurgSim::Devices::PhantomDevice SurgSim::Devices::RawMultiAxisDevice SurgSim::Devices::ReplayPoseDevice SurgSim::Devices::SixenseDevice SurgSim::Devices::TrackIRDevice SurgSim::Devices::TrakstarDevice TestDevice

Public Member Functions

virtual ~DeviceInterface ()
 Virtual destructor (empty).
 
virtual std::string getName () const =0
 Return a (hopefully unique) device name.
 
virtual std::string getClassName () const =0
 The class name for this class. More...
 
virtual bool initialize ()=0
 Fully initialize the device. More...
 
virtual bool isInitialized () const =0
 
virtual bool addInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer)=0
 Adds an input consumer that will be notified when the application input state is updated. More...
 
virtual bool removeInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer)=0
 Removes an input consumer previously added via addInputConsumer. More...
 
virtual void clearInputConsumers ()=0
 Removes all InputConsumers.
 
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. More...
 
virtual bool removeOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer)=0
 Removes an output producer previously added via setOutputProducer. More...
 
virtual bool hasOutputProducer ()=0
 Query if this object has output producer. More...
 
virtual void clearOutputProducer ()=0
 Removes any OutputProducer.
 
- Public Member Functions inherited from SurgSim::Framework::Accessible
 Accessible ()
 Default Constructor.
 
 ~Accessible ()
 Destructor.
 
template<class T >
getValue (const std::string &name) const
 Retrieves the value with the name by executing the getter if it is found and tries to convert it to the given type. More...
 
boost::any getValue (const std::string &name) const
 Retrieves the value with the name by executing the getter if it is found. More...
 
template<class T >
bool getValue (const std::string &name, T *value) const
 Retrieves the value with the name by executing the getter if it is found, and converts it to the type of the output parameter. More...
 
void setValue (const std::string &name, const boost::any &value)
 Sets a value of a property that has setter. More...
 
bool isReadable (const std::string &name) const
 Check whether a property is readable. More...
 
bool isWriteable (const std::string &name) const
 Check whether a property is writable. More...
 
void setGetter (const std::string &name, GetterType func)
 Sets a getter for a given property. More...
 
void setSetter (const std::string &name, SetterType func)
 Sets a setter for a given property. More...
 
void setAccessors (const std::string &name, GetterType getter, SetterType setter)
 Sets the accessors getter and setter in one function. More...
 
void removeAccessors (const std::string &name)
 Removes all the accessors (getter and setter) for a given property. More...
 
void forwardProperty (const std::string &name, const Accessible &target, const std::string &targetProperty)
 Adds a property with the given name that uses the targets accessors, in effect forwarding the value to the target. More...
 
void setSerializable (const std::string &name, EncoderType encoder, DecoderType decoder)
 Sets the functions used to convert data from and to a YAML::Node. More...
 
void setDecoder (const std::string &name, DecoderType decoder)
 Sets the functions used to convert data from a YAML::Node. More...
 
YAML::Node encode () const
 Encode this Accessible to a YAML::Node. More...
 
void decode (const YAML::Node &node, const std::vector< std::string > &ignoredProperties=std::vector< std::string >())
 Decode this Accessible from a YAML::Node, will throw an exception if the data type cannot be converted. More...
 
std::vector< std::string > getProperties ()
 
template<>
boost::any getValue (const std::string &name) const
 

Additional Inherited Members

- Public Types inherited from SurgSim::Framework::Accessible
typedef std::function< boost::any(void)> GetterType
 
typedef std::function< void(boost::any)> SetterType
 
typedef std::function< YAML::Node(void)> EncoderType
 
typedef std::function< void(const YAML::Node *)> DecoderType
 
- Public Types inherited from SurgSim::Framework::FactoryBase1< DeviceInterface, std::string >
typedef ObjectFactory1< DeviceInterface, std::string > FactoryType
 
- Static Public Member Functions inherited from SurgSim::Framework::FactoryBase1< DeviceInterface, std::string >
static FactoryTypegetFactory ()
 

Detailed Description

Interface used to communicate with user-interface hardware devices.

Classes that implement communication with a hardware device implement this interface. This includes input/output devices (haptic devices are the most obvious example, but many other devices can, for example, display visual indicators such as LEDs, etc.), as well as input-only and output-only devices.

Derived classes will likely want to hide their constructor and only allow creation through a manager object for that type of device.

Member Function Documentation

§ addInputConsumer()

virtual bool SurgSim::Input::DeviceInterface::addInputConsumer ( std::shared_ptr< InputConsumerInterface inputConsumer)
pure virtual

Adds an input consumer that will be notified when the application input state is updated.

Parameters
inputConsumerThe input consumer to be added.
Returns
true on success, false on failure.

Implemented in SurgSim::Input::CommonDevice, and SurgSim::Devices::IdentityPoseDevice.

§ getClassName()

virtual std::string SurgSim::Input::DeviceInterface::getClassName ( ) const
pure virtual

The class name for this class.

Note
Use the SURGSIM_CLASSNAME macro in derived classes.
Returns
The fully namespace qualified name of this class.

Implemented in SurgSim::Input::CommonDevice.

§ hasOutputProducer()

virtual bool SurgSim::Input::DeviceInterface::hasOutputProducer ( )
pure virtual

Query if this object has output producer.

Returns
true if there is an output producer, false if not.

Implemented in SurgSim::Input::CommonDevice, and SurgSim::Devices::FilteredDevice.

§ initialize()

virtual bool SurgSim::Input::DeviceInterface::initialize ( )
pure virtual

§ isInitialized()

virtual bool SurgSim::Input::DeviceInterface::isInitialized ( ) const
pure virtual

§ removeInputConsumer()

virtual bool SurgSim::Input::DeviceInterface::removeInputConsumer ( std::shared_ptr< InputConsumerInterface inputConsumer)
pure virtual

Removes an input consumer previously added via addInputConsumer.

Parameters
inputConsumerThe input consumer to be removed.

Implemented in SurgSim::Input::CommonDevice.

§ removeOutputProducer()

virtual bool SurgSim::Input::DeviceInterface::removeOutputProducer ( std::shared_ptr< OutputProducerInterface outputProducer)
pure virtual

Removes an output producer previously added via setOutputProducer.

Parameters
outputProducerThe output producer to be removed.

Implemented in SurgSim::Input::CommonDevice.

§ setOutputProducer()

virtual bool SurgSim::Input::DeviceInterface::setOutputProducer ( std::shared_ptr< OutputProducerInterface outputProducer)
pure virtual

Sets an output producer that will be asked for application output state when the device needs it.

Any previously set output producer will be removed.

Parameters
outputProducerThe output producer to be added.
Returns
true on success, false on failure.

Implemented in SurgSim::Input::CommonDevice.


The documentation for this class was generated from the following file: