Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
FunctionLexicon Class Reference

#include <FunctionLexicon.h>

Inherits SubsystemInterface.

Inherited by W3DFunctionLexicon.

Classes

struct  TableEntry
 

Public Types

enum  TableIndex {
  TABLE_ANY = -1 , TABLE_GAME_WIN_SYSTEM = 0 , TABLE_GAME_WIN_INPUT , TABLE_GAME_WIN_TOOLTIP ,
  TABLE_GAME_WIN_DEVICEDRAW , TABLE_GAME_WIN_DRAW , TABLE_WIN_LAYOUT_INIT , TABLE_WIN_LAYOUT_DEVICEINIT ,
  TABLE_WIN_LAYOUT_UPDATE , TABLE_WIN_LAYOUT_SHUTDOWN , MAX_FUNCTION_TABLES
}
 

Public Member Functions

 FunctionLexicon (void)
 
virtual ~FunctionLexicon (void)
 
virtual void init (void)
 
virtual void reset (void)
 
virtual void update (void)
 
Bool validate (void)
 validate the tables and make sure all entries are unique
 
TableEntrygetTable (TableIndex index)
 get internal function table
 
GameWinSystemFunc gameWinSystemFunc (NameKeyType key, TableIndex=TABLE_GAME_WIN_SYSTEM)
 
GameWinInputFunc gameWinInputFunc (NameKeyType key, TableIndex=TABLE_GAME_WIN_INPUT)
 
GameWinTooltipFunc gameWinTooltipFunc (NameKeyType key, TableIndex=TABLE_GAME_WIN_TOOLTIP)
 
GameWinDrawFunc gameWinDrawFunc (NameKeyType key, TableIndex=TABLE_ANY)
 
WindowLayoutInitFunc winLayoutInitFunc (NameKeyType key, TableIndex=TABLE_ANY)
 
WindowLayoutUpdateFunc winLayoutUpdateFunc (NameKeyType key, TableIndex=TABLE_WIN_LAYOUT_UPDATE)
 
WindowLayoutShutdownFunc winLayoutShutdownFunc (NameKeyType key, TableIndex=TABLE_WIN_LAYOUT_SHUTDOWN)
 
- Public Member Functions inherited from SubsystemInterface
 SubsystemInterface ()
 
virtual ~SubsystemInterface ()
 
virtual void postProcessLoad ()
 
virtual void draw (void)
 
void UPDATE (void)
 
void DRAW (void)
 
AsciiString getName (void)
 
void setName (AsciiString name)
 

Protected Member Functions

void loadTable (TableEntry *table, TableIndex tableIndex)
 load a lookup table with run time values needed and save in table list
 
void * findFunction (NameKeyType key, TableIndex index)
 
void * keyToFunc (NameKeyType key, TableEntry *table)
 internal searching
 

Protected Attributes

TableEntrym_tables [MAX_FUNCTION_TABLES]
 the lookup tables
 
- Protected Attributes inherited from SubsystemInterface
AsciiString m_name
 

Detailed Description

Collection of function pointers to help us in managing callbacks

Definition at line 45 of file FunctionLexicon.h.

Member Enumeration Documentation

◆ TableIndex

Enumerator
TABLE_ANY 

use this when searching to search any table

TABLE_GAME_WIN_SYSTEM 
TABLE_GAME_WIN_INPUT 
TABLE_GAME_WIN_TOOLTIP 
TABLE_GAME_WIN_DEVICEDRAW 
TABLE_GAME_WIN_DRAW 
TABLE_WIN_LAYOUT_INIT 
TABLE_WIN_LAYOUT_DEVICEINIT 
TABLE_WIN_LAYOUT_UPDATE 
TABLE_WIN_LAYOUT_SHUTDOWN 
MAX_FUNCTION_TABLES 

Definition at line 57 of file FunctionLexicon.h.

Constructor & Destructor Documentation

◆ FunctionLexicon()

FunctionLexicon::FunctionLexicon ( void )

Definition at line 512 of file FunctionLexicon.cpp.

◆ ~FunctionLexicon()

FunctionLexicon::~FunctionLexicon ( void )
virtual

Definition at line 524 of file FunctionLexicon.cpp.

Member Function Documentation

◆ findFunction()

void * FunctionLexicon::findFunction ( NameKeyType key,
TableIndex index )
protected

