A ClassLoader that can bind more than one runtime library. More...
#include <multi_library_class_loader.hpp>
Public Member Functions | |
template<class Base > | |
boost::shared_ptr< Base > | createInstance (const std::string &class_name) |
Creates an instance of an object of given class name with ancestor class Base This version does not look in a specific library for the factory, but rather the first open library that defines the classs. More... | |
template<class Base > | |
boost::shared_ptr< Base > | createInstance (const std::string &class_name, const std::string &library_path) |
Creates an instance of an object of given class name with ancestor class Base This version takes a specific library to make explicit the factory being used. More... | |
template<class Base > | |
Base * | createUnmanagedInstance (const std::string &class_name) |
Creates an instance of an object of given class name with ancestor class Base This version does not look in a specific library for the factory, but rather the first open library that defines the classs This version should not be used as the plugin system cannot do automated safe loading/unloadings. More... | |
template<class Base > | |
Base * | createUnmanagedInstance (const std::string &class_name, const std::string &library_path) |
Creates an instance of an object of given class name with ancestor class Base This version takes a specific library to make explicit the factory being used This version should not be used as the plugin system cannot do automated safe loading/unloadings. More... | |
template<class Base > | |
std::vector< std::string > | getAvailableClasses () |
Gets a list of all classes that are loaded by the class loader. More... | |
template<class Base > | |
std::vector< std::string > | getAvailableClassesForLibrary (const std::string &library_path) |
Gets a list of all classes loaded for a particular library. More... | |
std::vector< std::string > | getRegisteredLibraries () |
Gets a list of all libraries opened by this class loader . More... | |
template<class Base > | |
bool | isClassAvailable (const std::string &class_name) |
Indicates if a class has been loaded and can be instantiated. More... | |
bool | isLibraryAvailable (const std::string &library_path) |
Indicates if a library has been loaded into memory. More... | |
void | loadLibrary (const std::string &library_path) |
Loads a library into memory for this class loader. More... | |
MultiLibraryClassLoader (bool enable_ondemand_loadunload) | |
Constructor for the class. More... | |
int | unloadLibrary (const std::string &library_path) |
Unloads a library for this class loader. More... | |
virtual | ~MultiLibraryClassLoader () |
Virtual destructor for class. More... | |
Private Member Functions | |
ClassLoaderVector | getAllAvailableClassLoaders () |
Gets all class loaders loaded within scope. More... | |
template<typename Base > | |
ClassLoader * | getClassLoaderForClass (const std::string &class_name) |
Gets a handle to the class loader corresponding to a specific class. More... | |
ClassLoader * | getClassLoaderForLibrary (const std::string &library_path) |
Gets a handle to the class loader corresponding to a specific runtime library. More... | |
bool | isOnDemandLoadUnloadEnabled () |
Indicates if on-demand (lazy) load/unload is enabled so libraries are loaded/unloaded automatically as needed. More... | |
void | shutdownAllClassLoaders () |
Destroys all ClassLoaders. More... | |
Private Attributes | |
LibraryToClassLoaderMap | active_class_loaders_ |
bool | enable_ondemand_loadunload_ |
boost::mutex | loader_mutex_ |
A ClassLoader that can bind more than one runtime library.
Definition at line 58 of file multi_library_class_loader.hpp.
class_loader::MultiLibraryClassLoader::MultiLibraryClassLoader | ( | bool | enable_ondemand_loadunload | ) |
Constructor for the class.
enable_ondemand_loadunload | - Flag indicates if classes are to be loaded/unloaded automatically as class_loader are created and destroyed |
Definition at line 38 of file multi_library_class_loader.cpp.
|
virtual |
Virtual destructor for class.
Definition at line 43 of file multi_library_class_loader.cpp.
|
inline |
Creates an instance of an object of given class name with ancestor class Base This version does not look in a specific library for the factory, but rather the first open library that defines the classs.
Base | - polymorphic type indicating base class |
class_name | - the name of the concrete plugin class we want to instantiate |
Definition at line 80 of file multi_library_class_loader.hpp.
|
inline |
Creates an instance of an object of given class name with ancestor class Base This version takes a specific library to make explicit the factory being used.
Base | - polymorphic type indicating base class |
class_name | - the name of the concrete plugin class we want to instantiate |
library_path | - the library from which we want to create the plugin |
Definition at line 108 of file multi_library_class_loader.hpp.
|
inline |
Creates an instance of an object of given class name with ancestor class Base This version does not look in a specific library for the factory, but rather the first open library that defines the classs This version should not be used as the plugin system cannot do automated safe loading/unloadings.
Base | - polymorphic type indicating base class |
class_name | - the name of the concrete plugin class we want to instantiate |
Definition at line 177 of file multi_library_class_loader.hpp.
|
inline |
Creates an instance of an object of given class name with ancestor class Base This version takes a specific library to make explicit the factory being used This version should not be used as the plugin system cannot do automated safe loading/unloadings.
Base | - polymorphic type indicating Base class |
class_name | - name of class for which we want to create instance |
library_path | - the fully qualified path to the runtime library |
Definition at line 196 of file multi_library_class_loader.hpp.
|
private |
Gets all class loaders loaded within scope.
Definition at line 68 of file multi_library_class_loader.cpp.
|
inline |
Gets a list of all classes that are loaded by the class loader.
Definition at line 235 of file multi_library_class_loader.hpp.
|
inline |
Gets a list of all classes loaded for a particular library.
Definition at line 254 of file multi_library_class_loader.hpp.
|
inlineprivate |
Gets a handle to the class loader corresponding to a specific class.
class_name | - name of class for which we want to create instance |
Definition at line 306 of file multi_library_class_loader.hpp.
|
private |
Gets a handle to the class loader corresponding to a specific runtime library.
library_path | - the library from which we want to create the plugin |
Definition at line 60 of file multi_library_class_loader.cpp.
std::vector< std::string > class_loader::MultiLibraryClassLoader::getRegisteredLibraries | ( | ) |
Gets a list of all libraries opened by this class loader .
Definition at line 48 of file multi_library_class_loader.cpp.
|
inline |
Indicates if a class has been loaded and can be instantiated.
Base | - polymorphic type indicating Base class |
class_name | - name of class that is be inquired about |
Definition at line 215 of file multi_library_class_loader.hpp.
bool class_loader::MultiLibraryClassLoader::isLibraryAvailable | ( | const std::string & | library_path | ) |
Indicates if a library has been loaded into memory.
library_path | - The full qualified path to the runtime library |
Definition at line 80 of file multi_library_class_loader.cpp.
|
inlineprivate |
Indicates if on-demand (lazy) load/unload is enabled so libraries are loaded/unloaded automatically as needed.
Definition at line 291 of file multi_library_class_loader.hpp.
void class_loader::MultiLibraryClassLoader::loadLibrary | ( | const std::string & | library_path | ) |
Loads a library into memory for this class loader.
library_path | - the fully qualified path to the runtime library |
Definition at line 85 of file multi_library_class_loader.cpp.
|
private |
Destroys all ClassLoaders.
Definition at line 93 of file multi_library_class_loader.cpp.
int class_loader::MultiLibraryClassLoader::unloadLibrary | ( | const std::string & | library_path | ) |
Unloads a library for this class loader.
library_path | - the fully qualified path to the runtime library |
Definition at line 101 of file multi_library_class_loader.cpp.
|
private |
Definition at line 332 of file multi_library_class_loader.hpp.
|
private |
Definition at line 331 of file multi_library_class_loader.hpp.
|
private |
Definition at line 333 of file multi_library_class_loader.hpp.