Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
PreloadingClassLoader< Impl, Base > Class Template Reference

This pluginlib classloader alternative can load compiled-in classes and provide them as if they were loaded via the standard pluginlib search mechanism - without even triggering the search. More...

#include <preloading_class_loader.hpp>

Inheritance diagram for PreloadingClassLoader< Impl, Base >:
Inheritance graph
[legend]

Public Member Functions

 ~PreloadingClassLoader () override
 
- Public Member Functions inherited from class_loader::ClassLoader
CLASS_LOADER_PUBLIC ClassLoader (const std::string &library_path, bool ondemand_load_unload=false)
 
boost::shared_ptr< BasecreateInstance (const std::string &derived_class_name)
 
std::shared_ptr< BasecreateSharedInstance (const std::string &derived_class_name)
 
UniquePtr< BasecreateUniqueInstance (const std::string &derived_class_name)
 
BasecreateUnmanagedInstance (const std::string &derived_class_name)
 
std::vector< std::string > getAvailableClasses ()
 
CLASS_LOADER_PUBLIC std::string getLibraryPath ()
 
bool isClassAvailable (const std::string &class_name)
 
CLASS_LOADER_PUBLIC bool isLibraryLoaded ()
 
CLASS_LOADER_PUBLIC bool isLibraryLoadedByAnyClassloader ()
 
CLASS_LOADER_PUBLIC bool isOnDemandLoadUnloadEnabled ()
 
CLASS_LOADER_PUBLIC void loadLibrary ()
 
CLASS_LOADER_PUBLIC int unloadLibrary ()
 
virtual CLASS_LOADER_PUBLIC ~ClassLoader ()
 

Static Public Member Functions

static void preload (const std::string &pluginlibType, pluginlib::ClassLoader< Base > &loader)
 "Install" the preloading classloader into the given classloader. More...
 
static void unPreload (const std::string &pluginlibType, pluginlib::ClassLoader< Base > &loader)
 Revert the effect of preload(). More...
 

Protected Member Functions

 PreloadingClassLoader ()
 Construct the class loader. More...
 

Additional Inherited Members

- Public Types inherited from class_loader::ClassLoader
typedef std::function< void(Base *)> DeleterType
 
typedef std::unique_ptr< Base, DeleterType< Base > > UniquePtr
 

Detailed Description

template<typename Impl, typename Base>
class PreloadingClassLoader< Impl, Base >

This pluginlib classloader alternative can load compiled-in classes and provide them as if they were loaded via the standard pluginlib search mechanism - without even triggering the search.

Template Parameters
ImplThe class to be preloaded.
BaseThe base class for which pluginlib is looking.

Definition at line 37 of file preloading_class_loader.hpp.

Constructor & Destructor Documentation

◆ PreloadingClassLoader()

template<typename Impl , typename Base >
PreloadingClassLoader< Impl, Base >::PreloadingClassLoader ( )
inlineprotected

Construct the class loader.

Note
Do not call this constructor directly. Instead, let the preload() method construct it.

Definition at line 44 of file preloading_class_loader.hpp.

◆ ~PreloadingClassLoader()

template<typename Impl , typename Base >
PreloadingClassLoader< Impl, Base >::~PreloadingClassLoader ( )
inlineoverride

Definition at line 54 of file preloading_class_loader.hpp.

Member Function Documentation

◆ preload()

template<typename Impl , typename Base >
static void PreloadingClassLoader< Impl, Base >::preload ( const std::string &  pluginlibType,
pluginlib::ClassLoader< Base > &  loader 
)
inlinestatic

"Install" the preloading classloader into the given classloader.

Parameters
[in]pluginlibTypeName of the type that would be search for by pluginlib.
[in]loaderThe pluginlib loader into which the class should be injected.

Definition at line 68 of file preloading_class_loader.hpp.

◆ unPreload()

template<typename Impl , typename Base >
static void PreloadingClassLoader< Impl, Base >::unPreload ( const std::string &  pluginlibType,
pluginlib::ClassLoader< Base > &  loader 
)
inlinestatic

Revert the effect of preload().

Parameters
[in]pluginlibType
[in]loaderThe pluginlib classloader from which the class should be "un-injected".
Note
All instances of the preloaded class should be destroyed prior to calling this function, otherwise segfaults can happen.

Definition at line 84 of file preloading_class_loader.hpp.


The documentation for this class was generated from the following file:


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Sep 14 2024 02:49:40