Drag[en]gine Game Engine  1.0
deBaseModule Class Reference

Base Module Class. More...

#include <deBaseModule.h>

Inheritance diagram for deBaseModule:
deBaseAIModule deBaseAnimationModule deBaseAnimatorModule deBaseAudioModule deBaseCrashRecoveryModule deBaseFontModule deBaseGraphicModule deBaseImageModule deBaseInputModule deBaseLanguagePackModule deBaseModelModule deBaseNetworkModule deBaseOcclusionMeshModule deBasePhysicsModule deBaseRigModule deBaseScriptingModule deBaseSkinModule deBaseSoundModule deBaseSynthesizerModule deBaseVideoModule

Public Member Functions

Constructors and Destructors
 deBaseModule (deLoadableModule &loadableModule)
 Creates a new base module. More...
 
virtual ~deBaseModule ()
 Cleans up the base module. More...
 
Parameters
virtual int GetParameterCount () const
 Retrieves the count of parameters. More...
 
virtual void GetParameterInfo (int index, deModuleParameter *parameter) const
 Retrieves the informations about the given indexec parameter. More...
 
virtual int FindParameter (const char *name) const
 Retrieves the index of the parameter with the given name or -1 if not found. More...
 
virtual float GetParameterValue (int index) const
 Retrieves the value of the parameter at the given index. More...
 
virtual void SetParameterValue (int index, float value)
 Sets the parameter of the parameter at the given index. More...
 
Debugging
virtual void SendCommand (const decUnicodeArgumentList &command, decUnicodeString &answer)
 Sends a command to the module and retrieves an answer from it. More...
 
void LogInfo (const char *message)
 Outputs an information message on the console. More...
 
void LogInfoFormat (const char *message,...)
 Outputs a formated information message on the console. More...
 
void LogInfoFormatUsing (const char *message, va_list args)
 Outputs a formated information message on the console. More...
 
void LogWarn (const char *message)
 Outputs a warning message on the console. More...
 
void LogWarnFormat (const char *message,...)
 Outputs a formated warning message on the console. More...
 
void LogWarnFormatUsing (const char *message, va_list args)
 Outputs a formated warning message on the console. More...
 
void LogError (const char *message)
 Outputs an error message on the console. More...
 
void LogErrorFormat (const char *message,...)
 Outputs a formated error message on the console. More...
 
void LogErrorFormatUsing (const char *message, va_list args)
 Outputs a formated error message on the console. More...
 
void LogException (const deException &exception)
 Outputs an exception as error message on the console. More...
 
Accessors
deEngineGetGameEngine () const
 Retrieves the game engine object. More...
 
deLoadableModuleGetLoadableModule () const
 Retrieves the loadable module. More...
 
deOSGetOS () const
 Retrieves the os object from the game engine. More...
 
deVirtualFileSystemGetVFS () const
 Retrieves the module virtual file system. More...
 
Error Tracing
deErrorTracePointSetErrorTrace (const char *error, const char *sourceFunc, int sourceLine)
 Adds a new trace point and sets the error if the trace is empty. More...
 
deErrorTracePointSetErrorTrace (const deException &exception)
 Adds a new trace point and sets the error if the trace is empty. More...
 
deErrorTracePointAddErrorTracePoint (const char *sourceFunc, int sourceLine)
 Adds a new trace point to the engine error trace with an empty error. More...
 

Detailed Description

Base Module Class.

Modules are the basic building stone of the entire engine. Each system has at least one module providing specilized functionality in the given set of tasks. Each module can be customized with the use of module parameters. Each parameter is a decimal value which can have though different meanings. The parameter information object describes what values are acceptable by a certain parameter. This allows GUI scripts to provide appropriate input widgets to let the user alter the values. Parameters are required to be error safe. If a certain value is not accepted it has to be converted to the nearest feasible one.

Todo:
  • Change the get/set parameter value functions to work with the name of the parameter instead of the index
Author
Pl├╝ss Roland
Version
1.0
Date
2014

Constructor & Destructor Documentation

◆ deBaseModule()

deBaseModule::deBaseModule ( deLoadableModule loadableModule)

Creates a new base module.

◆ ~deBaseModule()

virtual deBaseModule::~deBaseModule ( )
virtual

Cleans up the base module.

Member Function Documentation

◆ AddErrorTracePoint()

deErrorTracePoint* deBaseModule::AddErrorTracePoint ( const char *  sourceFunc,
int  sourceLine 
)

Adds a new trace point to the engine error trace with an empty error.

Parameters
[in]sourceFuncName of the source file where the error occured.
[in]sourceLineThe line number where the error occured.

Referenced by GetVFS().

◆ FindParameter()

virtual int deBaseModule::FindParameter ( const char *  name) const
virtual

Retrieves the index of the parameter with the given name or -1 if not found.

◆ GetGameEngine()

deEngine* deBaseModule::GetGameEngine ( ) const

Retrieves the game engine object.

◆ GetLoadableModule()

deLoadableModule& deBaseModule::GetLoadableModule ( ) const

Retrieves the loadable module.

◆ GetOS()

deOS* deBaseModule::GetOS ( ) const

Retrieves the os object from the game engine.

◆ GetParameterCount()

virtual int deBaseModule::GetParameterCount ( ) const
virtual

Retrieves the count of parameters.

◆ GetParameterInfo()

virtual void deBaseModule::GetParameterInfo ( int  index,
deModuleParameter parameter 
) const
virtual

Retrieves the informations about the given indexec parameter.

Parameters
[in]indexIndex of the parameter
[in]parameterObject to fill with informations about the parameter

◆ GetParameterValue()

virtual float deBaseModule::GetParameterValue ( int  index) const
virtual

Retrieves the value of the parameter at the given index.

◆ GetVFS()

deVirtualFileSystem& deBaseModule::GetVFS ( ) const
inline

Retrieves the module virtual file system.

The following directories are available:

/config
Directory containing module configuration. The directory is writeable. This is an overlayed directory. A writeable version is layered ontop of a read-only version containing the module default files. This allows to directly write to configuration keeping the default configuration intact in case a user needs to look at it.
/share
Directory containing shared module data. This directory is read-only. Place in this directory all data you need for running the module that never changes.
/capture
Directory containing module output data. This directory is writeable. This directory is used to hold debug output of modules that are written to file. Developer can retrieve and later examine this data while the engine not running or not anymore.
/cache/global
Global cache directory for storing cached information related to the operation of the module in general which is not application specific. The stored files are kept across restarting the application. If the disk consumption grows old files are automatically removed without asking first to keep the size limit.
/cache/local
Local cache directory for storing cached information that is application specific. The stored files are kept across restarting the application. If the disk consumption grows old files are automatically removed without asking first to keep the size limit.

References AddErrorTracePoint(), LogError(), LogErrorFormat(), LogErrorFormatUsing(), LogException(), LogInfo(), LogInfoFormat(), LogInfoFormatUsing(), LogWarn(), LogWarnFormat(), LogWarnFormatUsing(), and SetErrorTrace().

◆ LogError()

void deBaseModule::LogError ( const char *  message)

Outputs an error message on the console.

Referenced by GetVFS().

◆ LogErrorFormat()

void deBaseModule::LogErrorFormat ( const char *  message,
  ... 
)

Outputs a formated error message on the console.

Referenced by GetVFS().

◆ LogErrorFormatUsing()

void deBaseModule::LogErrorFormatUsing ( const char *  message,
va_list  args 
)

Outputs a formated error message on the console.

Referenced by GetVFS().

◆ LogException()

void deBaseModule::LogException ( const deException exception)

Outputs an exception as error message on the console.

Referenced by GetVFS().

◆ LogInfo()

void deBaseModule::LogInfo ( const char *  message)

Outputs an information message on the console.

Referenced by GetVFS().

◆ LogInfoFormat()

void deBaseModule::LogInfoFormat ( const char *  message,
  ... 
)

Outputs a formated information message on the console.

Referenced by GetVFS().

◆ LogInfoFormatUsing()

void deBaseModule::LogInfoFormatUsing ( const char *  message,
va_list  args 
)

Outputs a formated information message on the console.

Referenced by GetVFS().

◆ LogWarn()

void deBaseModule::LogWarn ( const char *  message)

Outputs a warning message on the console.

Referenced by GetVFS().

◆ LogWarnFormat()

void deBaseModule::LogWarnFormat ( const char *  message,
  ... 
)

Outputs a formated warning message on the console.

Referenced by GetVFS().

◆ LogWarnFormatUsing()

void deBaseModule::LogWarnFormatUsing ( const char *  message,
va_list  args 
)

Outputs a formated warning message on the console.

Referenced by GetVFS().

◆ SendCommand()

virtual void deBaseModule::SendCommand ( const decUnicodeArgumentList command,
decUnicodeString answer 
)
virtual

Sends a command to the module and retrieves an answer from it.

At least the 'help' command has to be understood answering a list of possible commands. The command is provided in the 'command' parameter and the answer has to be written into 'answer'. The default implementation simply answers only to help with itself.

Parameters
[in]commandThe command to send to the module as a list of arguments.
[out]answerUnicode string to hold the answer returned from the module.

◆ SetErrorTrace() [1/2]

deErrorTracePoint* deBaseModule::SetErrorTrace ( const char *  error,
const char *  sourceFunc,
int  sourceLine 
)

Adds a new trace point and sets the error if the trace is empty.

Parameters
[in]errorShort description of the error preferably of a single line.
[in]sourceFuncName of the source file where the error occured.
[in]sourceLineThe line number where the error occured.
Returns
Created trace point or NULL if an error occured.

Referenced by GetVFS().

◆ SetErrorTrace() [2/2]

deErrorTracePoint* deBaseModule::SetErrorTrace ( const deException exception)

Adds a new trace point and sets the error if the trace is empty.

Parameters
[in]exceptionException to use as source for the error information.
Returns
Created trace point or NULL if an error occured.

◆ SetParameterValue()

virtual void deBaseModule::SetParameterValue ( int  index,
float  value 
)
virtual

Sets the parameter of the parameter at the given index.


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