A wrapper for a named factory method in a named shared library.
More...
#include <robottestingframework/dll/SharedLibraryFactory.h>
|
| enum | {
STATUS_NONE
,
STATUS_OK = VOCAB('o', 'k')
,
STATUS_LIBRARY_NOT_FOUND = VOCAB('f', 'o', 'u', 'n')
,
STATUS_LIBRARY_NOT_LOADED = VOCAB('l', 'o', 'a', 'd')
,
STATUS_FACTORY_NOT_FOUND = VOCAB('f', 'a', 'c', 't')
,
STATUS_FACTORY_NOT_FUNCTIONAL = VOCAB('r', 'u', 'n')
} |
| | The status of a factory can be: More...
|
| |
|
| | 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 42 of file SharedLibraryFactory.h.
◆ anonymous enum
The status of a factory can be:
- STATUS_NONE: Not configured yet
- STATUS_OK: Present and sane
- STATUS_LIBRARY_NOT_FOUND: Named shared library was not found
- STATUS_LIBRARY_NOT_LOADED: Named shared library failed to load
- STATUS_FACTORY_NOT_FOUND: Named method wasn't present in library
- STATUS_FACTORY_NOT_FUNCTIONAL: Named method is not working right
| Enumerator |
|---|
| STATUS_NONE | Not configured yet.
|
| STATUS_OK | Present and sane.
|
| STATUS_LIBRARY_NOT_FOUND | Named shared library was not found.
|
| STATUS_LIBRARY_NOT_LOADED | Named shared library failed to load.
|
| STATUS_FACTORY_NOT_FOUND | Named method wasn't present in library.
|
| STATUS_FACTORY_NOT_FUNCTIONAL | Named method is not working right.
|
Definition at line 54 of file SharedLibraryFactory.h.
◆ SharedLibraryFactory() [1/2]
| shlibpp::SharedLibraryFactory::SharedLibraryFactory |
( |
| ) |
|
|
explicit |
Constructor for unconfigured factory.
◆ SharedLibraryFactory() [2/2]
| shlibpp::SharedLibraryFactory::SharedLibraryFactory |
( |
const char * |
dll_name, |
|
|
const char * |
fn_name = nullptr |
|
) |
| |
Constructor.
- Parameters
-
| dll_name | name/path of shared library. |
| fn_name | name of factory method, a symbol within the shared library. |
◆ ~SharedLibraryFactory()
| virtual shlibpp::SharedLibraryFactory::~SharedLibraryFactory |
( |
| ) |
|
|
virtual |
◆ addRef()
| int shlibpp::SharedLibraryFactory::addRef |
( |
| ) |
|
Increment the reference count of this factory.
- Returns
- the current reference count of this factory, after increment.
◆ getApi()
Get the factory API, which has creation/deletion methods.
- Returns
- the factory API
◆ getBaseClassName()
| std::string shlibpp::SharedLibraryFactory::getBaseClassName |
( |
| ) |
const |
Get the base type associated with this factory.
- Returns
- the base type associated with this factory.
◆ getClassName()
| std::string shlibpp::SharedLibraryFactory::getClassName |
( |
| ) |
const |
Get the type associated with this factory.
- Returns
- the type associated with this factory.
◆ getError()
| std::string shlibpp::SharedLibraryFactory::getError |
( |
| ) |
const |
Get the latest error of the factory.
- Returns
- the latest error.
◆ getName()
| std::string shlibpp::SharedLibraryFactory::getName |
( |
| ) |
const |
Get the name associated with this factory.
- Returns
- the name associated with this factory.
◆ getReferenceCount()
| int shlibpp::SharedLibraryFactory::getReferenceCount |
( |
| ) |
const |
Get the current reference count of this factory.
- Returns
- the current reference count of this factory.
◆ getStatus()
| int shlibpp::SharedLibraryFactory::getStatus |
( |
| ) |
const |
Get the status of the factory.
- Returns
- one of the SharedLibraryFactory::STATUS_* codes.
◆ isValid()
| bool shlibpp::SharedLibraryFactory::isValid |
( |
| ) |
const |
Check if factory is configured and present.
- Returns
- true iff factory is good to go.
◆ open()
| bool shlibpp::SharedLibraryFactory::open |
( |
const char * |
dll_name, |
|
|
const char * |
fn_name = nullptr |
|
) |
| |
Configure the factory.
- Parameters
-
| dll_name | name/path of shared library. |
| fn_name | name of factory method, a symbol within the shared library. |
- Returns
- true on success.
◆ removeRef()
| int shlibpp::SharedLibraryFactory::removeRef |
( |
| ) |
|
Decrement the reference count of this factory.
- Returns
- the current reference count of this factory, after decrement.
◆ useFactoryFunction()
| bool shlibpp::SharedLibraryFactory::useFactoryFunction |
( |
void * |
factory | ) |
|
Specify function to use as factory.
- Parameters
-
| factory | function to use as factory. |
- Returns
- true on success.
◆ api
◆ baseClassName
| std::string shlibpp::SharedLibraryFactory::baseClassName |
|
private |
◆ className
| std::string shlibpp::SharedLibraryFactory::className |
|
private |
◆ error
| std::string shlibpp::SharedLibraryFactory::error |
|
private |
◆ lib
◆ name
| std::string shlibpp::SharedLibraryFactory::name |
|
private |
◆ rct
| int shlibpp::SharedLibraryFactory::rct |
|
private |
◆ returnValue
| int shlibpp::SharedLibraryFactory::returnValue |
|
private |
◆ status
| int shlibpp::SharedLibraryFactory::status |
|
private |
The documentation for this class was generated from the following file: