YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::dev::PolyDriver Class Reference

A container for a device driver. More...

#include <yarp/dev/PolyDriver.h>

+ Inheritance diagram for yarp::dev::PolyDriver:

Classes

class  Private
 

Public Member Functions

 PolyDriver ()
 Constructor.
 
 PolyDriver (const std::string &txt)
 Construct and configure a device by its common name.
 
 PolyDriver (yarp::os::Searchable &config)
 Create and configure a device, by name.
 
virtual ~PolyDriver ()
 Destructor.
 
 PolyDriver (const PolyDriver &alt)=delete
 
const PolyDriveroperator= (const PolyDriver &alt)=delete
 
bool open (const std::string &txt)
 Construct and configure a device by its common name.
 
bool open (yarp::os::Searchable &config) override
 Create and configure a device, by name.
 
bool link (PolyDriver &alt)
 Make this device be a link to an existing one.
 
DeviceDrivertake ()
 Gets the device this object manages.
 
bool give (DeviceDriver *dd, bool own)
 Take on management of a device.
 
bool close () override
 Close the DeviceDriver.
 
bool isValid () const
 Check if device is valid.
 
yarp::os::Bottle getOptions ()
 After a call to PolyDriver::open, you can get a list of all the options checked by the device.
 
std::string getComment (const char *option)
 After a call to PolyDriver::open, you can check if the device has documentation on a given option.
 
yarp::os::Value getDefaultValue (const char *option)
 After a call to PolyDriver::open, you can check if a given option has a particular default value.
 
yarp::os::Value getValue (const char *option)
 After a call to PolyDriver::open, you can check what value was found for a particular option, if any.
 
DeviceDrivergetImplementation () override
 Some drivers are bureaucrats, pointing at others.
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver.
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriveroperator= (const DeviceDriver &other)=delete
 
DeviceDriveroperator= (DeviceDriver &&other) noexcept=delete
 
 ~DeviceDriver () override
 
virtual std::string id () const
 Return the id assigned to the PolyDriver.
 
virtual void setId (const std::string &id)
 Set the id for this device.
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver.
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor.
 
virtual bool configure (Searchable &config)
 Change online parameters.
 

Detailed Description

Constructor & Destructor Documentation

◆ PolyDriver() [1/4]

PolyDriver::PolyDriver ( )

Constructor.

Definition at line 108 of file PolyDriver.cpp.

◆ PolyDriver() [2/4]

PolyDriver::PolyDriver ( const std::string &  txt)

Construct and configure a device by its common name.

Parameters
txtcommon name of the device

Definition at line 115 of file PolyDriver.cpp.

◆ PolyDriver() [3/4]

PolyDriver::PolyDriver ( yarp::os::Searchable config)

Create and configure a device, by name.

The config object should have a property called "device" that is set to the common name of the device. All other properties are passed on the the device's DeviceDriver::open method.

Parameters
configconfiguration options for the device

Definition at line 123 of file PolyDriver.cpp.

◆ ~PolyDriver()

PolyDriver::~PolyDriver ( )
virtual

Destructor.

Definition at line 131 of file PolyDriver.cpp.

◆ PolyDriver() [4/4]

yarp::dev::PolyDriver::PolyDriver ( const PolyDriver alt)
delete

Member Function Documentation

◆ close()

bool PolyDriver::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 173 of file PolyDriver.cpp.

◆ getComment()

std::string PolyDriver::getComment ( const char option)

After a call to PolyDriver::open, you can check if the device has documentation on a given option.

Parameters
optionthe name of the option to check
Returns
the human-readable description of the option, if found

Definition at line 232 of file PolyDriver.cpp.

◆ getDefaultValue()

Value PolyDriver::getDefaultValue ( const char option)

After a call to PolyDriver::open, you can check if a given option has a particular default value.

Parameters
optionthe name of the option to check
Returns
the default value of the option, if any.

Definition at line 240 of file PolyDriver.cpp.

◆ getImplementation()

DeviceDriver * PolyDriver::getImplementation ( )
overridevirtual

Some drivers are bureaucrats, pointing at others.

Such drivers override this method.

Returns
"real" device driver

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 370 of file PolyDriver.cpp.

◆ getOptions()

Bottle PolyDriver::getOptions ( )

After a call to PolyDriver::open, you can get a list of all the options checked by the device.

Returns
a list of options checked by the device

Definition at line 224 of file PolyDriver.cpp.

◆ getValue()

Value PolyDriver::getValue ( const char option)

After a call to PolyDriver::open, you can check what value was found for a particular option, if any.

Parameters
optionthe name of the option to check
Returns
the value found for the option, if any.

Definition at line 248 of file PolyDriver.cpp.

◆ give()

bool PolyDriver::give ( DeviceDriver dd,
bool  own 
)

Take on management of a device.

The PolyDriver may be responsible for destroying it.

Parameters
ddthe device to manage.
owntrue if PolyDriver should destroy device when done.
Returns
true on success.

Definition at line 354 of file PolyDriver.cpp.

◆ isValid()

bool PolyDriver::isValid ( ) const

Check if device is valid.

Returns
true iff the device was created and configured successfully

Definition at line 196 of file PolyDriver.cpp.

◆ link()

bool PolyDriver::link ( PolyDriver alt)

Make this device be a link to an existing one.

The device will be reference counted, and destroyed when the last relevant call to close() is made.

Parameters
altthe device to link to
Returns
true iff link succeeded

Definition at line 201 of file PolyDriver.cpp.

◆ open() [1/3]

bool PolyDriver::open ( const std::string &  txt)

Construct and configure a device by its common name.

Parameters
txtcommon name of the device
Returns
true iff the device was created and configured successfully
Examples
dev/grabber_crop/grabber_crop.cpp.

Definition at line 140 of file PolyDriver.cpp.

◆ open() [2/3]

bool yarp::dev::DeviceDriver::open ( yarp::os::Searchable config)
inlineoverridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 53 of file DeviceDriver.h.

◆ open() [3/3]

bool PolyDriver::open ( yarp::os::Searchable config)
overridevirtual

Create and configure a device, by name.

The config object should have a property called "device" that is set to the common name of the device. All other properties are passed on the the device's DeviceDriver::open method.

Parameters
configconfiguration options for the device
Returns
true iff the device was created and configured successfully

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 148 of file PolyDriver.cpp.

◆ operator=()

const PolyDriver & yarp::dev::PolyDriver::operator= ( const PolyDriver alt)
delete

◆ take()

DeviceDriver * PolyDriver::take ( )

Gets the device this object manages.

The user is then responsible for managing it.

Returns
the device this object manages.

Definition at line 346 of file PolyDriver.cpp.


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