this class is a high level wrapper for a hashmap that contains decomp::symbol_t values. the symbol values are references by a hashcode.
More...
#include <symbol_table.hpp>
this class is a high level wrapper for a hashmap that contains decomp::symbol_t values. the symbol values are references by a hashcode.
◆ symbol_table_t() [1/2]
theo::recomp::symbol_table_t::symbol_table_t |
( |
| ) |
|
|
inline |
default constructor. does nothing.
◆ symbol_table_t() [2/2]
theo::recomp::symbol_table_t::symbol_table_t |
( |
const std::vector< decomp::symbol_t > && |
syms | ) |
|
this constructor will populate the m_table private field with symbols.
- Parameters
-
35 std::for_each(syms.begin(), syms.end(), [&](decomp::symbol_t sym) {
36 m_table.insert({sym.hash(), sym});
◆ for_each()
void theo::recomp::symbol_table_t::for_each |
( |
std::function< void(decomp::symbol_t &sym)> |
fn | ) |
|
this function is a wrapper function that allows you to get at each entry in the symbol table by reference.
- Parameters
-
fn | a callback function that will be called for each symbol |
50 for (
auto itr = m_table.begin(); itr != m_table.end(); ++itr)
◆ put_symbol()
add symbol to m_table
- Parameters
-
41 m_table.insert({sym.hash(), sym});
◆ put_symbols()
void theo::recomp::symbol_table_t::put_symbols |
( |
std::vector< decomp::symbol_t > & |
syms | ) |
|
add a vector of symbol to m_table
- Parameters
-
45 std::for_each(syms.begin(), syms.end(),
46 [&](decomp::symbol_t sym) { put_symbol(sym); });
◆ size()
std::uint32_t theo::recomp::symbol_table_t::size |
( |
| ) |
|
returns the size of the symbol table.
- Returns
- returns the size of the symbol table.
73 return m_table.size();
◆ sym_from_alloc()
std::optional< decomp::symbol_t * > theo::recomp::symbol_table_t::sym_from_alloc |
( |
std::uintptr_t |
allocated_at | ) |
|
returns an optional pointer to a symbol given its allocation location.
- Parameters
-
allocated_at | the address where the symbol is allocated at. |
- Returns
- returns an optional pointer to a theo::decomp::symbol_t
63 std::find_if(m_table.begin(), m_table.end(),
64 [&](std::pair<const std::size_t, decomp::symbol_t> itr) {
65 return itr.second.allocated_at() == allocated_at;
68 return res != m_table.end() ? &res->second
69 : std::optional<decomp::symbol_t*>{};
◆ sym_from_hash()
std::optional< decomp::symbol_t * > theo::recomp::symbol_table_t::sym_from_hash |
( |
std::size_t |
hash | ) |
|
returns an optional pointer to a symbol from the symbol table given the symbols hash (hash of its name) the hash is produced by theo::decomp::symbol_t::hash
- Parameters
-
hash | hashcode of the symbol to get from the symbol table... |
- Returns
- returns an optional pointer to a theo::decomp::symbol_t
56 return m_table.count(hash) ? &m_table.at(hash)
57 : std::optional<decomp::symbol_t*>{};
The documentation for this class was generated from the following files: