Drag[en]gine Game Engine  1.21
deModuleSystem Class Reference

Module System. More...

#include <deModuleSystem.h>

Public Types

enum  eModuleTypes {
  emtUnknown , emtGraphic , emtAudio , emtInput ,
  emtNetwork , emtPhysics , emtImage , emtVideo ,
  emtScript , emtModel , emtRig , emtSkin ,
  emtAnimation , emtFont , emtCrashRecovery , emtLanguagePack ,
  emtAnimator , emtSound , emtAI , emtOcclusionMesh ,
  emtSynthesizer , emtArchive , emtVR
}
 Module Types. More...
 

Public Member Functions

Constructors and Destructors
 deModuleSystem (deEngine *engine)
 Create new module system linked to the given engine. More...
 
 ~deModuleSystem ()
 Clean up module system. More...
 
Management
deEngineGetEngine () const
 Linked game engine. More...
 
void DetectModules ()
 Scans the module directory for modules and loads them if possible. More...
 
Module Management
int GetModuleCount () const
 Count of modules. More...
 
int GetModuleCountFor (eModuleTypes type) const
 Count of modules of a given type. More...
 
int GetLoadedModuleCountFor (eModuleTypes type) const
 Count of loaded modules of a given type. More...
 
deLoadableModuleGetModuleAt (int index) const
 Module at the given index. More...
 
deLoadableModuleGetModuleNamed (const char *name) const
 Highest version module with the given name or NULL if not found. More...
 
deLoadableModuleGetModuleNamed (const char *name, const char *version) const
 Module with the given name and version or NULL if not found. More...
 
deLoadableModuleGetModuleNamedAtLeast (const char *name, const char *version) const
 Module with the given name and at least version or NULL if not found. More...
 
deLoadableModuleGetFirstLoadedModuleFor (eModuleTypes type) const
 First loaded module for the given type or NULL if not found. More...
 
deLoadableModuleFindMatching (eModuleTypes type, const char *filename) const
 First module of the given type able to handle the given file. More...
 
deBaseModuleGetModuleAbleToLoad (eModuleTypes type, const char *filename) const
 First modules of the given type able to handle the given file. More...
 
void AddModule (deLoadableModule *module)
 

Helper Functions

bool MatchesPattern (const char *filename, const char *pattern) const
 Filename matches the given pattern. More...
 
bool StrEqual (const char *str1, const char *str2, int length) const
 Determines if two strings are equal in a non-case sensitive comparisson. More...
 
static int CompareVersion (const char *version1, const char *version2)
 Compare two module versions. More...
 
static eModuleTypes GetTypeFromString (const char *typeString)
 
static const char * GetTypeDirectory (eModuleTypes type)
 Retrieves directory name for a given type. More...
 
static bool IsSingleType (eModuleTypes 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.

Member Enumeration Documentation

◆ eModuleTypes

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.

emtOcclusionMesh 

Occlusion mesh module.

emtSynthesizer 

Synthesizer module.

emtArchive 

Archive module.

emtVR 

VR system module.

Version
1.6

Constructor & Destructor Documentation

◆ deModuleSystem()

deModuleSystem::deModuleSystem ( deEngine engine)

Create new module system linked to the given engine.

◆ ~deModuleSystem()

deModuleSystem::~deModuleSystem ( )

Clean up module system.

Member Function Documentation

◆ AddModule()

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.

◆ CompareVersion()

static int deModuleSystem::CompareVersion ( const char *  version1,
const char *  version2 
)
static

Compare two module versions.

The version strings have to consist of dot separated entries. The result is 0 if both strings are the same, -1 if the first differing version string part of the first version is less than the second or 1 otherwise.

◆ DetectModules()

void deModuleSystem::DetectModules ( )

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

◆ FindMatching()

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

First module 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. If multiple versions of the same module exist the module with the highest version is returned.

◆ GetEngine()

deEngine* deModuleSystem::GetEngine ( ) const
inline

Linked game engine.

◆ GetFirstLoadedModuleFor()

deLoadableModule* deModuleSystem::GetFirstLoadedModuleFor ( eModuleTypes  type) const

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

◆ GetLoadedModuleCountFor()

int deModuleSystem::GetLoadedModuleCountFor ( eModuleTypes  type) const

Count of loaded modules of a given type.

◆ GetModuleAbleToLoad()

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

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. If multiple versions of the same module exist the module with the highest version is returned.

◆ GetModuleAt()

deLoadableModule* deModuleSystem::GetModuleAt ( int  index) const

Module at the given index.

◆ GetModuleCount()

int deModuleSystem::GetModuleCount ( ) const

Count of modules.

◆ GetModuleCountFor()

int deModuleSystem::GetModuleCountFor ( eModuleTypes  type) const

Count of modules of a given type.

◆ GetModuleNamed() [1/2]

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

Highest version module with the given name or NULL if not found.

◆ GetModuleNamed() [2/2]

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

Module with the given name and version or NULL if not found.

◆ GetModuleNamedAtLeast()

deLoadableModule* deModuleSystem::GetModuleNamedAtLeast ( const char *  name,
const char *  version 
) const

Module with the given name and at least version or NULL if not found.

◆ GetTypeDirectory()

static const char* deModuleSystem::GetTypeDirectory ( eModuleTypes  type)
static

Retrieves directory name for a given type.

◆ GetTypeFromString()

static eModuleTypes 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
  • "OcclusionMesh" returns emtOcclusionMesh
  • "Synthesizer" returns emtSynthesizer
  • "Archive" returns emtArchive
  • "VR" returns emtVR

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

◆ IsSingleType()

static bool deModuleSystem::IsSingleType ( eModuleTypes  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
  • emtSynthesizer
  • emtVR

All others are multiple type.

◆ MatchesPattern()

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

Filename matches the given pattern.

◆ StrEqual()

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: