|
KiCad PCB EDA Suite
|
The parsed container of a PADS .pcb file: header, the section directory, and the coordinate system.
More...
#include <pads_sdb.h>
Public Member Functions | |
| PADS_SDB ()=default | |
| PADS_SDB (const PADS_SDB &)=delete | |
| PADS_SDB & | operator= (const PADS_SDB &)=delete |
| void | Load (std::vector< uint8_t > aBytes) |
| Validate the header and footer, parse the section directory, and derive the coordinate origin. | |
| uint16_t | Version () const |
| bool | IsOldFormat () const |
| const std::vector< uint8_t > & | Bytes () const |
| const BINARY_CURSOR & | Cursor () const |
| const SDB_COORDS & | Coords () const |
| size_t | SectionCount () const |
| const SDB_SECTION * | Section (int aIndex) const |
| SDB_RECORD | RecordAt (uint32_t aBase) const |
| A reader positioned at an absolute file offset, for walking a pool or byte region rather than a section's fixed-stride records. | |
Static Public Member Functions | |
| static bool | HasMagic (const std::vector< uint8_t > &aBytes) |
| True if the first two bytes match the PADS binary magic. | |
| static bool | IsSupportedVersion (uint16_t aVersion) |
Private Member Functions | |
| void | parseHeader () |
| void | parseDirectory () |
| void | parsePhysicalFraming () |
| void | verifyFooter () const |
| void | readBoardSetup () |
| int | directoryEntryCount () const |
Private Attributes | |
| std::vector< uint8_t > | m_data |
| BINARY_CURSOR | m_cursor { m_data } |
| uint16_t | m_version = 0 |
| std::vector< SDB_SECTION > | m_sections |
| SDB_COORDS | m_coords |
Static Private Attributes | |
| static constexpr uint8_t | MAGIC0 = 0x00 |
| static constexpr uint8_t | MAGIC1 = 0xFF |
| static constexpr int | HEADER_SIZE = 10 |
| static constexpr int | FOOTER_SIZE = 42 |
| static constexpr int | DIR_ENTRY_SIZE = 16 |
| static constexpr int | VIEW_STATE_RECORD_BYTES = 48 |
| Stride of the section 2 view-state records that precede the board-setup block. | |
The parsed container of a PADS .pcb file: header, the section directory, and the coordinate system.
Owns the file bytes and the bounds-checked read cursor.
Non-copyable because the cursor binds a reference to the owned byte buffer, so a copy would leave the clone's cursor pointing at the source's bytes.
Definition at line 110 of file pads_sdb.h.
|
default |
Referenced by operator=(), and PADS_SDB().
|
delete |
References PADS_SDB().
|
inline |
Definition at line 131 of file pads_sdb.h.
References m_data.
|
inline |
Definition at line 133 of file pads_sdb.h.
References m_coords.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 132 of file pads_sdb.h.
References m_cursor.
|
private |
Definition at line 72 of file pads_sdb.cpp.
References DIR_ENTRY_SIZE, HEADER_SIZE, and m_cursor.
Referenced by parseDirectory().
|
static |
True if the first two bytes match the PADS binary magic.
Definition at line 37 of file pads_sdb.cpp.
References PADS_IO::HasSdbMagic(), and MAGIC1.
Referenced by parseHeader().
|
inline |
Definition at line 130 of file pads_sdb.h.
References m_version.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 43 of file pads_sdb.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), PADS_IO::BINARY_PARSER::IsBinaryPadsFile(), and parseHeader().
| void PADS_IO::PADS_SDB::Load | ( | std::vector< uint8_t > | aBytes | ) |
Validate the header and footer, parse the section directory, and derive the coordinate origin.
Throws IO_ERROR on a malformed or unsupported file.
Definition at line 60 of file pads_sdb.cpp.
References m_data, parseDirectory(), parseHeader(), parsePhysicalFraming(), readBoardSetup(), and verifyFooter().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
References PADS_SDB().
|
private |
Definition at line 99 of file pads_sdb.cpp.
References DIR_ENTRY_SIZE, directoryEntryCount(), HEADER_SIZE, PADS_IO::SDB_SECTION::index, m_cursor, m_data, m_sections, and THROW_IO_ERROR.
Referenced by Load().
|
private |
Definition at line 78 of file pads_sdb.cpp.
References FOOTER_SIZE, HasMagic(), HEADER_SIZE, IsSupportedVersion(), m_cursor, m_data, m_version, and THROW_IO_ERROR.
Referenced by Load().
|
private |
Definition at line 127 of file pads_sdb.cpp.
References PADS_IO::SDB_SECTION::count, cursor, DIR_ENTRY_SIZE, FOOTER_SIZE, index, m_cursor, m_data, m_sections, m_version, PADS_IO::SDB_SECTION::physicalBytes, PADS_IO::SDB_SECTION::physicalCount, PADS_IO::SDB_SECTION::physicalLiveCount, PADS_IO::SDB_SECTION::physicalOffset, THROW_IO_ERROR, and PADS_IO::SDB_SECTION::totalBytes.
Referenced by Load().
|
private |
Definition at line 445 of file pads_sdb.cpp.
References PADS_IO::SDB_SECTION::count, DIR_ENTRY_SIZE, directory, HEADER_SIZE, m_coords, m_cursor, m_data, scale, Section(), THROW_IO_ERROR, and VIEW_STATE_RECORD_BYTES.
Referenced by Load().
|
inline |
A reader positioned at an absolute file offset, for walking a pool or byte region rather than a section's fixed-stride records.
Definition at line 140 of file pads_sdb.h.
References m_cursor.
| const SDB_SECTION * PADS_IO::PADS_SDB::Section | ( | int | aIndex | ) | const |
Definition at line 436 of file pads_sdb.cpp.
References m_sections.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and readBoardSetup().
|
inline |
Definition at line 135 of file pads_sdb.h.
References m_sections.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 93 of file pads_sdb.cpp.
References PADS_IO::FOOTER_GUID, PADS_IO::FOOTER_GUID_LEN, FOOTER_SIZE, m_data, and PADS_IO::ValidateSdbFooter().
Referenced by Load().
|
inline |
Definition at line 129 of file pads_sdb.h.
References m_version.
Referenced by BOOST_AUTO_TEST_CASE().
|
staticconstexprprivate |
Definition at line 154 of file pads_sdb.h.
Referenced by directoryEntryCount(), parseDirectory(), parsePhysicalFraming(), and readBoardSetup().
|
staticconstexprprivate |
Definition at line 153 of file pads_sdb.h.
Referenced by parseHeader(), parsePhysicalFraming(), and verifyFooter().
|
staticconstexprprivate |
Definition at line 152 of file pads_sdb.h.
Referenced by directoryEntryCount(), parseDirectory(), parseHeader(), and readBoardSetup().
|
private |
Definition at line 166 of file pads_sdb.h.
Referenced by Coords(), and readBoardSetup().
|
private |
Definition at line 162 of file pads_sdb.h.
Referenced by Cursor(), directoryEntryCount(), parseDirectory(), parseHeader(), parsePhysicalFraming(), readBoardSetup(), and RecordAt().
|
private |
Definition at line 159 of file pads_sdb.h.
Referenced by Bytes(), Load(), parseDirectory(), parseHeader(), parsePhysicalFraming(), readBoardSetup(), and verifyFooter().
|
private |
Definition at line 165 of file pads_sdb.h.
Referenced by parseDirectory(), parsePhysicalFraming(), Section(), and SectionCount().
|
private |
Definition at line 164 of file pads_sdb.h.
Referenced by IsOldFormat(), parseHeader(), parsePhysicalFraming(), and Version().
|
staticconstexprprivate |
Definition at line 150 of file pads_sdb.h.
|
staticconstexprprivate |
Definition at line 151 of file pads_sdb.h.
Referenced by HasMagic().
|
staticconstexprprivate |
Stride of the section 2 view-state records that precede the board-setup block.
Definition at line 157 of file pads_sdb.h.
Referenced by readBoardSetup().