Public Types

deModuleSystem Class Reference

Module System. More...

#include <deModuleSystem.h>

List of all members.

Public Types

enum  eModuleTypes {
  emtUnknown, emtGraphic, emtAudio, emtInput,
  emtNetwork, emtPhysics, emtImage, emtVideo,
  emtScript, emtModel, emtRig, emtSkin,
  emtAnimation, emtFont, emtCrashRecovery, emtLanguagePack,
  emtAnimator, emtSound, emtAI, EMT_COUNT
}
 

Module Types.

More...

Public Member Functions

Constructors and Destructors
 deModuleSystem (deEngine *engine)
 Creates a new module system linked to the given engine.
 ~deModuleSystem ()
 Cleans up the module system.
Management
deEngineGetEngine () const
 Retrieves the linked game engine.
void DetectModules ()
 Scans the module directory for modules and loads them if possible.
Module Management
int GetModuleCount () const
 Retrieves the count of modules.
int GetModuleCountFor (int type) const
 Retrieves the count of modules of a given type.
int GetLoadedModuleCountFor (int type) const
 Retrieves the count of loaded modules of a given type.
deLoadableModuleGetModuleAt (int index) const
 Retrieves the module at the given index.
deLoadableModuleGetModuleNamed (const char *name) const
 Retrieves the module with the given name or NULL if not found.
deLoadableModuleGetFirstLoadedModuleFor (int type) const
 Retrieves the first loaded module for the given type or NULL if not found.
deLoadableModuleFindMatching (int type, const char *filename) const
 Retrieves the first modules of the given type able to handle the given file.
deBaseModuleGetModuleAbleToLoad (int type, const char *filename) const
 Retrieves the first modules of the given type able to handle the given file.
void AddModule (deLoadableModule *module)
 Adds a module to the system.

Helper Functions

bool MatchesPattern (const char *filename, const char *pattern) const
 Determines if the filename matches the given pattern.
bool StrEqual (const char *str1, const char *str2, int length) const
 Determines if two strings are equal in a non-case sensitive comparisson.
const char * GetTypeDirectory (int type)
 Retrieves directory name for a given type.
static int GetTypeFromString (const char *typeString)
 Retrieves the type from eModuleTypes matching the given type string.
static bool IsSingleType (int type)
 Retrieves if the given type is a single type.

Detailed Description

Module System.

This is a special system and not to be confused with single type or multiple type engine systems. The module system keeps track of all modules existing in the engine no matter if loaded or not. All modules that can be parsed are stored in the module system. If a module can not be loaded it still stays here but is marked as not loaded. This is to allow the engine and frontends to provide a nice view to the user showing what is working and what not. Only loaded modules are used by the engine.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Member Enumeration Documentation

Module Types.

Enumerator:
emtUnknown 

Module type is not known or invalid.

emtGraphic 

Graphic system module.

emtAudio 

Audio system module.

emtInput 

Input system module.

emtNetwork 

Network system module.

emtPhysics 

Physics system module.

emtImage 

Image system module.

emtVideo 

Video system module.

emtScript 

Scripting system module.

emtModel 

Model system module.

emtRig 

Rig system module.

emtSkin 

Skin system module.

emtAnimation 

Animation system module.

emtFont 

Font system module.

emtCrashRecovery 

Crash Recovery system module.

emtLanguagePack 

Language pack system module.

emtAnimator 

Animator system module.

emtSound 

Sound system module.

emtAI 

AI system module.

EMT_COUNT 

Dummy entry defining the number of types.


Constructor & Destructor Documentation

deModuleSystem::deModuleSystem ( deEngine engine )

Creates a new module system linked to the given engine.

deModuleSystem::~deModuleSystem (  )

Cleans up the module system.


Member Function Documentation

void deModuleSystem::AddModule ( deLoadableModule module )

Adds a module to the system.

The module has not to exist already and has to be properly initialized to be accepted.

void deModuleSystem::DetectModules (  )

Scans the module directory for modules and loads them if possible.

deLoadableModule* deModuleSystem::FindMatching ( int  type,
const char *  filename 
) const

Retrieves the first modules of the given type able to handle the given file.

Multiple type modules provide a list of file extensions they can handle. If the extension of the given filename matches one of the entris of a module it is considered able to handle the file.

deEngine* deModuleSystem::GetEngine (  ) const [inline]

Retrieves the linked game engine.

deLoadableModule* deModuleSystem::GetFirstLoadedModuleFor ( int  type ) const

Retrieves the first loaded module for the given type or NULL if not found.

int deModuleSystem::GetLoadedModuleCountFor ( int  type ) const

Retrieves the count of loaded modules of a given type.

deBaseModule* deModuleSystem::GetModuleAbleToLoad ( int  type,
const char *  filename 
) const

Retrieves the first modules of the given type able to handle the given file.

This is the same as the FindMatching function but with the difference that the returned object is the module itself and not the wrapper around the module. This also requires that the module is loaded. In the other function Not loaded modules are matching too whereas here this is not the case.

deLoadableModule* deModuleSystem::GetModuleAt ( int  index ) const

Retrieves the module at the given index.

int deModuleSystem::GetModuleCount (  ) const [inline]

Retrieves the count of modules.

int deModuleSystem::GetModuleCountFor ( int  type ) const

Retrieves the count of modules of a given type.

deLoadableModule* deModuleSystem::GetModuleNamed ( const char *  name ) const

Retrieves the module with the given name or NULL if not found.

const char* deModuleSystem::GetTypeDirectory ( int  type )

Retrieves directory name for a given type.

static int deModuleSystem::GetTypeFromString ( const char *  typeString ) [static]

Retrieves the type from eModuleTypes matching the given type string.

This is used to translate type strings from the XML module definitions into an engine usable type. The following table shows the matchings.

  • "Graphic" returns emtGraphic
  • "Audio" returns emtAudio
  • "Input" returns emtInput
  • "Network" returns emtNetwork
  • "Physics" returns emtPhysics
  • "Image" returns emtImage
  • "Video returns emtVideo - "Script" returns emtScript - "Model" returns emtModel - "Rig" returns emtRig - "Skin" returns emtSkin - "Animation" returns emtAnimation - "Font" returns emtFont - "CrashRecovery" returns emtCrashRecovery - "LanguagePack" returns emtLanguagePack - "Animator" returns emtAnimator - "Sound" returns emtSound - "AI" returns emtAI

In all other cases emtUnknown is returned. Case does not matter.

static bool deModuleSystem::IsSingleType ( int  type ) [static]

Retrieves if the given type is a single type.

The following are single types:

  • emtGraphic
  • emtAudio
  • emtInput
  • emtNetwork
  • emtPhysics
  • emtScript
  • emtAnimator
  • emtAI
  • emtCrashRecovery

All others are multiple type.

bool deModuleSystem::MatchesPattern ( const char *  filename,
const char *  pattern 
) const

Determines if the filename matches the given pattern.

bool deModuleSystem::StrEqual ( const char *  str1,
const char *  str2,
int  length 
) const

Determines if two strings are equal in a non-case sensitive comparisson.


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