Drag[en]gine Game Engine  1.0
deLoadableModule Class Referenceabstract

Loadable Module Support. More...

#include <deLoadableModule.h>

Inheritance diagram for deLoadableModule:
deInternalModule deLibraryModule

Public Types

enum  eErrorCodes { eecSuccess, eecCreateModuleFailed }
 Error Codes. More...
 

Public Member Functions

Constructors and Destructors
 deLoadableModule (deModuleSystem *system)
 Creates a new loadable module. More...
 
virtual ~deLoadableModule ()
 Cleans up the loadable module. More...
 
Management
deModuleSystemGetSystem () const
 Retrieves the linked module system. More...
 
const decStringGetLoggingName () const
 Retrieves the name to use as the source for this module for logging. More...
 
void SetLoggingName (const char *name)
 Sets the name to use as the source for this module for logging. More...
 
void SetDefaultLoggingName ()
 Sets the default logging name which is "Module &lt;module-name&gt;". More...
 
const decStringGetName () const
 Retrieves the unique name of the module. More...
 
void SetName (const char *name)
 Sets the unique name of the module. More...
 
deModuleSystem::eModuleTypes GetType () const
 Retrieves the type of the module. More...
 
void SetType (deModuleSystem::eModuleTypes type)
 Sets the type of the module. More...
 
const decString GetDescription () const
 Retrieves the description of the module. More...
 
void SetDescription (const char *description)
 Sets the description of the module. More...
 
const decStringGetAuthor () const
 Retrieves the author of the module. More...
 
void SetAuthor (const char *author)
 Sets the author of the module. More...
 
const decStringGetVersion () const
 Retrieves the version of the module. More...
 
void SetVersion (const char *version)
 Sets the version of the module. More...
 
decStringListGetPatternList ()
 Retrieves the file pattern list recognized by this module if a multiple type module. More...
 
const decStringListGetPatternList () const
 
const decStringGetDefaultExtension () const
 Retrieves the default extension to be used for saving files if this is a multiple type module. More...
 
void SetDefaultExtension (const char *extension)
 Sets the default extension to be used for saving files if this is a multiple type module. More...
 
const decStringGetDirectoryName () const
 Retrieves the directory name for this module. More...
 
void SetDirectoryName (const char *dirName)
 Sets the directory name for this module. More...
 
bool GetIsFallback () const
 
void SetIsFallback (bool fallback)
 
bool GetEnabled () const
 Determines if the module is enabled. More...
 
void SetEnabled (bool enabled)
 Sets if the module is enabled. More...
 
Module Management
deBaseModuleGetModule () const
 Retrieves the module if loaded or NULL. More...
 
void SetModule (deBaseModule *module)
 Sets the module if loaded of NULL. More...
 
virtual void LoadModule ()=0
 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. More...
 
virtual void UnloadModule ()=0
 Unloads the module. Sets the module to NULL and clears the error code. More...
 
bool IsLoaded () const
 Determines if the module is loaded and working. More...
 
int GetErrorCode () const
 Retrieves the error code from the last load attempt. More...
 
void SetErrorCode (int code)
 Sets the error code. More...
 
bool IsLocked () const
 Determines if the module is locked. More...
 
virtual void Lock ()
 Locks the module and increases the lock counter. More...
 
virtual void Unlock ()
 Decreases the lock counter and unlocks the module if the counter reaches 0. More...
 
int GetRefCount () const
 Retrieves the reference count. More...
 
void AddReference ()
 Adds a reference by increasing the reference counter by 1. More...
 
void FreeReference ()
 Decreases the reference counter by 1 and frees the module if the counter reaches 0. More...
 
Type Testing and Safe Casting
virtual bool IsInternalModule () const
 Determines if this is an internal module. More...
 
virtual bool IsLibraryModule () const
 Determines if this is a library loaded module. More...
 
virtual deInternalModuleCastToInternalModule ()
 Cast to an internal module. More...
 
virtual deLibraryModuleCastToLibraryModule ()
 Cast to a library loaded rule. More...
 
