Global factory for devices. More...
#include <yarp/dev/Drivers.h>
Classes | |
| class | Private |
Public Member Functions | |
| DeviceDriver * | open (const std::string &device) |
| Create and configure a device, by name. | |
| virtual DeviceDriver * | open (yarp::os::Searchable &config) |
| Create and configure a device, by name. | |
| virtual std::string | toString () const |
| A description of the available devices. | |
| virtual | ~Drivers () |
| Destructor. | |
| void | add (DriverCreator *creator) |
| Add a factory for creating a particular device. | |
| DriverCreator * | find (const std::string &name) |
| Find the factory for a named device. | |
| bool | remove (const std::string &name) |
| Remove a factory for a named device. | |
| void | addDeprecatedAlias (const std::string &alias, const std::string &canonical) |
| Register a deprecated alias for a device name. | |
Static Public Member Functions | |
| static Drivers & | factory () |
| Get the global factory for devices. | |
| static int | yarpdev (int argc, char *argv[]) |
| Body of the yarpdev program for starting device wrappers. | |
Global factory for devices.
You can create your devices any way you like, but if you register them with the Driver object returned by Drivers::factory() by calling the add() method on it, then those devices will be creatable by name through the open() methods.
There is only one instance of the Drivers class. Call Drivers::factory() to get that instance.
|
virtual |
Destructor.
Definition at line 295 of file Drivers.cpp.
| void Drivers::add | ( | DriverCreator * | creator | ) |
Add a factory for creating a particular device.
The library will be responsible for deallocating this factor.
| creator | A factory for creating a particular device. |
Definition at line 303 of file Drivers.cpp.
Register a deprecated alias for a device name.
When the alias is requested, an error message is printed and the canonical device is opened instead.
| alias | The deprecated name (e.g. "rgbdSensor_nwc_yarp"). |
| canonical | The correct, official name (e.g. "RGBDSensor_nwc_yarp"). |
Definition at line 316 of file Drivers.cpp.
|
static |
Get the global factory for devices.
Definition at line 284 of file Drivers.cpp.
| DriverCreator * Drivers::find | ( | const std::string & | name | ) |
Find the factory for a named device.
| name | The name of the device |
Definition at line 308 of file Drivers.cpp.
|
inline |
Create and configure a device, by name.
If you need to pass configuration options to the device (usually the case) use the other open method that takes a Searchable.
| device | the common name of the device. |
|
virtual |
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.
| config | configuration options for the device |
Definition at line 322 of file Drivers.cpp.
Remove a factory for a named device.
| name | The name of the device |
Definition at line 312 of file Drivers.cpp.
|
virtual |
A description of the available devices.
Definition at line 299 of file Drivers.cpp.
Body of the yarpdev program for starting device wrappers.
| argc | number of arguments |
| argv | list of arguments |
Definition at line 420 of file Drivers.cpp.