30 #ifndef PLUGINLIB__CLASS_LOADER_HPP_ 31 #define PLUGINLIB__CLASS_LOADER_HPP_ 37 #include "boost/algorithm/string.hpp" 55 #if __cplusplus >= 201103L 76 std::string package, std::string base_class,
77 std::string attrib_name = std::string(
"plugin"),
78 std::vector<std::string> plugin_xml_paths = std::vector<std::string>());
94 const std::string & lookup_name,
95 bool auto_load =
true);
111 #if __cplusplus >= 201103L 128 UniquePtr<T> createUniqueInstance(
const std::string & lookup_name);
164 virtual std::string
getName(
const std::string & lookup_name);
177 virtual std::string
getClassType(
const std::string & lookup_name);
261 const std::string & package,
262 const std::string & attrib_name,
263 bool force_recrawl =
false);
272 const std::vector<std::string> & plugin_xml_paths);
288 const std::string & library_name,
289 const std::string & exporting_package_name);
311 std::string
joinPaths(
const std::string & path1,
const std::string & path2);
319 const std::string & xml_file, std::map<std::string,
352 #endif // PLUGINLIB__CLASS_LOADER_HPP_ virtual std::string getClassType(const std::string &lookup_name)
Given the lookup name of a class, return the type of the derived class associated with it...
virtual std::string getPluginManifestPath(const std::string &lookup_name)
Given the name of a class, return the path of the associated plugin manifest.
std::map< std::string, ClassDesc > determineAvailableClasses(const std::vector< std::string > &plugin_xml_paths)
Return the available classes.
class_loader::MultiLibraryClassLoader lowlevel_class_loader_
std::string getPathSeparator()
Get the standard path separator for the native OS (e.g. "/" on *nix, "\" on Windows).
std::string getPackageFromPluginXMLFilePath(const std::string &path)
Get the package name from a path to a plugin XML file.
std::string getROSBuildLibraryPath(const std::string &exporting_package_name)
Given a package name, return the path where rosbuild thinks plugins are installed.
virtual int unloadLibraryForClass(const std::string &lookup_name)
Decrement the counter for the library containing a class with a given name.
virtual std::string getClassDescription(const std::string &lookup_name)
Given the lookup name of a class, return its description.
boost::shared_ptr< T > createInstance(const std::string &lookup_name)
Create an instance of a desired class.
T * createClassInstance(const std::string &lookup_name, bool auto_load=true)
Create an instance of a desired class, optionally loading the associated library too.
virtual void loadLibraryForClass(const std::string &lookup_name)
Attempt to load the library containing a class with a given name.
virtual std::string getClassLibraryPath(const std::string &lookup_name)
Given the name of a class, return the path to its associated library.
Pure virtual base class of pluginlib::ClassLoader which is not templated.
T * createUnmanagedInstance(const std::string &lookup_name)
Create an instance of a desired class.
std::vector< std::string > plugin_xml_paths_
virtual std::string getBaseClassType() const
Given the lookup name of a class, return the type of the associated base class.
virtual std::string getClassPackage(const std::string &lookup_name)
Given the name of a class, return name of the containing package.
bool isClassLoaded(const std::string &lookup_name)
Check if the library for a given class is currently loaded.
std::string extractPackageNameFromPackageXML(const std::string &package_xml_path)
Open a package.xml file and extract the package name (i.e. contents of <name> tag).
std::map< std::string, ClassDesc >::iterator ClassMapIterator
Storage for information about a given class.
virtual void refreshDeclaredClasses()
Refresh the list of all available classes for this ClassLoader's base class type. ...
std::string joinPaths(const std::string &path1, const std::string &path2)
Join two filesystem paths together utilzing appropriate path separator.
std::vector< std::string > getDeclaredClasses()
Return a list of all available classes for this ClassLoader's base class type.
std::vector< std::string > getAllLibraryPathsToTry(const std::string &library_name, const std::string &exporting_package_name)
Get a list of paths to try to find a library.
std::unique_ptr< Base, DeleterType< Base > > UniquePtr
std::vector< std::string > getCatkinLibraryPaths()
Return the paths where libraries are installed according to the Catkin build system.
virtual std::vector< std::string > getRegisteredLibraries()
Return the libraries that are registered and can be loaded.
virtual std::string getName(const std::string &lookup_name)
Strip the package name off of a lookup name.
std::vector< std::string > getPluginXmlPaths()
Return a list of all available plugin manifest paths for this ClassLoader's base class type...
std::string stripAllButFileFromPath(const std::string &path)
Strip all but the filename from an explicit file path.
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 >())
A class to help manage and load classes.
virtual bool isClassAvailable(const std::string &lookup_name)
Check if the class associated with a plugin name is available to be loaded.
std::map< std::string, ClassDesc > classes_available_
int unloadClassLibraryInternal(const std::string &library_path)
Helper function for unloading a shared library.
std::string getErrorStringForUnknownClass(const std::string &lookup_name)
Return an error message for an unknown class.
void processSingleXMLPluginFile(const std::string &xml_file, std::map< std::string, ClassDesc > &class_available)
Parse a plugin XML file.