Visiting
virtual void Visit (deLoadableModuleVisitor *visitor)
 Visits the rule. More...
 

Detailed Description

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.

Author
Pl├╝ss Roland
Version
1.0
Date
2014

Member Enumeration Documentation

◆ eErrorCodes

Error Codes.

Enumerator
eecSuccess 

Module library loaded successfullym and the module is created and ready for usage.

eecCreateModuleFailed 

Creating module failed.

Constructor & Destructor Documentation

◆ deLoadableModule()

deLoadableModule::deLoadableModule ( deModuleSystem system)

Creates a new loadable module.

◆ ~deLoadableModule()

virtual deLoadableModule::~deLoadableModule ( )
virtual

Cleans up the loadable module.

Member Function Documentation

◆ AddReference()

void deLoadableModule::AddReference ( )

Adds a reference by increasing the reference counter by 1.

Referenced by GetRefCount().

◆ CastToInternalModule()

virtual deInternalModule* deLoadableModule::CastToInternalModule ( )
virtual

Cast to an internal module.

Reimplemented in deInternalModule.

Referenced by GetRefCount().

◆ CastToLibraryModule()

virtual deLibraryModule* deLoadableModule::CastToLibraryModule ( )
virtual

Cast to a library loaded rule.

Reimplemented in deLibraryModule.

Referenced by GetRefCount().

◆ FreeReference()

void deLoadableModule::FreeReference ( )

Decreases the reference counter by 1 and frees the module if the counter reaches 0.

Referenced by GetRefCount().

◆ GetAuthor()

const decString& deLoadableModule::GetAuthor ( ) const
inline

Retrieves the author of the module.

References SetAuthor().

◆ GetDefaultExtension()

const decString& deLoadableModule::GetDefaultExtension ( ) const
inline

Retrieves the default extension to be used for saving files if this is a multiple type module.

References SetDefaultExtension().

◆ GetDescription()

const decString deLoadableModule::GetDescription ( ) const
inline

Retrieves the description of the module.

References SetDescription().

◆ GetDirectoryName()

const decString& deLoadableModule::GetDirectoryName ( ) const
inline

Retrieves the directory name for this module.

References SetDirectoryName().

◆ GetEnabled()

bool deLoadableModule::GetEnabled ( ) const
inline

Determines if the module is enabled.

Disabling a module can be used to prevent a higher version module from being automatically selected. This is especially the case with multiple type modules where the launcher does not set the module version to be used explicitely. By default modules are enabled.

References SetEnabled().

◆ GetErrorCode()

int deLoadableModule::GetErrorCode ( ) const
inline

Retrieves the error code from the last load attempt.

References SetErrorCode().

◆ GetIsFallback()

bool deLoadableModule::GetIsFallback ( ) const
inline

Determines if this module is a fallback module.

References SetIsFallback().

◆ GetLoggingName()

const decString& deLoadableModule::GetLoggingName ( ) const
inline

Retrieves the name to use as the source for this module for logging.

References SetDefaultLoggingName(), and SetLoggingName().

◆ GetModule()

deBaseModule* deLoadableModule::GetModule ( ) const
inline

Retrieves the module if loaded or NULL.

References IsLoaded(), LoadModule(), SetModule(), and UnloadModule().

◆ GetName()

const decString& deLoadableModule::GetName ( ) const
inline

Retrieves the unique name of the module.

References SetName().

◆ GetPatternList() [1/2]

decStringList& deLoadableModule::GetPatternList ( )
inline

Retrieves the file pattern list recognized by this module if a multiple type module.

◆ GetPatternList() [2/2]

const decStringList& deLoadableModule::GetPatternList ( ) const
inline

◆ GetRefCount()

int deLoadableModule::GetRefCount ( ) const
inline

◆ GetSystem()

deModuleSystem* deLoadableModule::GetSystem ( ) const
inline

Retrieves the linked module system.

◆ GetType()

deModuleSystem::eModuleTypes deLoadableModule::GetType ( ) const
inline

Retrieves the type of the module.

