15#ifndef AWVIZ_COMMON__PLUGIN_FACTORY_HPP_
16#define AWVIZ_COMMON__PLUGIN_FACTORY_HPP_
18#include <pluginlib/class_loader.hpp>
52 PluginFactory(
const std::string & package,
const std::string & base_class_type)
54 class_loader_ = std::make_shared<pluginlib::ClassLoader<T>>(package, base_class_type);
64 return class_loader_->getPluginManifestPath(lookup_name);
74 auto name = class_loader_->getName(lookup_name);
75 auto type = class_loader_->getClassType(lookup_name);
76 auto package = class_loader_->getClassPackage(lookup_name);
77 auto description = class_loader_->getClassDescription(lookup_name);
78 return {lookup_name, name, type, package, description};
90 return class_loader_->createSharedInstance(lookup_name);
91 }
catch (pluginlib::PluginlibException & ex) {
92 std::cerr <<
"[PluginlibException]: " << ex.what() << std::endl;
104 return class_loader_->getDeclaredClasses();
108 std::shared_ptr<pluginlib::ClassLoader<T>> class_loader_;
Abstract base class representing a plugin load-able class factory.
Definition: plugin_factory.hpp:44
virtual std::shared_ptr< T > create_instance(const std::string &lookup_name) const
Create a instance of the plugin.
Definition: plugin_factory.hpp:87
std::vector< std::string > get_declared_classes() const
Return a list of all available classes for this ClassLoader's base class type.
Definition: plugin_factory.hpp:102
PluginFactory(const std::string &package, const std::string &base_class_type)
Construct factory loading pluginlib::ClassLoader<T>.
Definition: plugin_factory.hpp:52
PluginInfo get_plugin_info(const std::string &lookup_name) const
Return plugin information.
Definition: plugin_factory.hpp:72
std::string get_plugin_manifest_path(const std::string &lookup_name) const
Return plugin manifest path.
Definition: plugin_factory.hpp:62
Definition: display.hpp:30
Struct to bundle the information of plugin.
Definition: plugin_factory.hpp:31
std::string type
Type of class.
Definition: plugin_factory.hpp:34
std::string package
Package name.
Definition: plugin_factory.hpp:35
std::string id
Class id.
Definition: plugin_factory.hpp:32
std::string name
Name of class.
Definition: plugin_factory.hpp:33
std::string description
Description of class.
Definition: plugin_factory.hpp:36