Public Types

deLoadableModule Class Reference

Loadable Module Support. More...

#include <deLoadableModule.h>

Inheritance diagram for deLoadableModule:
deInternalModule deLibraryModule

List of all members.

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
deModuleSystemGetSystem () const
 Retrieves the linked module system.
const decStringGetLoggingName () 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 &lt;module-name&gt;".
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
deBaseModuleGetModule () 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 deInternalModuleCastToInternalModule ()
 Cast to an internal module.
virtual deLibraryModuleCastToLibraryModule ()
 Cast to a library loaded rule.
Visiting
virtual void Visit (deLoadableModuleVisitor *visitor)
 Visits the rule.

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.

Todo:
Replace the error codes as they are not the same for all possible types of loadable modules.
Author:
Plüss Roland
Version:
1.0
Date:
2008

Member Enumeration Documentation

Error Codes.

Enumerator:
eecSuccess 

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

eecCreateModuleFailed 

Creating module failed.

Reimplemented in deLibraryModule.


Constructor & Destructor Documentation

deLoadableModule::deLoadableModule ( deModuleSystem system )

Creates a new loadable module.

virtual deLoadableModule::~deLoadableModule (  ) [virtual]

Cleans up the loadable module.


Member Function Documentation

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 &lt;module-name&gt;".

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.


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