yarp-devices
Classes | Public Member Functions | Private Attributes | List of all members
roboticslab::RawDevice Class Referencefinal

Immutable container for YARP raw interface handles. More...

#include <RawDevice.hpp>

Classes

struct  Private
 

Public Member Functions

 RawDevice (yarp::dev::PolyDriver *driver)
 Constructor, extracts all interface handles of the supplied driver.
 
 ~RawDevice ()
 Destructor.
 
template<typename T >
T * getHandle () const
 Retrieve a handle to a raw interface implemented by the device. More...
 
std::string getId () const
 Retrieve the device id (can be an empty string if not set). More...
 
template<typename T >
T * castToType () const
 Perform a dynamic cast on the given type. More...
 
bool isValid () const
 Whether this instance wraps a device with a supported interface. More...
 
template<>
yarp::dev::IAmplifierControlRaw * getHandle () const
 

Private Attributes

std::unique_ptr< Privatepriv
 
yarp::dev::PolyDriver * driver {nullptr}
 
bool valid {false}
 

Detailed Description

Performs all RTTI stuff on initial configuration to avoid abusing dynamic_cast on runtime.

Member Function Documentation

◆ castToType()

template<typename T >
T* roboticslab::RawDevice::castToType ( ) const
inline
Template Parameters
TA type the original driver should be able to be cast to.

◆ getHandle()

template<typename T >
T* roboticslab::RawDevice::getHandle ( ) const
Template Parameters
TYARP raw interface.

◆ getId()

std::string roboticslab::RawDevice::getId ( ) const
inline
Returns
A string containing the device id.

◆ isValid()

bool roboticslab::RawDevice::isValid ( ) const
inline
Returns
True if the device exists and has at least one supported interface.

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