OpenVDB 13.0.0

Loading...
Searching...
No Matches
SymbolTable< T > Struct Template Reference

A symbol table which can be used to represent a single scoped set of a programs variables. This is simply an unordered map of strings to llvm::Values. More...

`#include <openvdb_ax/codegen/SymbolTable.h>`

## Public Types
using | MapType = std::unordered_map<std::string, T>

## Public Member Functions
| SymbolTable ()
| ~SymbolTable ()=default
const T * | get (const std::string &name) const
| Get a Value from this symbol table with the given name mapping. It it does not exist, a nullptr is returned.
bool | exists (const std::string &name) const
| Returns true if a variable exists in this symbol table with the given name.
bool | insert (const std::string &name, const T &value)
| Insert a variable to this symbol table if it does not exist. Returns true if successfully, false if a variable already exists with the given name.
bool | replace (const std::string &name, const T &value)
| Replace a variable in this symbol table. Returns true if the variable previously existed and false if not. In both cases, the variable is inserted.
void | clear ()
| Clear all symbols in this table.
const MapType & | map () const
| Access to the underlying map.

## Detailed Description

template<typename T>
struct openvdb::v13_0::ax::codegen::SymbolTable< T >

A symbol table which can be used to represent a single scoped set of a programs variables. This is simply an unordered map of strings to llvm::Values.

Note
  Consider using llvm's ValueSymbolTable

## Member Typedef Documentation

## ◆ MapType

template<typename T>

using MapType = std::unordered_map<std::string, T>

## Constructor & Destructor Documentation

## ◆ SymbolTable()

template<typename T>

SymbolTable | ( |  | ) |
| inline

## ◆ ~SymbolTable()

template<typename T>

~SymbolTable | ( |  | ) |
| default

## Member Function Documentation

## ◆ clear()

template<typename T>

void clear | ( |  | ) |
| inline

Clear all symbols in this table.

## ◆ exists()

template<typename T>

bool exists | ( | const std::string & | name | ) | const
| inline

Returns true if a variable exists in this symbol table with the given name.

Parameters

  name | The name of the variable

## ◆ get()

template<typename T>

const T * get | ( | const std::string & | name | ) | const
| inline

Get a Value from this symbol table with the given name mapping. It it does not exist, a nullptr is returned.

Parameters

  name | The name of the variable

## ◆ insert()

template<typename T>

bool insert | ( | const std::string & | name,
|  | const T & | value )
| inline

Insert a variable to this symbol table if it does not exist. Returns true if successfully, false if a variable already exists with the given name.

Parameters

  name | The name of the variable
  value | The llvm::Value corresponding to this variable

## ◆ map()

template<typename T>

const MapType & map | ( |  | ) | const
| inline

Access to the underlying map.

## ◆ replace()

template<typename T>

bool replace | ( | const std::string & | name,
|  | const T & | value )
| inline

Replace a variable in this symbol table. Returns true if the variable previously existed and false if not. In both cases, the variable is inserted.

Parameters

  name | The name of the variable
  value | The llvm::Value corresponding to this variable