MCPcopy Create free account
hub / github.com/DFHack/dfhack / dispatch_class

Method dispatch_class

plugins/devel/check-structures-sanity/dispatch.cpp:578–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576 dispatch_item(field_item, field_cs);
577}
578void Checker::dispatch_class(const QueueItem & item, const CheckedStructure & cs)
579{
580 auto vtable_name = get_vtable_name(item, cs);
581 if (!vtable_name)
582 {
583 // bail out now because virtual_identity::get will crash
584 return;
585 }
586
587 auto base_identity = static_cast<const virtual_identity *>(cs.identity);
588 auto vptr = static_cast<virtual_ptr>(const_cast<void *>(item.ptr));
589 auto identity = virtual_identity::get(vptr);
590 if (!identity)
591 {
592 FAIL("unidentified subclass of " << base_identity->getFullName() << ": " << vtable_name);
593 return;
594 }
595 if (base_identity != identity && !base_identity->is_subclass(identity))
596 {
597 FAIL("expected subclass of " << base_identity->getFullName() << ", but got " << identity->getFullName());
598 return;
599 }
600
601 if (data.count(item.ptr) && data.at(item.ptr).first == item.path)
602 {
603 // TODO: handle cases where this may overlap later data
604 data.at(item.ptr).second.identity = identity;
605 }
606
607 dispatch_struct(QueueItem(item.path + "<" + identity->getFullName() + ">", item.ptr), CheckedStructure(identity));
608}
609void Checker::dispatch_buffer(const QueueItem & item, const CheckedStructure & cs)
610{
611 auto identity = static_cast<const container_identity *>(cs.identity);

Callers

nothing calls this directly

Calls 6

QueueItemClass · 0.85
CheckedStructureClass · 0.85
is_subclassMethod · 0.80
getFunction · 0.50
getFullNameMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected