Class for loading plugin resources registered according to the conventions defined by the pluginlib package.
More...
#include <auto_apms_util/resource.hpp>
|
| PluginClassLoader (const std::string &base_package, const std::string &base_class, const std::set< std::string > &exclude_packages={}) |
| Standard PluginClassLoader constructor.
|
|
|
static PluginClassLoader | makeUnambiguousPluginClassLoader (const std::string &base_package, const std::string &base_class, const std::set< std::string > &exclude_packages={}, const std::map< std::string, std::string > &reserved_names={}) |
| Parse all associated plugin manifest files registered with the ament resource index and instantiate a PluginClassLoader.
|
|
template<typename BaseT>
class auto_apms_util::PluginClassLoader< BaseT >
Class for loading plugin resources registered according to the conventions defined by the pluginlib package.
- Template Parameters
-
BaseT | Base class of the plugin. |
Definition at line 96 of file resource.hpp.
◆ PluginClassLoader()
template<typename BaseT>
PluginClassLoader |
( |
const std::string & | base_package, |
|
|
const std::string & | base_class, |
|
|
const std::set< std::string > & | exclude_packages = {} ) |
|
inline |
Standard PluginClassLoader constructor.
Alternatively, if you want to verify that only unique class names are loaded, have a look at PluginClassLoader::makeUnambiguousPluginClassLoader.
- Parameters
-
base_package | Name of the package containing the base_class . Will throw an error if it is not installed. |
base_class | Fully qualified name of the base class that the class loader will use for determining which classes listed in a plugins.xml file are associated with this instance. |
exclude_packages | Packages to exclude when searching for plugins. |
- Exceptions
-
ament_index_cpp::PackageNotFoundError | if base_package is not installed. |
auto_apms_util::exceptions::ResourceError | if no plugins of type base_class were found. |
Definition at line 153 of file resource.hpp.
◆ makeUnambiguousPluginClassLoader()
template<typename BaseT>
PluginClassLoader< BaseT > makeUnambiguousPluginClassLoader |
( |
const std::string & | base_package, |
|
|
const std::string & | base_class, |
|
|
const std::set< std::string > & | exclude_packages = {}, |
|
|
const std::map< std::string, std::string > & | reserved_names = {} ) |
|
inlinestatic |
Parse all associated plugin manifest files registered with the ament resource index and instantiate a PluginClassLoader.
This factory method additionally performs an ambiguity check. This means that it verifies that only unique class names are being registered by the searched packages. Using the standard constructor, previously registered classes are being overriden if the same class name is being parsed again. Therefore, this method offers the preferred way of instantiating a PluginClassLoader.
- Template Parameters
-
LoaderT | Type of the plugin class loader. |
- Parameters
-
base_package | Name of the package containing the base_class . Will throw an error if it is not installed. |
base_class | Fully qualified name of the base class that the class loader will use for determining which classes listed in a plugins.xml file are associated with this instance. |
exclude_packages | Packages to exclude when searching for plugins. |
reserved_names | Map of reserved class names and the package name that makes the reservation. If any of these class names are found, an error is being raised (Used internally during build time when installed resources aren't availabel yet). |
- Exceptions
-
ament_index_cpp::PackageNotFoundError | if base_package is not installed. |
auto_apms_util::exceptions::ResourceError | if no plugins of type base_class were found. |
auto_apms_util::exceptions::ResourceError | if multiple packages register a resource using the same class name (or a name in reserved_names is found). |
Definition at line 160 of file resource.hpp.
The documentation for this class was generated from the following file: