Public Member Functions | Private Member Functions | Private Attributes
class_loader::MultiLibraryClassLoader Class Reference

A ClassLoader that can bind more than one runtime library. More...

#include <multi_library_class_loader.h>

List of all members.

Public Member Functions

template<class Base >
boost::shared_ptr< BasecreateInstance (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.
template<class Base >
boost::shared_ptr< BasecreateInstance (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.
template<class Base >
BasecreateUnmanagedInstance (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.
template<class Base >
BasecreateUnmanagedInstance (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.
template<class Base >
std::vector< std::string > getAvailableClasses ()
 Gets a list of all classes that are loaded by the class loader.
template<class Base >
std::vector< std::string > getAvailableClassesForLibrary (const std::string &library_path)
 Gets a list of all classes loaded for a particular library.
std::vector< std::string > getRegisteredLibraries ()
 Gets a list of all libraries opened by this class loader @.
template<class Base >
bool isClassAvailable (const std::string &class_name)
 Indicates if a class has been loaded and can be instantiated.
bool isLibraryAvailable (const std::string &library_path)
 Indicates if a library has been loaded into memory.
void loadLibrary (const std::string &library_path)
 Loads a library into memory for this class loader.
 MultiLibraryClassLoader (bool enable_ondemand_loadunload)
 Constructor for the class.
int unloadLibrary (const std::string &library_path)
 Unloads a library for this class loader.
virtual ~MultiLibraryClassLoader ()
 Virtual destructor for class.

Private Member Functions

ClassLoaderVector getAllAvailableClassLoaders ()
 Gets all class loaders loaded within scope.
ClassLoadergetClassLoaderForLibrary (const std::string &library_path)
 Gets a handle to the class loader corresponding to a specific runtime library.
bool isOnDemandLoadUnloadEnabled ()
 Indicates if on-demand (lazy) load/unload is enabled so libraries are loaded/unloaded automatically as needed.
void shutdownAllClassLoaders ()
 Destroys all ClassLoaders.

Private Attributes

LibraryToClassLoaderMap active_class_loaders_
bool enable_ondemand_loadunload_
boost::mutex loader_mutex_

Detailed Description

A ClassLoader that can bind more than one runtime library.

Definition at line 47 of file multi_library_class_loader.h.


Constructor & Destructor Documentation

Constructor for the class.

Parameters:
enable_ondemand_loadunload- Flag indicates if classes are to be loaded/unloaded automatically as class_loader are created and destroyed

Definition at line 35 of file multi_library_class_loader.cpp.

Virtual destructor for class.

Definition at line 40 of file multi_library_class_loader.cpp.


Member Function Documentation

template<class Base >
boost::shared_ptr<Base> class_loader::MultiLibraryClassLoader::createInstance ( const std::string &  class_name) [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.

Parameters:
Base- polymorphic type indicating base class
class_name- the name of the concrete plugin class we want to instantiate
Returns:
A boost::shared_ptr<Base> to newly created plugin

Definition at line 69 of file multi_library_class_loader.h.

template<class Base >
boost::shared_ptr<Base> class_loader::MultiLibraryClassLoader::createInstance ( const std::string &  class_name,
const std::string &  library_path 
) [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.

Parameters:
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
Returns:
A boost::shared_ptr<Base> to newly created plugin

Definition at line 92 of file multi_library_class_loader.h.

template<class Base >
Base* class_loader::MultiLibraryClassLoader::createUnmanagedInstance ( const std::string &  class_name) [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.

Parameters:
Base- polymorphic type indicating base class
class_name- the name of the concrete plugin class we want to instantiate
Returns:
An unmanaged Base* to newly created plugin

Definition at line 110 of file multi_library_class_loader.h.

template<class Base >
Base* class_loader::MultiLibraryClassLoader::createUnmanagedInstance ( const std::string &  class_name,
const std::string &  library_path 
) [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.

Parameters:
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 132 of file multi_library_class_loader.h.

Gets all class loaders loaded within scope.

Definition at line 61 of file multi_library_class_loader.cpp.

template<class Base >
std::vector<std::string> class_loader::MultiLibraryClassLoader::getAvailableClasses ( ) [inline]

Gets a list of all classes that are loaded by the class loader.

Parameters:
Base- polymorphic type indicating Base class
Returns:
A vector<string> of the available classes

Definition at line 167 of file multi_library_class_loader.h.

template<class Base >
std::vector<std::string> class_loader::MultiLibraryClassLoader::getAvailableClassesForLibrary ( const std::string &  library_path) [inline]

Gets a list of all classes loaded for a particular library.

Parameters:
Base- polymorphic type indicating Base class
Returns:
A vector<string> of the available classes in the passed library

Definition at line 186 of file multi_library_class_loader.h.

ClassLoader * class_loader::MultiLibraryClassLoader::getClassLoaderForLibrary ( const std::string &  library_path) [private]

Gets a handle to the class loader corresponding to a specific runtime library.

Parameters:
library_path- the library from which we want to create the plugin
Returns:
A pointer to the ClassLoader*, == NULL if not found

Definition at line 56 of file multi_library_class_loader.cpp.

Gets a list of all libraries opened by this class loader @.

Returns:
A list of libraries opened by this class loader

Definition at line 45 of file multi_library_class_loader.cpp.

template<class Base >
bool class_loader::MultiLibraryClassLoader::isClassAvailable ( const std::string &  class_name) [inline]

Indicates if a class has been loaded and can be instantiated.

Parameters:
Base- polymorphic type indicating Base class
class_name- name of class that is be inquired about
Returns:
true if loaded, false otherwise

Definition at line 148 of file multi_library_class_loader.h.

bool class_loader::MultiLibraryClassLoader::isLibraryAvailable ( const std::string &  library_path)

Indicates if a library has been loaded into memory.

Parameters:
library_path- The full qualified path to the runtime library
Returns:
true if library is loaded, false otherwise

Definition at line 69 of file multi_library_class_loader.cpp.

Indicates if on-demand (lazy) load/unload is enabled so libraries are loaded/unloaded automatically as needed.

Definition at line 222 of file multi_library_class_loader.h.

void class_loader::MultiLibraryClassLoader::loadLibrary ( const std::string &  library_path)

Loads a library into memory for this class loader.

Parameters:
library_path- the fully qualified path to the runtime library

Definition at line 75 of file multi_library_class_loader.cpp.

Destroys all ClassLoaders.

Definition at line 81 of file multi_library_class_loader.cpp.

int class_loader::MultiLibraryClassLoader::unloadLibrary ( const std::string &  library_path)

Unloads a library for this class loader.

Parameters:
library_path- the fully qualified path to the runtime library

Definition at line 88 of file multi_library_class_loader.cpp.


Member Data Documentation

Definition at line 243 of file multi_library_class_loader.h.

Definition at line 242 of file multi_library_class_loader.h.

Definition at line 244 of file multi_library_class_loader.h.


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


class_loader
Author(s): Mirza Shah
autogenerated on Sun Oct 5 2014 22:50:57