This is a wrapper around Boost DLL for loading plugins within Tesseract.
More...
#include <class_loader.h>
|
template<class ClassBase > |
static std::shared_ptr< ClassBase > | createSharedInstance (const std::string &symbol_name, const std::string &library_name, const std::string &library_directory="") |
| Create a shared instance for the provided symbol_name loaded from the library_name searching system folders for library. More...
|
|
static bool | isClassAvailable (const std::string &symbol_name, const std::string &library_name, const std::string &library_directory="") |
| Check if the symbol is available in the library_name searching system folders for library. More...
|
|
static std::vector< std::string > | getAvailableSymbols (const std::string §ion, const std::string &library_name, const std::string &library_directory="") |
| Get a list of available symbols under the provided section. More...
|
|
static std::vector< std::string > | getAvailableSections (const std::string &library_name, const std::string &library_directory="", bool include_hidden=false) |
| Get a list of available sections. More...
|
|
static std::string | decorate (const std::string &library_name, const std::string &library_directory="") |
| Give library name without prefix and suffix it will return the library name with the prefix and suffix. More...
|
|
This is a wrapper around Boost DLL for loading plugins within Tesseract.
The library_name should not include the prefix 'lib' or suffix '.so'. It will add the correct prefix and suffix based on the OS.
The plugin must be exported using the macro TESSERACT_ADD_PLUGIN. In the example below, the first parameter is the derived object and the second is the assigned symbol name which is used for looding Example: TESSERACT_ADD_PLUGIN(my_namespace::MyPlugin, plugin)
auto p = ClassLoader::createSharedInstance<my_namespace::MyPluginBase>("my_plugin", "plugin");
◆ createSharedInstance()
template<class ClassBase >
std::shared_ptr< ClassBase > tesseract_common::ClassLoader::createSharedInstance |
( |
const std::string & |
symbol_name, |
|
|
const std::string & |
library_name, |
|
|
const std::string & |
library_directory = "" |
|
) |
| |
|
static |
Create a shared instance for the provided symbol_name loaded from the library_name searching system folders for library.
The symbol name is the alias provide when calling TESSERACT_ADD_PLUGIN
- Parameters
-
symbol_name | The symbol to create a shared instance of |
library_name | The library name to load which does not include the prefix 'lib' or suffix '.so' |
library_directory | The library directory, if empty it will enable search system directories |
- Returns
- A shared pointer of the object with the symbol name located in library_name_
◆ decorate()
std::string tesseract_common::ClassLoader::decorate |
( |
const std::string & |
library_name, |
|
|
const std::string & |
library_directory = "" |
|
) |
| |
|
inlinestatic |
Give library name without prefix and suffix it will return the library name with the prefix and suffix.
◆ getAvailableSections()
std::vector< std::string > tesseract_common::ClassLoader::getAvailableSections |
( |
const std::string & |
library_name, |
|
|
const std::string & |
library_directory = "" , |
|
|
bool |
include_hidden = false |
|
) |
| |
|
inlinestatic |
Get a list of available sections.
- Parameters
-
library_name | The library name to load which does not include the prefix 'lib' or suffix '.so' |
library_directory | The library directory, if empty it will enable search system directories |
- Returns
- A list of sections if they exist.
◆ getAvailableSymbols()
std::vector< std::string > tesseract_common::ClassLoader::getAvailableSymbols |
( |
const std::string & |
section, |
|
|
const std::string & |
library_name, |
|
|
const std::string & |
library_directory = "" |
|
) |
| |
|
inlinestatic |
Get a list of available symbols under the provided section.
- Parameters
-
section | The section to search for available symbols |
library_name | The library name to load which does not include the prefix 'lib' or suffix '.so' |
library_directory | The library directory, if empty it will enable search system directories |
- Returns
- A list of symbols if they exist.
◆ isClassAvailable()
bool tesseract_common::ClassLoader::isClassAvailable |
( |
const std::string & |
symbol_name, |
|
|
const std::string & |
library_name, |
|
|
const std::string & |
library_directory = "" |
|
) |
| |
|
inlinestatic |
Check if the symbol is available in the library_name searching system folders for library.
The symbol name is the alias provide when calling TESSERACT_ADD_PLUGIN
- Parameters
-
symbol_name | The symbol to create a shared instance of |
library_name | The library name to load which does not include the prefix 'lib' or suffix '.so' |
library_directory | The library directory, if empty it will enable search system directories |
- Returns
- True if the symbol exists, otherwise false
The documentation for this struct was generated from the following files: