wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
table_core.hpp File Reference

TableCore + TableBase — the non-templated heart of every client-database table, and the ONE welded supertype whose methods every generated table class inherits. More...

#include <cstddef>
#include <cstdint>
#include <optional>
#include <span>
#include <string_view>
#include <vector>
#include <welder/vocabulary.hpp>
#include <wowlib/core/buffer.hpp>
#include <wowlib/core/error.hpp>
#include <wowlib/core/file_key.hpp>
#include <wowlib/db/codec.hpp>
#include <wowlib/db/record_bridge.hpp>
#include <wowlib/formats/common/string_block.hpp>
#include <wowlib/formats/common/validation.hpp>
Include dependency graph for table_core.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  wowlib::db::TableCore
 The erased engine of one table: identity + records access + preserved decode state, with every operation's body compiled once. More...
class  wowlib::db::TableBase
 The welded supertype of every generated table class: the whole table surface — decode, encode, validation, the preserved-state getters — bound ONCE and inherited, in every language, by all ~4200 generated (table x era) classes. More...

Namespaces

namespace  wowlib
namespace  wowlib::fs
namespace  wowlib::db

Detailed Description

TableCore + TableBase — the non-templated heart of every client-database table, and the ONE welded supertype whose methods every generated table class inherits.

Table<Record>'s method bodies were Record-independent glue the moment the record bridge was erased (record_bridge.hpp): magic sniffing, codec dispatch, the fresh-format ladder, validation — all of it works through TableInfo (runtime schema) and the erased sink/source. Instantiating that glue per generated (table x era) class — and, worse, BINDING it per class (ten Python method wrappers times ~4200 classes was the single largest bucket of the binding shards) — bought nothing. So the bodies live in TableCore, compiled once (table_core.cpp), and the welded methods live on TableBase, bound once; a generated table class derives its family base (which derives TableBase), wires the core at construction with its typed records vector + RecordOps, and inherits the whole surface in every bound language.

Wiring and copies: the core holds POINTERS to the owning class's records vector, so the owning class's copy/move constructors must re-wire (rewire()) after copying — dbdgen emits those four members per table; Table<Record> (the hand-written-record facade, table.hpp) does the same in one place. An UNWIRED core (a TableBase constructed bare from a binding) fails every operation with InvalidEntityState instead of dereferencing null.

Definition in file table_core.hpp.