given a key find the function, the index parameter can limit the search to a single table or to ANY of the tables

Search tables for the function given this key, if the index parameter is TABLE_ANY, then ALL tables will be searched. Otherwise index refers to only a single table index to be searched

Definition at line 440 of file FunctionLexicon.cpp.

◆ gameWinDrawFunc()

GameWinDrawFunc FunctionLexicon::gameWinDrawFunc ( NameKeyType key,
TableIndex index = TABLE_ANY )

Definition at line 683 of file FunctionLexicon.cpp.

◆ gameWinInputFunc()

GameWinInputFunc FunctionLexicon::gameWinInputFunc ( NameKeyType key,
TableIndex index = TABLE_GAME_WIN_INPUT )
inline

Definition at line 138 of file FunctionLexicon.h.

◆ gameWinSystemFunc()

GameWinSystemFunc FunctionLexicon::gameWinSystemFunc ( NameKeyType key,
TableIndex index = TABLE_GAME_WIN_SYSTEM )
inline

Definition at line 136 of file FunctionLexicon.h.

◆ gameWinTooltipFunc()

GameWinTooltipFunc FunctionLexicon::gameWinTooltipFunc ( NameKeyType key,
TableIndex index = TABLE_GAME_WIN_TOOLTIP )
inline

Definition at line 140 of file FunctionLexicon.h.

◆ getTable()

FunctionLexicon::TableEntry * FunctionLexicon::getTable ( TableIndex index)
inline

get internal function table

Definition at line 133 of file FunctionLexicon.h.

◆ init()

void FunctionLexicon::init ( void )
virtual

Initialize our dictionary of funtion pointers and symbols

Implements SubsystemInterface.

Reimplemented in W3DFunctionLexicon.

Definition at line 532 of file FunctionLexicon.cpp.

◆ keyToFunc()

void * FunctionLexicon::keyToFunc ( NameKeyType key,
TableEntry * table )
protected

internal searching

Search the provided table for a function matching the key

Definition at line 413 of file FunctionLexicon.cpp.

◆ loadTable()

void FunctionLexicon::loadTable ( TableEntry * table,
TableIndex tableIndex )
protected

load a lookup table with run time values needed and save in table list

Since we have a convenient table to organize our callbacks anyway, we'll just use this same storage space to load in any run time components we might want to add to the table, such as generating a key based off the name supplied in the table for faster access

Definition at line 384 of file FunctionLexicon.cpp.

◆ reset()

void FunctionLexicon::reset ( void )
virtual

reset

Implements SubsystemInterface.

Reimplemented in W3DFunctionLexicon.

Definition at line 554 of file FunctionLexicon.cpp.

◆ update()

void FunctionLexicon::update ( void )
virtual

Update

Implements SubsystemInterface.

Reimplemented in W3DFunctionLexicon.

Definition at line 570 of file FunctionLexicon.cpp.

◆ validate()

Bool FunctionLexicon::validate ( void )

validate the tables and make sure all entries are unique

Scan the tables and make sure that each function address is unique. We want to do this to prevent accidental entries of two identical functions and because the compiler will optimize identical functions to the same address (typically in empty functions with no body and the same parameters) which we MUST keep separate for when we add code to them

Definition at line 614 of file FunctionLexicon.cpp.

◆ winLayoutInitFunc()

WindowLayoutInitFunc FunctionLexicon::winLayoutInitFunc ( NameKeyType key,
TableIndex index = TABLE_ANY )

Definition at line 701 of file FunctionLexicon.cpp.

◆ winLayoutShutdownFunc()

WindowLayoutShutdownFunc FunctionLexicon::winLayoutShutdownFunc ( NameKeyType key,
TableIndex index = TABLE_WIN_LAYOUT_SHUTDOWN )
inline

Definition at line 145 of file FunctionLexicon.h.

◆ winLayoutUpdateFunc()

WindowLayoutUpdateFunc FunctionLexicon::winLayoutUpdateFunc ( NameKeyType key,
TableIndex index = TABLE_WIN_LAYOUT_UPDATE )
inline

Definition at line 143 of file FunctionLexicon.h.

Member Data Documentation

◆ m_tables

TableEntry* FunctionLexicon::m_tables[MAX_FUNCTION_TABLES]
protected

the lookup tables

Definition at line 126 of file FunctionLexicon.h.


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