KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ALLEGRO::BRD_DB Class Reference

An Allegro board database representing the contents of a .brd (and presumably .dra) file. More...

#include <allegro_db.h>

Public Member Functions

 BRD_DB ()
 
void AddString (uint32_t aKey, wxString &&aStr)
 
size_t GetObjectCount () const
 
bool IsSentinel (uint32_t aKey) const
 
void AddSentinelKey (uint32_t aKey)
 
void InsertBlock (std::unique_ptr< BLOCK_BASE > aBlock)
 
void ReserveCapacity (size_t aObjectCount, size_t aStringCount)
 Pre-allocate storage for the expected number of objects and strings.
 
bool ResolveAndValidate ()
 Populate sentinel keys from the file header linked lists.
 
const BLOCK_BASEGetObjectByKey (uint32_t aKey) const
 Get a block by its key.
 
const wxString & GetString (uint32_t aKey) const
 Get a string from the string table by key.
 

Public Attributes

FMT_VER m_FmtVer
 
std::unique_ptr< FILE_HEADERm_Header
 
std::vector< std::unique_ptr< BLOCK_BASE > > m_Blocks
 
std::unordered_map< uint32_t, BLOCK_BASE * > m_ObjectKeyMap
 
std::unordered_map< uint32_t, wxString > m_StringTable
 

Private Attributes

std::unordered_set< uint32_t > m_SentinelKeys
 

Detailed Description

An Allegro board database representing the contents of a .brd (and presumably .dra) file.

Owns all parsed blocks, the string table, sentinel keys, file header, and the key-to-block lookup map.

Definition at line 46 of file allegro_db.h.

Constructor & Destructor Documentation

◆ BRD_DB()

BRD_DB::BRD_DB ( )

Definition at line 101 of file allegro_db.cpp.

References m_FmtVer, and ALLEGRO::V_UNKNOWN.

Member Function Documentation

◆ AddSentinelKey()

void ALLEGRO::BRD_DB::AddSentinelKey ( uint32_t aKey)
inline

Definition at line 63 of file allegro_db.h.

References m_SentinelKeys.

Referenced by collectSentinelKeys().

◆ AddString()

void ALLEGRO::BRD_DB::AddString ( uint32_t aKey,
wxString && aStr )
inline

Definition at line 51 of file allegro_db.h.

References m_StringTable.

Referenced by ReadStringMap().

◆ GetObjectByKey()

const BLOCK_BASE * ALLEGRO::BRD_DB::GetObjectByKey ( uint32_t aKey) const
inline

Get a block by its key.

Definition at line 85 of file allegro_db.h.

References m_ObjectKeyMap.

◆ GetObjectCount()

size_t ALLEGRO::BRD_DB::GetObjectCount ( ) const
inline

Definition at line 56 of file allegro_db.h.

References m_Blocks.

Referenced by ALLEGRO::PARSER::readObjects().

◆ GetString()

const wxString & ALLEGRO::BRD_DB::GetString ( uint32_t aKey) const
inline

Get a string from the string table by key.

Definition at line 94 of file allegro_db.h.

References empty(), and m_StringTable.

◆ InsertBlock()

void BRD_DB::InsertBlock ( std::unique_ptr< BLOCK_BASE > aBlock)

Definition at line 50 of file allegro_db.cpp.

References m_Blocks, and m_ObjectKeyMap.

Referenced by ALLEGRO::PARSER::readObjects().

◆ IsSentinel()

bool ALLEGRO::BRD_DB::IsSentinel ( uint32_t aKey) const
inline

Definition at line 58 of file allegro_db.h.

References m_SentinelKeys.

◆ ReserveCapacity()

void BRD_DB::ReserveCapacity ( size_t aObjectCount,
size_t aStringCount )

Pre-allocate storage for the expected number of objects and strings.

Avoids incremental rehashing as elements are inserted.

Definition at line 37 of file allegro_db.cpp.

References m_Blocks, m_ObjectKeyMap, and m_StringTable.

◆ ResolveAndValidate()

bool BRD_DB::ResolveAndValidate ( )

Populate sentinel keys from the file header linked lists.

Definition at line 107 of file allegro_db.cpp.

References collectSentinelKeys(), m_FmtVer, m_Header, and ALLEGRO::V_180.

Member Data Documentation

◆ m_Blocks

std::vector<std::unique_ptr<BLOCK_BASE> > ALLEGRO::BRD_DB::m_Blocks

Definition at line 104 of file allegro_db.h.

Referenced by GetObjectCount(), InsertBlock(), and ReserveCapacity().

◆ m_FmtVer

FMT_VER ALLEGRO::BRD_DB::m_FmtVer

Definition at line 101 of file allegro_db.h.

Referenced by BRD_DB(), ALLEGRO::PARSER::readObjects(), and ResolveAndValidate().

◆ m_Header

std::unique_ptr<FILE_HEADER> ALLEGRO::BRD_DB::m_Header

Definition at line 102 of file allegro_db.h.

Referenced by ALLEGRO::PARSER::readObjects(), ResolveAndValidate(), and ScanForLayers().

◆ m_ObjectKeyMap

std::unordered_map<uint32_t, BLOCK_BASE*> ALLEGRO::BRD_DB::m_ObjectKeyMap

Definition at line 105 of file allegro_db.h.

Referenced by GetObjectByKey(), InsertBlock(), and ReserveCapacity().

◆ m_SentinelKeys

std::unordered_set<uint32_t> ALLEGRO::BRD_DB::m_SentinelKeys
private

Definition at line 110 of file allegro_db.h.

Referenced by AddSentinelKey(), and IsSentinel().

◆ m_StringTable

std::unordered_map<uint32_t, wxString> ALLEGRO::BRD_DB::m_StringTable

Definition at line 106 of file allegro_db.h.

Referenced by AddString(), GetString(), and ReserveCapacity().


The documentation for this class was generated from the following files: