opensurgsim
|
Interface used to communicate with user-interface hardware devices. More...
#include <DeviceInterface.h>
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. | |
![]() | |
Accessible () | |
Default Constructor. | |
~Accessible () | |
Destructor. | |
template<class T > | |
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 | |
![]() | |
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 |
![]() | |
typedef ObjectFactory1< DeviceInterface, std::string > | FactoryType |
![]() | |
static FactoryType & | getFactory () |
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.
|
pure virtual |
Adds an input consumer that will be notified when the application input state is updated.
inputConsumer | The input consumer to be added. |
Implemented in SurgSim::Input::CommonDevice, and SurgSim::Devices::IdentityPoseDevice.
|
pure virtual |
The class name for this class.
Implemented in SurgSim::Input::CommonDevice.
|
pure virtual |
Query if this object has output producer.
Implemented in SurgSim::Input::CommonDevice, and SurgSim::Devices::FilteredDevice.
|
pure virtual |
Fully initialize the device.
When the manager object creates the device, the internal state of the device usually isn't fully initialized yet. This method performs any needed initialization.
Implemented in SurgSim::Devices::LabJackDevice, SurgSim::Devices::LeapDevice, SurgSim::Devices::NovintDevice, SurgSim::Devices::PhantomDevice, SurgSim::Devices::NimbleDevice, SurgSim::Devices::ReplayPoseDevice, SurgSim::Devices::RawMultiAxisDevice, SurgSim::Devices::MouseDevice, SurgSim::Devices::SixenseDevice, SurgSim::Devices::KeyboardDevice, SurgSim::Devices::OculusDevice, SurgSim::Devices::TrakstarDevice, SurgSim::Devices::TrackIRDevice, SurgSim::Devices::FilteredDevice, SurgSim::Devices::OpenNIDevice, SurgSim::Devices::IdentityPoseDevice, SurgSim::Devices::DeviceFilter, and TestDevice.
|
pure virtual |
Implemented in SurgSim::Devices::LabJackDevice, SurgSim::Devices::LeapDevice, SurgSim::Devices::NovintDevice, SurgSim::Devices::PhantomDevice, SurgSim::Devices::NimbleDevice, SurgSim::Devices::ReplayPoseDevice, SurgSim::Devices::RawMultiAxisDevice, SurgSim::Devices::MouseDevice, SurgSim::Devices::SixenseDevice, SurgSim::Devices::KeyboardDevice, SurgSim::Devices::OculusDevice, SurgSim::Devices::TrakstarDevice, SurgSim::Devices::TrackIRDevice, SurgSim::Devices::FilteredDevice, SurgSim::Devices::OpenNIDevice, SurgSim::Devices::IdentityPoseDevice, SurgSim::Devices::DeviceFilter, and TestDevice.
|
pure virtual |
Removes an input consumer previously added via addInputConsumer.
inputConsumer | The input consumer to be removed. |
Implemented in SurgSim::Input::CommonDevice.
|
pure virtual |
Removes an output producer previously added via setOutputProducer.
outputProducer | The output producer to be removed. |
Implemented in SurgSim::Input::CommonDevice.
|
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.
outputProducer | The output producer to be added. |
Implemented in SurgSim::Input::CommonDevice.