|
KiCad PCB EDA Suite
|
An ALLEGRO::DB is the represention of the actual data stored within an Allegro file, without specific reference to the format on disk. More...
#include <allegro_db.h>
Public Member Functions | |
| DB () | |
| ~DB () | |
| void | AddObject (std::unique_ptr< DB_OBJ > aObject) |
| void | AddString (uint32_t aKey, wxString &&aStr) |
| size_t | GetObjectCount () const |
| void | ResolveObjectLinks () |
| Iterate the database and resolve links. | |
| DB_OBJ * | Resolve (uint32_t aRef) const override |
| Implement the object resolver interface. | |
| const wxString * | ResolveString (uint32_t aRef) const override |
| bool | IsSentinel (uint32_t aKey) const override |
| In v18+ files, linked list sentinel nodes are real blocks with small keys. | |
| void | AddSentinelKey (uint32_t aKey) |
| virtual void | InsertBlock (std::unique_ptr< BLOCK_BASE > aBlock)=0 |
Public Attributes | |
| std::unordered_map< uint32_t, wxString > | m_StringTable |
Protected Member Functions | |
| void | visitLinkedList (const FILE_HEADER::LINKED_LIST aLList, std::function< const DB_REF &(const DB_OBJ &aObj)> aVisitor) const |
| void | reserveObjects (size_t aCount) |
| void | ResolveObjectLinksBestEffort () |
| Resolve all DB_OBJ references without throwing on failure. | |
Private Attributes | |
| std::unordered_map< uint32_t, std::unique_ptr< DB_OBJ > > | m_Objects |
| std::unordered_set< uint32_t > | m_SentinelKeys |
An ALLEGRO::DB is the represention of the actual data stored within an Allegro file, without specific reference to the format on disk.
Mostly, this DB handles objects in lists.
Definition at line 248 of file allegro_db.h.
| DB::DB | ( | ) |
Definition at line 448 of file allegro_db.cpp.
| DB::~DB | ( | ) |
Definition at line 453 of file allegro_db.cpp.
| void DB::AddObject | ( | std::unique_ptr< DB_OBJ > | aObject | ) |
Definition at line 458 of file allegro_db.cpp.
References m_Objects.
Referenced by ALLEGRO::BRD_DB::InsertBlock().
|
inline |
Definition at line 285 of file allegro_db.h.
References m_SentinelKeys.
Referenced by collectSentinelKeys().
|
inline |
Definition at line 257 of file allegro_db.h.
References m_StringTable.
Referenced by ReadStringMap().
|
inline |
Definition at line 259 of file allegro_db.h.
References m_Objects.
Referenced by ALLEGRO::PARSER::readObjects().
|
pure virtual |
Implemented in ALLEGRO::BRD_DB.
|
inlineoverridevirtual |
In v18+ files, linked list sentinel nodes are real blocks with small keys.
References pointing to these sentinels are logically null (end-of-chain).
Reimplemented from ALLEGRO::DB_OBJ_RESOLVER.
Definition at line 280 of file allegro_db.h.
References m_SentinelKeys.
Referenced by visitLinkedList().
|
inlineprotected |
Definition at line 297 of file allegro_db.h.
References m_Objects.
Referenced by ALLEGRO::BRD_DB::ReserveCapacity().
|
overridevirtual |
Implement the object resolver interface.
Implements ALLEGRO::DB_OBJ_RESOLVER.
Definition at line 464 of file allegro_db.cpp.
References m_Objects.
Referenced by visitLinkedList().
| void DB::ResolveObjectLinks | ( | ) |
Iterate the database and resolve links.
This has to be done after all the objects are read, as they are not necessarily read in order.
This is done once per DB after loading. We can just resolve everything on-demand (with or without caching), but resolving upfront means we can detect bad references earlier which is useful when the DB data is not fully known.
Definition at line 487 of file allegro_db.cpp.
References m_Objects, and THROW_IO_ERROR.
Referenced by ALLEGRO::BRD_DB::ResolveAndValidate().
|
protected |
Resolve all DB_OBJ references without throwing on failure.
Objects that can't fully resolve are marked invalid but processing continues.
Definition at line 503 of file allegro_db.cpp.
References m_Objects.
Referenced by ALLEGRO::BRD_DB::ResolveAndValidate().
|
overridevirtual |
Implements ALLEGRO::DB_OBJ_RESOLVER.
Definition at line 475 of file allegro_db.cpp.
References m_StringTable.
|
protected |
Definition at line 510 of file allegro_db.cpp.
References IsSentinel(), ALLEGRO::FILE_HEADER::LINKED_LIST::m_Head, ALLEGRO::FILE_HEADER::LINKED_LIST::m_Tail, ALLEGRO::DB_REF::m_Target, ALLEGRO::DB_REF::m_TargetKey, Resolve(), and THROW_IO_ERROR.
Referenced by ALLEGRO::BRD_DB::VisitComponents(), ALLEGRO::BRD_DB::VisitFootprintDefs(), and ALLEGRO::BRD_DB::VisitNets().
|
private |
Definition at line 307 of file allegro_db.h.
Referenced by AddObject(), GetObjectCount(), reserveObjects(), Resolve(), ResolveObjectLinks(), and ResolveObjectLinksBestEffort().
|
private |
Definition at line 310 of file allegro_db.h.
Referenced by AddSentinelKey(), and IsSentinel().
| std::unordered_map<uint32_t, wxString> ALLEGRO::DB::m_StringTable |
Definition at line 313 of file allegro_db.h.
Referenced by AddString(), ALLEGRO::BRD_DB::GetString(), ALLEGRO::BRD_DB::ReserveCapacity(), and ResolveString().