Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose on-demand library load/unload in class loader constructor. #235

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pluginlib/include/pluginlib/class_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ class ClassLoader : public ClassLoaderBase
* \param attrib_name The attribute to search for in manifext.xml files, defaults to "plugin"
* \param plugin_xml_paths The list of paths of plugin.xml files, defaults to be crawled via
* ros::package::getPlugins()
* \param enable_ondemand_loadunload Set this argument to true to enable automatic library
* loading/unloading
* \throws pluginlib::ClassLoaderException if package manifest cannot be found
*/
ClassLoader(
std::string package, std::string base_class,
std::string attrib_name = std::string("plugin"),
std::vector<std::string> plugin_xml_paths = std::vector<std::string>());
std::vector<std::string> plugin_xml_paths = std::vector<std::string>(),
bool enable_ondemand_loadunload = false);

~ClassLoader();

Expand Down
8 changes: 2 additions & 6 deletions pluginlib/include/pluginlib/class_loader_imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,12 @@ namespace pluginlib
template<class T>
ClassLoader<T>::ClassLoader(
std::string package, std::string base_class, std::string attrib_name,
std::vector<std::string> plugin_xml_paths)
std::vector<std::string> plugin_xml_paths, bool enable_ondemand_loadunload)
: plugin_xml_paths_(plugin_xml_paths),
package_(package),
base_class_(base_class),
attrib_name_(attrib_name),
// NOTE: The parameter to the class loader enables/disables on-demand class
// loading/unloading.
// Leaving it off for now... libraries will be loaded immediately and won't
// be unloaded until class loader is destroyed or force unload.
lowlevel_class_loader_(false)
lowlevel_class_loader_(enable_ondemand_loadunload)
/***************************************************************************/
{
ROS_DEBUG_NAMED("pluginlib.ClassLoader", "Creating ClassLoader, base = %s, address = %p",
Expand Down