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
 
void InsertBlock (std::unique_ptr< BLOCK_BASE > aBlock)
 
void ReserveCapacity (size_t aObjectCount, size_t aStringCount, size_t aFileSize)
 Pre-allocate storage for the expected number of objects and strings.
 
const BLOCK_BASE * GetObjectByKey (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_HEADER > m_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
 

Detailed Description

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

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

Definition at line 41 of file allegro_db.h.

Constructor & Destructor Documentation

◆ BRD_DB()

BRD_DB::BRD_DB ( )

Definition at line 55 of file allegro_db.cpp.

References m_FmtVer, and ALLEGRO::V_UNKNOWN.

Member Function Documentation

◆ AddString()

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

Definition at line 46 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 68 of file allegro_db.h.

References m_ObjectKeyMap.

◆ GetObjectCount()

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

Definition at line 51 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 77 of file allegro_db.h.

References empty(), and m_StringTable.

◆ InsertBlock()

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

Definition at line 46 of file allegro_db.cpp.

References m_Blocks, and m_ObjectKeyMap.

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

◆ ReserveCapacity()

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

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

Avoids incremental rehashing as elements are inserted.

Parameters
aObjectCount
aStringCount
aFileSizesize of the source file, used to bound the header's claimed counts.

Definition at line 30 of file allegro_db.cpp.

References m_Blocks, m_ObjectKeyMap, and m_StringTable.

Member Data Documentation

◆ m_Blocks

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

Definition at line 87 of file allegro_db.h.

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

◆ m_FmtVer

FMT_VER ALLEGRO::BRD_DB::m_FmtVer

Definition at line 84 of file allegro_db.h.

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

◆ m_Header

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

Definition at line 85 of file allegro_db.h.

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

◆ m_ObjectKeyMap

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

Definition at line 88 of file allegro_db.h.

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

◆ m_StringTable

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

Definition at line 89 of file allegro_db.h.

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


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