Global factory for devices. More...
#include <Drivers.h>
Public Member Functions | |
| DeviceDriver * | open (const char *device) |
| Create and configure a device, by name. | |
| virtual DeviceDriver * | open (yarp::os::Searchable &config) |
| Create and configure a device, by name. | |
| virtual yarp::os::ConstString | toString () |
| A description of the available devices. | |
| virtual | ~Drivers () |
| Destructor. | |
| void | add (DriverCreator *creator) |
| Add a factory for creating a particular device. | |
| DriverCreator * | find (const char *name) |
| Find the factory for a named device. | |
| bool | remove (const char *name) |
| Remove a factory for a named device. | |
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.
| Drivers::~Drivers | ( | ) | [virtual] |
Destructor.
References HELPER.
| 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. |
References HELPER.
| static Drivers& yarp::dev::Drivers::factory | ( | ) | [inline, static] |
Get the global factory for devices.
Referenced by yarpdev().
| DriverCreator * Drivers::find | ( | const char * | name | ) |
Find the factory for a named device.
| name | The name of the device |
References HELPER.
| DeviceDriver* yarp::dev::Drivers::open | ( | const char * | device | ) | [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. |
| DeviceDriver * Drivers::open | ( | yarp::os::Searchable & | config | ) | [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 |
References yarp::dev::PolyDriver::open(), result, and yarp::dev::PolyDriver::take().
| bool Drivers::remove | ( | const char * | name | ) |
Remove a factory for a named device.
| name | The name of the device |
References HELPER.
| yarp::os::ConstString Drivers::toString | ( | ) | [virtual] |
| int Drivers::yarpdev | ( | int | argc, | |
| char * | argv[] | |||
| ) | [static] |
Body of the yarpdev program for starting device wrappers.
| argc | number of arguments | |
| argv | list of arguments |
References yarp< T >::c_str(), yarp< T >::checkNetwork(), yarp::dev::PolyDriver::close(), yarp< T >::ConstString(), yarp< T >::delay(), factory(), handler(), yarp::dev::PolyDriver::isValid(), yarp< T >::now(), yarp< T >::Property(), yarp< T >::signal(), yarp::dev::IService::startService(), terminated, terminatorKey, yarp< T >::Terminee(), toDox(), toString(), yarp::dev::IService::updateService(), v, yarp< T >::Value(), verbose, and yarp::dev::PolyDriver::view().
Referenced by main().
1.7.1