Tesseract 0.28.4
Loading...
Searching...
No Matches
tesseract::common::ProfilePluginFactory Class Reference

Public Types

using PluginInfoMap = std::map<std::string, tesseract::common::PluginInfo>

Public Member Functions

 ProfilePluginFactory (const ProfilePluginFactory &)=delete
ProfilePluginFactory & operator= (const ProfilePluginFactory &)=delete
 ProfilePluginFactory (ProfilePluginFactory &&) noexcept
ProfilePluginFactory & operator= (ProfilePluginFactory &&) noexcept
 ProfilePluginFactory (const tesseract::common::ProfilesPluginInfo &config)
 Load plugins from a configuration object.
 ProfilePluginFactory (const YAML::Node &config, const tesseract::common::ResourceLocator &locator)
 Load plugins from yaml node.
 ProfilePluginFactory (const std::filesystem::path &config, const tesseract::common::ResourceLocator &locator)
 Load plugins from file path.
 ProfilePluginFactory (const std::string &config, const tesseract::common::ResourceLocator &locator)
 Load plugins from string.
void loadConfig (const tesseract::common::ProfilesPluginInfo &config)
 Loads plugins from a configuration object.
void loadConfig (YAML::Node config, const tesseract::common::ResourceLocator &locator)
 Load plugins from yaml node.
void loadConfig (const std::filesystem::path &config, const tesseract::common::ResourceLocator &locator)
 Load plugins from file path.
void loadConfig (const std::string &config, const tesseract::common::ResourceLocator &locator)
 Load plugins from string.
void setFactoryData (std::shared_ptr< const ProfileFactoryData > data)
 Set the factory data passed when constructing the plugin.
std::shared_ptr< const ProfileFactoryData > getFactoryData () const
 Get the factory data.
void addSearchPath (const std::string &path)
 Add location for the plugin loader to search.
std::vector< std::string > getSearchPaths () const
 Get the plugin search paths.
void clearSearchPaths ()
 Clear the search paths.
void addSearchLibrary (const std::string &library_name)
 Add a library to search for plugin name.
std::vector< std::string > getSearchLibraries () const
 Get the plugin search libraries.
void clearSearchLibraries ()
 Clean the search libraries.
void addPlugin (const std::string &ns, const std::string &name, tesseract::common::PluginInfo plugin_info)
 Add a profile plugin.
bool hasPlugins () const
 Check if it has profile plugins.
std::map< std::string, PluginInfoMap > getPlugins () const
 Get the map of profile plugins.
void removePlugin (const std::string &ns, const std::string &name)
 Remove profile plugin.
std::unique_ptr< Profile > create (const std::string &ns, const std::string &name) const
 Get profile object given name.
std::unique_ptr< Profile > create (const std::string &name, const PluginInfo &plugin_info) const
 Get profile object given plugin info.
void saveConfig (const std::filesystem::path &file_path) const
 Save the plugin information to a yaml config file.
YAML::Node getConfig () const
 Get the plugin information config as a yaml node.
ProfileDictionary getProfileDictionary () const
 This will load all plugins into a profile dictionary.

Constructor & Destructor Documentation

◆ ProfilePluginFactory() [1/4]

tesseract::common::ProfilePluginFactory::ProfilePluginFactory ( const tesseract::common::ProfilesPluginInfo & config)

Load plugins from a configuration object.

Parameters
configThe config object

◆ ProfilePluginFactory() [2/4]

tesseract::common::ProfilePluginFactory::ProfilePluginFactory ( const YAML::Node & config,
const tesseract::common::ResourceLocator & locator )

Load plugins from yaml node.

Parameters
configThe config node

◆ ProfilePluginFactory() [3/4]

tesseract::common::ProfilePluginFactory::ProfilePluginFactory ( const std::filesystem::path & config,
const tesseract::common::ResourceLocator & locator )

Load plugins from file path.

Parameters
configThe config file path

◆ ProfilePluginFactory() [4/4]

tesseract::common::ProfilePluginFactory::ProfilePluginFactory ( const std::string & config,
const tesseract::common::ResourceLocator & locator )

Load plugins from string.

Parameters
configThe config string

Member Function Documentation

◆ loadConfig() [1/4]

