A wrapper for a named factory method in a named shared library. More...
#include <yarp/os/SharedLibraryFactory.h>
Public Types | |
enum | { STATUS_NONE , STATUS_OK = yarp::os::createVocab32('o', 'k') , STATUS_LIBRARY_NOT_FOUND = yarp::os::createVocab32('f', 'o', 'u', 'n') , STATUS_LIBRARY_NOT_LOADED = yarp::os::createVocab32('l', 'o', 'a', 'd') , STATUS_FACTORY_NOT_FOUND = yarp::os::createVocab32('f', 'a', 'c', 't') , STATUS_FACTORY_NOT_FUNCTIONAL = yarp::os::createVocab32('r', 'u', 'n') } |
The status of a factory can be: More... | |
Public Member Functions | |
SharedLibraryFactory () | |
Constructor for unconfigured factory. | |
SharedLibraryFactory (const char *dll_name, const char *fn_name=nullptr) | |
Constructor. | |
virtual | ~SharedLibraryFactory () |
Destructor. | |
bool | open (const char *dll_name, const char *fn_name=nullptr) |
Configure the factory. | |
bool | isValid () const |
Check if factory is configured and present. | |
int | getStatus () const |
Get the status of the factory. | |
std::string | getError () const |
Get the latest error of the factory. | |
const SharedLibraryClassApi & | getApi () const |
Get the factory API, which has creation/deletion methods. | |
int | getReferenceCount () const |
Get the current reference count of this factory. | |
int | addRef () |
Increment the reference count of this factory. | |
int | removeRef () |
Decrement the reference count of this factory. | |
std::string | getName () const |
Get the name associated with this factory. | |
std::string | getClassName () const |
Get the type associated with this factory. | |
std::string | getBaseClassName () const |
Get the base type associated with this factory. | |
bool | useFactoryFunction (void *factory) |
Specify function to use as factory. | |
A wrapper for a named factory method in a named shared library.
This wrapper will do some basic checks that the named method does indeed behave like a YARP plugin hook before offering access to it. This is to avoid accidents, it is not a security mechanism.
Definition at line 26 of file SharedLibraryFactory.h.
The status of a factory can be:
Definition at line 38 of file SharedLibraryFactory.h.
|
explicit |
Constructor for unconfigured factory.
Definition at line 12 of file SharedLibraryFactory.cpp.
yarp::os::SharedLibraryFactory::SharedLibraryFactory | ( | const char * | dll_name, |
const char * | fn_name = nullptr |
||
) |
Constructor.
dll_name | name/path of shared library. |
fn_name | name of factory method, a symbol within the shared library. |
Definition at line 20 of file SharedLibraryFactory.cpp.
|
virtualdefault |
Destructor.
int yarp::os::SharedLibraryFactory::addRef | ( | ) |
Increment the reference count of this factory.
Definition at line 114 of file SharedLibraryFactory.cpp.
const yarp::os::SharedLibraryClassApi & yarp::os::SharedLibraryFactory::getApi | ( | ) | const |
Get the factory API, which has creation/deletion methods.
Definition at line 103 of file SharedLibraryFactory.cpp.
std::string yarp::os::SharedLibraryFactory::getBaseClassName | ( | ) | const |
Get the base type associated with this factory.
Definition at line 136 of file SharedLibraryFactory.cpp.
std::string yarp::os::SharedLibraryFactory::getClassName | ( | ) | const |
Get the type associated with this factory.
Definition at line 131 of file SharedLibraryFactory.cpp.
std::string yarp::os::SharedLibraryFactory::getError | ( | ) | const |
Get the latest error of the factory.
Definition at line 98 of file SharedLibraryFactory.cpp.
std::string yarp::os::SharedLibraryFactory::getName | ( | ) | const |
Get the name associated with this factory.
Definition at line 126 of file SharedLibraryFactory.cpp.
int yarp::os::SharedLibraryFactory::getReferenceCount | ( | ) | const |
Get the current reference count of this factory.
Definition at line 108 of file SharedLibraryFactory.cpp.
int yarp::os::SharedLibraryFactory::getStatus | ( | ) | const |
Get the status of the factory.
Definition at line 93 of file SharedLibraryFactory.cpp.
bool yarp::os::SharedLibraryFactory::isValid | ( | ) | const |
Check if factory is configured and present.
Definition at line 73 of file SharedLibraryFactory.cpp.
Configure the factory.
dll_name | name/path of shared library. |
fn_name | name of factory method, a symbol within the shared library. |
Definition at line 31 of file SharedLibraryFactory.cpp.
int yarp::os::SharedLibraryFactory::removeRef | ( | ) |
Decrement the reference count of this factory.
Definition at line 120 of file SharedLibraryFactory.cpp.
Specify function to use as factory.
factory | function to use as factory. |
Definition at line 141 of file SharedLibraryFactory.cpp.