3 #ifndef __RAW_DEVICE_HPP__
4 #define __RAW_DEVICE_HPP__
9 #include <yarp/dev/PolyDriver.h>
25 explicit RawDevice(yarp::dev::PolyDriver * driver);
42 {
return valid ? driver->getImplementation()->id() :
""; }
50 {
return valid ?
dynamic_cast<T *
>(driver->getImplementation()) :
nullptr; }
61 std::unique_ptr<Private> priv;
62 yarp::dev::PolyDriver * driver {
nullptr};
Immutable container for YARP raw interface handles.
Definition: RawDevice.hpp:22
RawDevice(yarp::dev::PolyDriver *driver)
Constructor, extracts all interface handles of the supplied driver.
Definition: RawDevice.cpp:47
std::string getId() const
Retrieve the device id (can be an empty string if not set).
Definition: RawDevice.hpp:41
T * getHandle() const
Retrieve a handle to a raw interface implemented by the device.
T * castToType() const
Perform a dynamic cast on the given type.
Definition: RawDevice.hpp:49
bool isValid() const
Whether this instance wraps a device with a supported interface.
Definition: RawDevice.hpp:56
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6
const RawDevice invalidDevice(nullptr)
Singleton instance for an invalid (empty) raw device.