Loading...
Searching...
No Matches
shlibpp::SharedLibraryFactory Class Reference

A wrapper for a named factory method in a named shared library. More...

`#include <robottestingframework/dll/SharedLibraryFactory.h>`

Inheritance diagram for shlibpp::SharedLibraryFactory:
[legend]

## Public Types

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...

## 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.

## Private Attributes

SharedLibrary | lib
int | status
SharedLibraryClassApi | api
int | returnValue
int | rct
std::string | name
std::string | className
std::string | baseClassName
std::string | error

## Detailed Description

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.

## Member Enumeration Documentation

## anonymous enum

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.

## Constructor & Destructor Documentation

## 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

Destructor.

## Member Function Documentation

## addRef()

int shlibpp::SharedLibraryFactory::addRef | ( |  | ) |

Increment the reference count of this factory.

Returns
  the current reference count of this factory, after increment.

## getApi()

const SharedLibraryClassApi & shlibpp::SharedLibraryFactory::getApi | ( |  | ) | const

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.

## Member Data Documentation

## api

SharedLibraryClassApi shlibpp::SharedLibraryFactory::api

private

Definition at line 177 of file SharedLibraryFactory.h.

## baseClassName

std::string shlibpp::SharedLibraryFactory::baseClassName

private

Definition at line 182 of file SharedLibraryFactory.h.

## className

std::string shlibpp::SharedLibraryFactory::className

private

Definition at line 181 of file SharedLibraryFactory.h.

## error

std::string shlibpp::SharedLibraryFactory::error

private

Definition at line 183 of file SharedLibraryFactory.h.

## lib

SharedLibrary shlibpp::SharedLibraryFactory::lib

private

Definition at line 175 of file SharedLibraryFactory.h.

## name

std::string shlibpp::SharedLibraryFactory::name

private

Definition at line 180 of file SharedLibraryFactory.h.

## rct

int shlibpp::SharedLibraryFactory::rct

private

Definition at line 179 of file SharedLibraryFactory.h.

## returnValue

int shlibpp::SharedLibraryFactory::returnValue

private

Definition at line 178 of file SharedLibraryFactory.h.

## status

int shlibpp::SharedLibraryFactory::status

private

Definition at line 176 of file SharedLibraryFactory.h.

The documentation for this class was generated from the following file:

- src/plugins/dll/include/robottestingframework/dll/SharedLibraryFactory.h