Global factory for devices. More...
#include <yarp/dev/Drivers.h>
Classes | |
class | Private |
Public Member Functions | |
DeviceDriver * | open (const char *device) |
Create and configure a device, by name. More... | |
virtual DeviceDriver * | open (yarp::os::Searchable &config) |
Create and configure a device, by name. More... | |
virtual std::string | toString () const |
A description of the available devices. More... | |
virtual | ~Drivers () |
Destructor. More... | |
void | add (DriverCreator *creator) |
Add a factory for creating a particular device. More... | |
DriverCreator * | find (const char *name) |
Find the factory for a named device. More... | |
bool | remove (const char *name) |
Remove a factory for a named device. More... | |
Static Public Member Functions | |
static Drivers & | factory () |
Get the global factory for devices. More... | |
static int | yarpdev (int argc, char *argv[]) |
Body of the yarpdev program for starting device wrappers. More... | |
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 263 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 271 of file Drivers.cpp.
|
static |
Get the global factory for devices.
Definition at line 252 of file Drivers.cpp.
DriverCreator * Drivers::find | ( | const char * | name | ) |
Find the factory for a named device.
name | The name of the device |
Definition at line 276 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 285 of file Drivers.cpp.
bool Drivers::remove | ( | const char * | name | ) |
Remove a factory for a named device.
name | The name of the device |
Definition at line 280 of file Drivers.cpp.
|
virtual |
A description of the available devices.
Definition at line 267 of file Drivers.cpp.
|
static |
Body of the yarpdev program for starting device wrappers.
argc | number of arguments |
argv | list of arguments |
Definition at line 407 of file Drivers.cpp.