void tesseract::common::ProfilePluginFactory::loadConfig ( const tesseract::common::ProfilesPluginInfo & config)

Loads plugins from a configuration object.

Parameters
configthe config object

◆ loadConfig() [2/4]

void tesseract::common::ProfilePluginFactory::loadConfig ( YAML::Node config,
const tesseract::common::ResourceLocator & locator )

Load plugins from yaml node.

Parameters
configThe config node

◆ loadConfig() [3/4]

void tesseract::common::ProfilePluginFactory::loadConfig ( const std::filesystem::path & config,
const tesseract::common::ResourceLocator & locator )

Load plugins from file path.

Parameters
configThe config file path

◆ loadConfig() [4/4]

void tesseract::common::ProfilePluginFactory::loadConfig ( const std::string & config,
const tesseract::common::ResourceLocator & locator )

Load plugins from string.

Parameters
configThe config string

◆ setFactoryData()

void tesseract::common::ProfilePluginFactory::setFactoryData ( std::shared_ptr< const ProfileFactoryData > data)

Set the factory data passed when constructing the plugin.

Parameters
dataThe factory data

◆ getFactoryData()

std::shared_ptr< const ProfileFactoryData > tesseract::common::ProfilePluginFactory::getFactoryData ( ) const

Get the factory data.

Returns
The factory data passed when constructing the plugin

◆ addSearchPath()

void tesseract::common::ProfilePluginFactory::addSearchPath ( const std::string & path)

Add location for the plugin loader to search.

Parameters
pathThe full path to the directory

◆ getSearchPaths()

std::vector< std::string > tesseract::common::ProfilePluginFactory::getSearchPaths ( ) const

Get the plugin search paths.

Returns
The search paths

◆ addSearchLibrary()

void tesseract::common::ProfilePluginFactory::addSearchLibrary ( const std::string & library_name)

Add a library to search for plugin name.

Parameters
library_nameThe library name without the prefix or suffix

◆ getSearchLibraries()

std::vector< std::string > tesseract::common::ProfilePluginFactory::getSearchLibraries ( ) const

Get the plugin search libraries.

Returns
The search libraries

◆ addPlugin()

void tesseract::common::ProfilePluginFactory::addPlugin ( const std::string & ns,
const std::string & name,
tesseract::common::PluginInfo plugin_info )

Add a profile plugin.

Parameters
nsThe namespace
nameThe name
plugin_infoThe plugin information

◆ hasPlugins()

bool tesseract::common::ProfilePluginFactory::hasPlugins ( ) const

Check if it has profile plugins.

Returns
True if profile PluginInfoMap is not empty, otherwise fale

◆ getPlugins()

std::map< std::string, tesseract::common::PluginInfoMap > tesseract::common::ProfilePluginFactory::getPlugins ( ) const

Get the map of profile plugins.

Returns
A map of plugins

◆ removePlugin()

void tesseract::common::ProfilePluginFactory::removePlugin ( const std::string & ns,
const std::string & name )

Remove profile plugin.

Parameters
nsThe namespace
nameThe name of the profile to remove

◆ create() [1/2]

std::unique_ptr< Profile > tesseract::common::ProfilePluginFactory::create ( const std::string & ns,
const std::string & name ) const

Get profile object given name.

This looks for profile plugin info. If not found nullptr is returned.

Parameters
nsThe namespace
nameThe name

◆ create() [2/2]

std::unique_ptr< Profile > tesseract::common::ProfilePluginFactory::create ( const std::string & name,
const PluginInfo & plugin_info ) const

Get profile object given plugin info.

Parameters
nameThe name
plugin_infoThe plugin information to create profile object

◆ saveConfig()

void tesseract::common::ProfilePluginFactory::saveConfig ( const std::filesystem::path & file_path) const

Save the plugin information to a yaml config file.

Parameters
file_pathThe file path

◆ getConfig()

YAML::Node tesseract::common::ProfilePluginFactory::getConfig ( ) const

Get the plugin information config as a yaml node.

Returns
The plugin information config yaml node/

◆ getProfileDictionary()

ProfileDictionary tesseract::common::ProfilePluginFactory::getProfileDictionary ( ) const

This will load all plugins into a profile dictionary.

Returns
A profile dictionary