8 size_t PointerMap::add_raw(
const void *ptr,
const char *name) {
9 auto it = map.find(ptr);
10 if (it != map.end()) {
11 if (enable_exceptions) {
12 std::ostringstream ss{};
13 ss <<
"Duplicate node of type " << name;
14 ss <<
"at address " << std::hex << ptr <<
" found in tree";
15 throw NotWellFormed(ss.str());
20 size_t sequence = map.size();
21 map.emplace(ptr, sequence);
29 size_t PointerMap::get_raw(
const void *ptr,
const char *name)
const {
30 auto it = map.find(ptr);
31 if (it == map.end()) {
32 if (enable_exceptions) {
33 std::ostringstream ss{};
34 ss <<
"Link to node of type " << name;
35 ss <<
" at address " << std::hex << ptr <<
" not found in tree";
36 throw NotWellFormed(ss.str());
47 void IdentifierMap::register_node(
size_t identifier,
const std::shared_ptr<void> &ptr) {
48 nodes.emplace(identifier, ptr);
54 void IdentifierMap::register_link(LinkBase &link,
size_t identifier) {
55 links.emplace_back(link, identifier);
61 void IdentifierMap::restore_links()
const {
62 for (
auto &it : links) {
63 it.first.set_void_ptr(nodes.at(it.second));
73 void Completable::find_reachable(PointerMap &map)
const {
87 void Completable::check_complete(
const PointerMap &map)
const {
101 void Completable::check_well_formed()
const {
116 bool Completable::is_well_formed()
const {
120 }
catch (NotWellFormed &) {