CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::ShaderCompiler::SymbolTable< SymbolType > Class Template Reference

#include <CeresEngine/Material/ShaderCompiler/SymbolTable.hpp>

Classes

struct  Symbol
 

Public Types

using OnOverrideProc = UniqueFunction< bool(SymbolType &prevSymbol) const >
 
using OnReleaseProc = UniqueFunction< void(const SymbolType &symbol) const >
 
using SearchPredicateProc = UniqueFunction< bool(const SymbolType &symbol) const >
 

Public Member Functions

 SymbolTable ()
 
void openScope ()
 
void closeScope (const OnReleaseProc &releaseProc=nullptr)
 
bool register_ (const String &ident, SymbolType symbol, const OnOverrideProc &overrideProc=nullptr, const bool throwOnFailure=true)
 Registers the specified symbol in the current scope (if the identifier is not empty).
 
SymbolType fetch (const String &ident) const
 
SymbolType fetchFromCurrentScope (const String &ident) const
 
SymbolType find (const SearchPredicateProc &searchPredicate) const
 
String fetchSimilar (const String &ident) const
 
std::size_t getScopeLevel () const
 
bool isInsideGlobalScope () const
 

Private Attributes

Map< String, Stack< Symbol > > mSymTable
 
Vector< Vector< Symbol > > mSymTableAnonymous
 
Stack< Vector< String > > mScopeStack
 Stores all identifiers for the current stack.
 

Member Typedef Documentation

◆ OnOverrideProc

◆ OnReleaseProc

◆ SearchPredicateProc

Constructor & Destructor Documentation

◆ SymbolTable()

Member Function Documentation

◆ closeScope()

Remove all symbols from the table which are in the current scope

Callback for released symbol

Remove symbol from the top most scope level

Remove symbol entry completely if it's reference list is empty

Release all symbols from the anonymous symbol table

Decrease scope level

◆ fetch()

◆ fetchFromCurrentScope()

template<typename SymbolType >
SymbolType CeresEngine::ShaderCompiler::SymbolTable< SymbolType >::fetchFromCurrentScope ( const String ident) const
inline

◆ fetchSimilar()

template<typename SymbolType >
String CeresEngine::ShaderCompiler::SymbolTable< SymbolType >::fetchSimilar ( const String ident) const
inline

Find similar identifiers

Check if the distance is not too large

No similarities found

◆ find()

Search symbol in identifiable symbol ist

Search symbol in anonymous symbol list

◆ getScopeLevel()

template<typename SymbolType >
std::size_t CeresEngine::ShaderCompiler::SymbolTable< SymbolType >::getScopeLevel ( ) const
inline

◆ isInsideGlobalScope()

template<typename SymbolType >
bool CeresEngine::ShaderCompiler::SymbolTable< SymbolType >::isInsideGlobalScope ( ) const
inline

◆ openScope()

◆ register_()

template<typename SymbolType >
bool CeresEngine::ShaderCompiler::SymbolTable< SymbolType >::register_ ( const String ident,
SymbolType  symbol,
const OnOverrideProc overrideProc = nullptr,
const bool  throwOnFailure = true 
)
inline

Registers the specified symbol in the current scope (if the identifier is not empty).

At least one scope must be open before symbols can be registered!

Validate input parameters

Register symbol in anonymous symbol table

Check if identifier was already registered in the current scope

Call override procedure and pass previous symbol entry as reference

Register new identifier

Member Data Documentation

◆ mScopeStack

Stores all identifiers for the current stack.

All these identifiers will be removed from "mSymTable" when a scope will be closed.

◆ mSymTable

◆ mSymTableAnonymous


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