vrq
Public Member Functions | Static Public Member Functions | List of all members
CSymtab< T1 > Class Template Reference

Aux class used to create symbol table scoping. More...

#include <csymtab.h>

Public Member Functions

 CSymtab ()
 Create a symbol table. More...
 
void PopScope ()
 Jump back to parent scope. More...
 
void PushScope ()
 Create a new scope for table. More...
 
void Add (CSymbol *sym, T1 *obj)
 Add a symbol and it's assocated object at the current level. More...
 
T1 * LookupTop (CSymbol *sym)
 Lookup symbol only in current scope. More...
 
T1 * Lookup (CSymbol *sym, int skip=0)
 Lookup symbol in all scopes starting at the current scope. More...
 
void ImportSearchTable (CSymtab< T1 > &table)
 Import all symbols given package. More...
 
void Dump (FILE *f, int recurse)
 Dump all symbols in table to file descriptor. More...
 
template<>
CMacroResolve (CSymbol *sym)
 

Static Public Member Functions

static T1 * Resolve (CSymbol *sym)
 hook for namespaces More...
 

Detailed Description

template<class T1>
class CSymtab< T1 >

Aux class used to create symbol table scoping.

Class for a type safe hierarchical symbol table. Each level of the table represents a different nested scope. Searches a the leaves of the table seach upward to the table root if needed.

Constructor & Destructor Documentation

template<class T1>
CSymtab< T1 >::CSymtab ( )
inline

Create a symbol table.

Member Function Documentation

template<class T1>
void CSymtab< T1 >::Add ( CSymbol sym,
T1 *  obj 
)
inline

Add a symbol and it's assocated object at the current level.

Create a new level if needed.

Parameters
symsymbol to add to table.
objobject to associated with symbol.
template<class T1>
void CSymtab< T1 >::Dump ( FILE *  f,
int  recurse 
)
inline

Dump all symbols in table to file descriptor.

Parameters
ffile descriptor.
recursezero if only current depth should be dumped.
template<class T1>
void CSymtab< T1 >::ImportSearchTable ( CSymtab< T1 > &  table)
inline

Import all symbols given package.

Parameters
symbolsymbol for package name to import
template<class T1>
T1* CSymtab< T1 >::Lookup ( CSymbol sym,
int  skip = 0 
)
inline

Lookup symbol in all scopes starting at the current scope.

Parameters
symsymbol to search for.
skipnumber of levels to skip
Returns
object associated with symbol. NULL if symbol is not found.
template<class T1>
T1* CSymtab< T1 >::LookupTop ( CSymbol sym)
inline

Lookup symbol only in current scope.

Parameters
symsymbol to search for.
Returns
object associated with symbol. NULL if symbol is not found.
template<class T1>
void CSymtab< T1 >::PopScope ( )
inline

Jump back to parent scope.

template<class T1>
void CSymtab< T1 >::PushScope ( )
inline

Create a new scope for table.

template<class T1>
static T1* CSymtab< T1 >::Resolve ( CSymbol sym)
static

hook for namespaces

template<>
CMacro * CSymtab< CMacro >::Resolve ( CSymbol sym)

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