Loadable Module Support. More...
#include <deLoadableModule.h>
Public Types | |
| enum | eErrorCodes { eecSuccess, eecCreateModuleFailed } |
Error Codes. More... | |
Public Member Functions | |
Constructors and Destructors | |
| deLoadableModule (deModuleSystem *system) | |
| Creates a new loadable module. | |
| virtual | ~deLoadableModule () |
| Cleans up the loadable module. | |
Management | |
| deModuleSystem * | GetSystem () const |
| Retrieves the linked module system. | |
| const decString & | GetLoggingName () const |
| Retrieves the name to use as the source for this module for logging. | |
| void | SetLoggingName (const char *name) |
| Sets the name to use as the source for this module for logging. | |
| void | SetDefaultLoggingName () |
| Sets the default logging name which is "Module <module-name>". | |
| const char * | GetName () const |
| Retrieves the unique name of the module. | |
| void | SetName (const char *name) |
| Sets the unique name of the module. | |
| int | GetType () const |
| Retrieves the type of the module. | |
| void | SetType (int type) |
| Sets the type of the module. | |
| const char * | GetDescription () const |
| Retrieves the description of the module. | |
| void | SetDescription (const char *description) |
| Sets the description of the module. | |
| const char * | GetAuthor () const |
| Retrieves the author of the module. | |
| void | SetAuthor (const char *author) |
| Sets the author of the module. | |
| const char * | GetVersion () const |
| Retrieves the version of the module. | |
| void | SetVersion (const char *version) |
| Sets the version of the module. | |
| const char * | GetPattern () const |
| Retrieves the file pattern recognized by this module if a multiple type module. | |
| void | SetPattern (const char *pattern) |
| Sets the file pattern recognized by this module if a multiple type moduele. | |
| const char * | GetDirectoryName () const |
| Retrieves the directory name for this module. | |
| void | SetDirectoryName (const char *dirName) |
| Sets the directory name for this module. | |
| bool | GetIsFallback () const |
| Determines if this module is a fallback module. | |
| void | SetIsFallback (bool fallback) |
| Sets if this module is a fallback module. | |
Module Management | |
| deBaseModule * | GetModule () const |
| Retrieves the module if loaded or NULL. | |
| void | SetModule (deBaseModule *module) |
| Sets the module if loaded of NULL. | |
| virtual void | LoadModule ()=0 |
| Loads the module from the appropriate source. | |
| virtual void | UnloadModule ()=0 |
| Unloads the module. | |
| bool | IsLoaded () const |
| Determines if the module is loaded and working. | |
| int | GetErrorCode () const |
| Retrieves the error code from the last load attempt. | |
| void | SetErrorCode (int code) |
| Sets the error code. | |
| bool | IsLocked () const |
| Determines if the module is locked. | |
| virtual void | Lock () |
| Locks the module and increases the lock counter. | |
| virtual void | Unlock () |
| Decreases the lock counter and unlocks the module if the counter reaches 0. | |
| int | GetRefCount () const |
| Retrieves the reference count. | |
| void | AddReference () |
| Adds a reference by increasing the reference counter by 1. | |
| void | FreeReference () |
| Decreases the reference counter by 1 and frees the module if the counter reaches 0. | |
Type Testing and Safe Casting | |
| virtual bool | IsInternalModule () const |
| Determines if this is an internal module. | |
| virtual bool | IsLibraryModule () const |
| Determines if this is a library loaded module. | |
| virtual deInternalModule * | CastToInternalModule () |
| Cast to an internal module. | |
| virtual deLibraryModule * | CastToLibraryModule () |
| Cast to a library loaded rule. | |
Visiting | |
| virtual void | Visit (deLoadableModuleVisitor *visitor) |
| Visits the rule. | |
Loadable Module Support.
Loadable modules are a wrapper around an engine module. They are used to hold informations about an engine module that is loadable from a particular source. Loadable module objects can hold modules which have loaded successfully or with an error. If an error occured the reason is stored for easy resolution finding. Modules can also be locked to avoid unloading them while they are in use by some lengthy process. Provided are two ways to work with subclasses one being a visitor and the other safe casting.
Error Codes.
| eecSuccess |
Module library loaded successfullym and the module is created and ready for usage. |
| eecCreateModuleFailed |
Creating module failed. |
Reimplemented in deLibraryModule.
| deLoadableModule::deLoadableModule | ( | deModuleSystem * | system ) |
Creates a new loadable module.
| virtual deLoadableModule::~deLoadableModule | ( | ) | [virtual] |
Cleans up the loadable module.
| void deLoadableModule::AddReference | ( | ) |
Adds a reference by increasing the reference counter by 1.
| virtual deInternalModule* deLoadableModule::CastToInternalModule | ( | ) | [virtual] |
Cast to an internal module.
Reimplemented in deInternalModule.
| virtual deLibraryModule* deLoadableModule::CastToLibraryModule | ( | ) | [virtual] |
Cast to a library loaded rule.
Reimplemented in deLibraryModule.
| void deLoadableModule::FreeReference | ( | ) |
Decreases the reference counter by 1 and frees the module if the counter reaches 0.
| const char* deLoadableModule::GetAuthor | ( | ) | const [inline] |
Retrieves the author of the module.
| const char* deLoadableModule::GetDescription | ( | ) | const [inline] |
Retrieves the description of the module.
| const char* deLoadableModule::GetDirectoryName | ( | ) | const [inline] |
Retrieves the directory name for this module.
| int deLoadableModule::GetErrorCode | ( | ) | const [inline] |
Retrieves the error code from the last load attempt.
| bool deLoadableModule::GetIsFallback | ( | ) | const [inline] |
Determines if this module is a fallback module.
| const decString& deLoadableModule::GetLoggingName | ( | ) | const [inline] |
Retrieves the name to use as the source for this module for logging.
| deBaseModule* deLoadableModule::GetModule | ( | ) | const [inline] |
Retrieves the module if loaded or NULL.
| const char* deLoadableModule::GetName | ( | ) | const [inline] |
Retrieves the unique name of the module.
| const char* deLoadableModule::GetPattern | ( | ) | const [inline] |
Retrieves the file pattern recognized by this module if a multiple type module.
| int deLoadableModule::GetRefCount | ( | ) | const [inline] |
Retrieves the reference count.
| deModuleSystem* deLoadableModule::GetSystem | ( | ) | const [inline] |
Retrieves the linked module system.
| int deLoadableModule::GetType | ( | ) | const [inline] |
Retrieves the type of the module.
| const char* deLoadableModule::GetVersion | ( | ) | const [inline] |
Retrieves the version of the module.
| virtual bool deLoadableModule::IsInternalModule | ( | ) | const [virtual] |
Determines if this is an internal module.
Reimplemented in deInternalModule.
| virtual bool deLoadableModule::IsLibraryModule | ( | ) | const [virtual] |
Determines if this is a library loaded module.
Reimplemented in deLibraryModule.
| bool deLoadableModule::IsLoaded | ( | ) | const |
Determines if the module is loaded and working.
| bool deLoadableModule::IsLocked | ( | ) | const [inline] |
Determines if the module is locked.
| virtual void deLoadableModule::LoadModule | ( | ) | [pure virtual] |
Loads the module from the appropriate source.
Sets the error code in both the case of success and failure and stored the module for later retrieval.
Implemented in deInternalModule, and deLibraryModule.
| virtual void deLoadableModule::Lock | ( | ) | [virtual] |
Locks the module and increases the lock counter.
| void deLoadableModule::SetAuthor | ( | const char * | author ) |
Sets the author of the module.
| void deLoadableModule::SetDefaultLoggingName | ( | ) |
Sets the default logging name which is "Module <module-name>".
| void deLoadableModule::SetDescription | ( | const char * | description ) |
Sets the description of the module.
| void deLoadableModule::SetDirectoryName | ( | const char * | dirName ) |
Sets the directory name for this module.
| void deLoadableModule::SetErrorCode | ( | int | code ) |
Sets the error code.
| void deLoadableModule::SetIsFallback | ( | bool | fallback ) |
Sets if this module is a fallback module.
| void deLoadableModule::SetLoggingName | ( | const char * | name ) |
Sets the name to use as the source for this module for logging.
| void deLoadableModule::SetModule | ( | deBaseModule * | module ) |
Sets the module if loaded of NULL.
| void deLoadableModule::SetName | ( | const char * | name ) |
Sets the unique name of the module.
| void deLoadableModule::SetPattern | ( | const char * | pattern ) |
Sets the file pattern recognized by this module if a multiple type moduele.
| void deLoadableModule::SetType | ( | int | type ) |
Sets the type of the module.
| void deLoadableModule::SetVersion | ( | const char * | version ) |
Sets the version of the module.
| virtual void deLoadableModule::UnloadModule | ( | ) | [pure virtual] |
Unloads the module.
Sets the module to NULL and clears the error code.
Implemented in deInternalModule, and deLibraryModule.
| virtual void deLoadableModule::Unlock | ( | ) | [virtual] |
Decreases the lock counter and unlocks the module if the counter reaches 0.
| virtual void deLoadableModule::Visit | ( | deLoadableModuleVisitor * | visitor ) | [virtual] |
Visits the rule.
Reimplemented in deInternalModule, and deLibraryModule.
1.7.2