References SetType().

◆ GetVersion()

const decString& deLoadableModule::GetVersion ( ) const
inline

Retrieves the version of the module.

References SetVersion().

◆ IsInternalModule()

virtual bool deLoadableModule::IsInternalModule ( ) const
virtual

Determines if this is an internal module.

Reimplemented in deInternalModule.

Referenced by GetRefCount().

◆ IsLibraryModule()

virtual bool deLoadableModule::IsLibraryModule ( ) const
virtual

Determines if this is a library loaded module.

Reimplemented in deLibraryModule.

Referenced by GetRefCount().

◆ IsLoaded()

bool deLoadableModule::IsLoaded ( ) const

Determines if the module is loaded and working.

Referenced by GetModule().

◆ IsLocked()

bool deLoadableModule::IsLocked ( ) const
inline

Determines if the module is locked.

References Lock(), and Unlock().

◆ LoadModule()

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 deLibraryModule, and deInternalModule.

Referenced by GetModule().

◆ Lock()

virtual void deLoadableModule::Lock ( )
virtual

Locks the module and increases the lock counter.

Referenced by IsLocked().

◆ SetAuthor()

void deLoadableModule::SetAuthor ( const char *  author)

Sets the author of the module.

Referenced by GetAuthor().

◆ SetDefaultExtension()

void deLoadableModule::SetDefaultExtension ( const char *  extension)

Sets the default extension to be used for saving files if this is a multiple type module.

Referenced by GetDefaultExtension().

◆ SetDefaultLoggingName()

void deLoadableModule::SetDefaultLoggingName ( )

Sets the default logging name which is "Module &lt;module-name&gt;".

Referenced by GetLoggingName().

◆ SetDescription()

void deLoadableModule::SetDescription ( const char *  description)

Sets the description of the module.

Referenced by GetDescription().

◆ SetDirectoryName()

void deLoadableModule::SetDirectoryName ( const char *  dirName)

Sets the directory name for this module.

Referenced by GetDirectoryName().

◆ SetEnabled()

void deLoadableModule::SetEnabled ( bool  enabled)

Sets if the module is enabled.

Disabling a module can be used to prevent a higher version module from being automatically selected. This is especially the case with multiple type modules where the launcher does not set the module version to be used explicitely. By default modules are enabled.

Referenced by GetEnabled().

◆ SetErrorCode()

void deLoadableModule::SetErrorCode ( int  code)

Sets the error code.

Referenced by GetErrorCode().

◆ SetIsFallback()

void deLoadableModule::SetIsFallback ( bool  fallback)

Sets if this module is a fallback module.

Referenced by GetIsFallback().

◆ SetLoggingName()

void deLoadableModule::SetLoggingName ( const char *  name)

Sets the name to use as the source for this module for logging.

Referenced by GetLoggingName().

◆ SetModule()

void deLoadableModule::SetModule ( deBaseModule module)

Sets the module if loaded of NULL.

Referenced by GetModule().

◆ SetName()

void deLoadableModule::SetName ( const char *  name)

Sets the unique name of the module.

Referenced by GetName().

◆ SetType()

void deLoadableModule::SetType ( deModuleSystem::eModuleTypes  type)

Sets the type of the module.

Referenced by GetType().

◆ SetVersion()

void deLoadableModule::SetVersion ( const char *  version)

Sets the version of the module.

Referenced by GetVersion().

◆ UnloadModule()

virtual void deLoadableModule::UnloadModule ( )
pure virtual

Unloads the module. Sets the module to NULL and clears the error code.

Implemented in deLibraryModule, and deInternalModule.

Referenced by GetModule().

◆ Unlock()

virtual void deLoadableModule::Unlock ( )
virtual

Decreases the lock counter and unlocks the module if the counter reaches 0.

Referenced by IsLocked().

◆ Visit()

virtual void deLoadableModule::Visit ( deLoadableModuleVisitor visitor)
virtual

Visits the rule.

Reimplemented in deLibraryModule, and deInternalModule.

Referenced by GetRefCount().


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