You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Theodosius/include/recomp/symbol_table.hpp

31 lines
829 B

#pragma once
#include <algorithm>
#include <functional>
#include <map>
#include <vector>
#include <optional>
#include <decomp/symbol.hpp>
namespace theo::recomp {
class symbol_table_t {
public:
symbol_table_t() {}
symbol_table_t(const std::vector<decomp::symbol_t>&& syms);
void add_symbol(decomp::symbol_t& sym);
void add_symbols(std::vector<decomp::symbol_t>& syms);
std::optional<decomp::symbol_t*> sym_from_hash(std::size_t hash);
std::optional<decomp::symbol_t*> sym_from_alloc(std::uintptr_t allocated_at);
void update(std::size_t hash, decomp::symbol_t& sym);
void update(std::size_t hash, std::uintptr_t allocated_at);
void for_each(std::function<void(decomp::symbol_t& sym)> fn);
std::uint32_t size();
private:
std::map<std::size_t, decomp::symbol_t> m_table;
};
} // namespace theo::comp