PixelLightAPI  .
Public Member Functions | Static Public Member Functions | Public Attributes
PLCore::ClassManager Class Reference

Manager providing access to RTTI classes. More...

#include <ClassManager.h>

List of all members.

Public Member Functions

const List< const Module * > & GetModules () const
 Get all registered modules.
const ModuleGetModuleByID (uint32 nModuleID) const
 Get module by ID.
PLCORE_API const ModuleGetModuleByName (const String &sModuleName) const
 Get module by name.
PLCORE_API const ModuleLoadModule (const String &sAbsFilename, bool bForceBuildTypeMatch=false)
 Load a module.
PLCORE_API bool ScanPlugins (const String &sPath, ERecursive nRecursive=Recursive, bool bDelayedPluginLoading=true)
 Scan a directory for compatible plugins and load them in.
PLCORE_API bool LoadPlugin (const String &sFilename, bool bDelayedPluginLoading=true)
 Load plugin.
PLCORE_API bool UnloadPlugin (Module *pModule)
 Unload plugin.
PLCORE_API bool UnloadAllPlugins ()
 Unload all plugins.
const List< const Class * > & GetClasses () const
 Get all registered classes.
PLCORE_API void GetClasses (List< const Class * > &lstClasses, const String &sClass, ERecursive nRecursive=Recursive, EIncludeBase nIncludeBase=IncludeBase, EIncludeAbstract nIncludeAbstract=IncludeAbstract, uint32 nModuleID=0) const
 Get classes based on their base class and/or module (search for classes)
const ClassGetClass (const String &sClass) const
 Get class.

Static Public Member Functions

static PLCORE_API ClassManagerGetInstance ()
static PLCORE_API bool HasInstance ()

Public Attributes

Event< const Module * > EventModuleLoaded
Event< const Module * > EventModuleUnloaded
Event< const Class * > EventClassLoaded
Event< const Class * > EventClassUnloaded

Detailed Description

Manager providing access to RTTI classes.


Member Function Documentation

static PLCORE_API ClassManager* PLCore::ClassManager::GetInstance ( ) [static]
static PLCORE_API bool PLCore::ClassManager::HasInstance ( ) [static]
const List< const Module * > & PLCore::ClassManager::GetModules ( ) const [inline]

Get all registered modules.

Returns:
List of modules (do not destroy the returned instances)
const Module * PLCore::ClassManager::GetModuleByID ( uint32  nModuleID) const [inline]

Get module by ID.

Parameters:
[in]nModuleIDModule ID
Returns:
Pointer to module (do not destroy the returned instance, can be a null pointer)
PLCORE_API const Module* PLCore::ClassManager::GetModuleByName ( const String sModuleName) const

Get module by name.

Parameters:
[in]sModuleNameModule name
Returns:
Pointer to module (do not destroy the returned instance, can be a null pointer)
Note:
  • Whenever possible use "GetModuleByID()" instead of "GetModuleByName()" because unlike the module name, the module ID is guaranteed do be unique
PLCORE_API const Module* PLCore::ClassManager::LoadModule ( const String sAbsFilename,
bool  bForceBuildTypeMatch = false 
)

Load a module.

Parameters:
[in]sAbsFilenameAbsolute filename of the shared library to load in
[in]bForceBuildTypeMatch'true' to force a build type match, else 'false'
Returns:
The loaded module, null pointer on error (do not destroy the returned instance)
Note:
  • If the module was already loaded, this module instance is returned instead
PLCORE_API bool PLCore::ClassManager::ScanPlugins ( const String sPath,
ERecursive  nRecursive = Recursive,
bool  bDelayedPluginLoading = true 
)

Scan a directory for compatible plugins and load them in.

Parameters:
[in]sPathDirectory to search in
[in]nRecursiveAlso take sub-directories into account?
[in]bDelayedPluginLoading'true' if it's allowed to perform delayed shared library loading to speed up the program start, else 'false'
Returns:
'true' if all went fine, else 'false'
Remarks:
This function scans for '.plugin'-files and registers the plugins if all went fine.
PLCORE_API bool PLCore::ClassManager::LoadPlugin ( const String sFilename,
bool  bDelayedPluginLoading = true 
)

Load plugin.

Parameters:
[in]sFilenameFilename of the plugin (must be a '.plugin'-file!)
[in]bDelayedPluginLoading'true' if it's allowed to perform delayed shared library loading to speed up the program start, else 'false'
Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::ClassManager::UnloadPlugin ( Module pModule)

Unload plugin.

Parameters:
[in]pModuleModule to unload (must be valid!)
Returns:
'true' if all went fine, else 'false' (maybe the module is static)
Note:
  • You can only unload plugins modules, other modules will be ignored

Unload all plugins.

Returns:
'true' if all went fine, else 'false'
const List< const Class * > & PLCore::ClassManager::GetClasses ( ) const [inline]

Get all registered classes.

Returns:
List of classes (do not destroy the returned instances)
PLCORE_API void PLCore::ClassManager::GetClasses ( List< const Class * > &  lstClasses,
const String sClass,
ERecursive  nRecursive = Recursive,
EIncludeBase  nIncludeBase = IncludeBase,
EIncludeAbstract  nIncludeAbstract = IncludeAbstract,
uint32  nModuleID = 0 
) const

Get classes based on their base class and/or module (search for classes)

Parameters:
[out]lstClassesList that receives the found classes (do not destroy the returned instances)
[in]sClassName of base class (with namespace)
[in]nRecursive'Recursive' to list all subclasses of the base class, 'NonRecursive' to only list direct subclasses
[in]nIncludeBase'IncludeBase' to include the base class itself, 'NoBase' to exclude it
[in]nIncludeAbstract'IncludeAbstract' to include classes without a constructor, 'NoAbstract' to exclude them
[in]nModuleIDID of module, or 0 to include the classes from all modules
Remarks:
The found classes will be added to the list that is passed as the first argument to the function. The class list is not automatically cleared by this function.
const Class * PLCore::ClassManager::GetClass ( const String sClass) const [inline]

Get class.

Parameters:
[in]sClassClass name
Returns:
Pointer to the class, or a null pointer on error (do not destroy the returned instance)

Member Data Documentation

A module has been registered (do not destroy the given instance)

A module has been removed (do not destroy the given instance)

A class has been registered. Please note: At the time you receive this event, the class may not yet be fully initialized, this means that even "IsDerivedFrom" may not work, yet. (do not destroy the given instance)

A class has been removed (do not destroy the given instance)


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:03
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported