#include <StorageManager.h>
|
static PluginManager< Storage > * | getManager (uint32_t managerID) |
|
static PluginManager< Storage > * | getManager (uint32_t managerID) |
|
static bool | addFactory (std::string_view typeName, const std::shared_ptr< PluginFactory< Storage >> &factory) |
|
static bool | addFactory (std::string_view typeName) |
|
static bool | addFactory (std::string_view typeName, const std::shared_ptr< PluginFactory< Storage >> &factory) |
|
static bool | addFactory (std::string_view typeName) |
|
std::shared_ptr< PluginLibrary< Storage > > | loadSharedLibrary (std::string_view path) |
|
std::shared_ptr< PluginLibrary< Storage > > | loadSharedLibrary (std::string_view path) |
|
std::shared_ptr< PluginModule< Storage > > | loadPythonModule (std::string_view path, std::string_view type) |
|
std::shared_ptr< PluginModule< Storage > > | loadPythonModule (std::string_view path, std::string_view type) |
|
std::shared_ptr< PluginFactory< Storage > > | findFactory (const boost::property_tree::ptree &config) |
|
std::shared_ptr< PluginFactory< Storage > > | findFactory (const boost::property_tree::ptree &config) |
|
std::string | getPluginID (const std::shared_ptr< PluginFactory< Storage >> &factory, const boost::property_tree::ptree &config) |
|
std::string | getPluginID (const std::shared_ptr< PluginFactory< Storage >> &factory, const boost::property_tree::ptree &config) |
|
static uint32_t & | managerIDCounter () |
|
static uint32_t & | managerIDCounter () |
|
static auto & | pluginFactories () |
|
static auto & | pluginFactories () |
|
static auto & | pluginManagers () |
|
static auto & | pluginManagers () |
|
std::shared_ptr< std::map< uint32_t, PluginManager * > > | pluginManagers_ |
|
std::mutex | staticMutex_ |
|
uint32_t | managerID_ |
|
uint32_t | pluginIndex_ |
|
std::map< std::string_view, std::shared_ptr< NamedPlugin< Storage > >, std::less<> > | pluginPool_ |
|
std::map< std::string, std::shared_ptr< PluginLibrary< Storage > >, std::less<> > | loadedPlugins_ |
|
std::map< std::string, std::shared_ptr< PluginModule< Storage > >, std::less<> > | loadedModules_ |
|
Manages a set of available storage subsystems.
Definition at line 18 of file StorageManager.h.
◆ StorageManager() [1/2]
StorageManager::StorageManager |
( |
const std::shared_ptr< Vocabulary > & |
vocabulary | ) |
|
|
explicit |
- Parameters
-
vocabulary | the vocabulary associated with this manager. |
Definition at line 15 of file StorageManager.cpp.
auto & vocabulary() const
◆ ~StorageManager() [1/2]
knowrob::StorageManager::~StorageManager |
( |
| ) |
|
|
overridedefault |
◆ StorageManager() [2/2]
knowrob::StorageManager::StorageManager |
( |
const std::shared_ptr< Vocabulary > & |
vocabulary | ) |
|
|
explicit |
- Parameters
-
vocabulary | the vocabulary associated with this manager. |
◆ ~StorageManager() [2/2]
knowrob::StorageManager::~StorageManager |
( |
| ) |
|
|
overridedefault |
◆ addPlugin() [1/4]
void StorageManager::addPlugin |
( |
const std::shared_ptr< NamedBackend > & |
backend | ) |
|
Add a backend to this manager.
- Parameters
-
backend | a defined backend. |
Definition at line 62 of file StorageManager.cpp.
64 KB_WARN(
"Overwriting backend with name '{}'", definedKG->name());
67 initBackend(definedKG);
std::map< std::string_view, std::shared_ptr< NamedPlugin< Storage > >, std::less<> > pluginPool_
◆ addPlugin() [2/4]
void knowrob::StorageManager::addPlugin |
( |
const std::shared_ptr< NamedBackend > & |
backend | ) |
|
Add a backend to this manager.
- Parameters
-
backend | a defined backend. |
◆ addPlugin() [3/4]
Definition at line 52 of file StorageManager.cpp.
54 KB_WARN(
"Overwriting backend with name '{}'", backendID);
56 auto managedBackend = std::make_shared<NamedBackend>(backendID, language, backend);
57 pluginPool_.emplace(managedBackend->name(), managedBackend);
58 initBackend(managedBackend);
59 return managedBackend;
◆ addPlugin() [4/4]
◆ loadPlugin() [1/2]
std::shared_ptr< NamedBackend > StorageManager::loadPlugin |
( |
const boost::property_tree::ptree & |
config | ) |
|
|
overridevirtual |
Load a new plugin instance into the plugin manager. The type of the plugin is determined based on either the value of "type", "lib" or "module" in the property tree root. The tree is further used to generate a plugin configuration. Plugin factories for libraries are created on the fly, the ones for built-in plugin types need to be added to the plugin manager before.
- Parameters
-
config | a property tree holding a plugin configuration |
Implements knowrob::PluginManager< Storage >.
Definition at line 20 of file StorageManager.cpp.
22 std::shared_ptr<BackendFactory> factory =
findFactory(config);
24 if (!factory)
throw StorageError(
"failed to load a backend.");
27 KB_INFO(
"Using backend `{}` with type `{}`.", backendID, factory->name());
30 auto definedBackend = factory->create(backendID);
31 definedBackend->value()->setVocabulary(
vocabulary());
33 PropertyTree pluginConfig(std::make_shared<boost::property_tree::ptree>(config));
38 success = definedBackend->value()->initializeBackend(pluginConfig);
40 success = definedBackend->value()->initializeBackend(pluginConfig);
44 KB_WARN(
"Backend `{}` failed to loadConfig.", backendID);
49 return definedBackend;
std::shared_ptr< PluginFactory< Storage > > findFactory(const boost::property_tree::ptree &config)
std::string getPluginID(const std::shared_ptr< PluginFactory< Storage >> &factory, const boost::property_tree::ptree &config)
void addPlugin(const std::shared_ptr< NamedBackend > &backend)
◆ loadPlugin() [2/2]
std::shared_ptr<NamedBackend> knowrob::StorageManager::loadPlugin |
( |
const boost::property_tree::ptree & |
config | ) |
|
|
overridevirtual |
Load a new plugin instance into the plugin manager. The type of the plugin is determined based on either the value of "type", "lib" or "module" in the property tree root. The tree is further used to generate a plugin configuration. Plugin factories for libraries are created on the fly, the ones for built-in plugin types need to be added to the plugin manager before.
- Parameters
-
config | a property tree holding a plugin configuration |
Implements knowrob::PluginManager< Storage >.
◆ persistent() [1/2]
const auto& knowrob::StorageManager::persistent |
( |
| ) |
const |
|
inline |
- Returns
- map of all persistent storages defined by this manager.
Definition at line 35 of file StorageManager.h.
35 {
return persistent_; }
◆ persistent() [2/2]
const auto& knowrob::StorageManager::persistent |
( |
| ) |
const |
|
inline |
- Returns
- map of all persistent storages defined by this manager.
Definition at line 35 of file StorageManager.h.
35 {
return persistent_; }
◆ queryable() [1/2]
const auto& knowrob::StorageManager::queryable |
( |
| ) |
const |
|
inline |
- Returns
- map of all queryable storages defined by this manager.
Definition at line 40 of file StorageManager.h.
40 {
return queryable_; }
◆ queryable() [2/2]
const auto& knowrob::StorageManager::queryable |
( |
| ) |
const |
|
inline |
- Returns
- map of all queryable storages defined by this manager.
Definition at line 40 of file StorageManager.h.
40 {
return queryable_; }
◆ vocabulary() [1/2]
auto& knowrob::StorageManager::vocabulary |
( |
| ) |
const |
|
inline |
- Returns
- the vocabulary associated with this manager.
Definition at line 30 of file StorageManager.h.
30 {
return vocabulary_; }
◆ vocabulary() [2/2]
auto& knowrob::StorageManager::vocabulary |
( |
| ) |
const |
|
inline |
- Returns
- the vocabulary associated with this manager.
Definition at line 30 of file StorageManager.h.
30 {
return vocabulary_; }
The documentation for this class was generated from the following files: