KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pin_map.cpp File Reference
#include <pin_map.h>
#include <json_common.h>
#include <algorithm>
#include <utility>

Go to the source code of this file.

Functions

PIN_MAP MakeLegacyPinMap (const wxString &aName, const std::unordered_map< wxString, std::vector< wxString > > &aAssignments)
 Build a single named PIN_MAP from a legacy symbol-pin to footprint-pad(s) assignment table (the flat form used by the database and HTTP library backends, issue #2282).
 
std::unordered_map< wxString, std::vector< wxString > > ParseLegacyPinAssignments (const nlohmann::json &aArray)
 Parse the legacy flat pin-assignment JSON array (MR !2540 form) into a symbol-pin to footprint-pad(s) table (issue #2282).
 
PIN_MAP_SET ParsePinMapSet (const nlohmann::json &aParent)
 Parse the spec-form named maps from aParent["pin_maps"] into a PIN_MAP_SET (issue #2282).
 
std::vector< ASSOCIATED_FOOTPRINTParseAssociatedFootprints (const nlohmann::json &aParent)
 Parse the spec-form footprint associations from aParent["associated_footprints"] (issue #2282).
 

Function Documentation

◆ MakeLegacyPinMap()

PIN_MAP MakeLegacyPinMap ( const wxString & aName,
const std::unordered_map< wxString, std::vector< wxString > > & aAssignments )

Build a single named PIN_MAP from a legacy symbol-pin to footprint-pad(s) assignment table (the flat form used by the database and HTTP library backends, issue #2282).

A pin assigned to several pads is encoded with the bracketed stacked-pad notation, e.g. { "4" -> { "4", "9" } } becomes the entry "4" -> "[4,9]". Empty assignments are skipped.

Definition at line 151 of file pin_map.cpp.

References PIN_MAP::SetEntry().

Referenced by BOOST_AUTO_TEST_CASE(), SCH_IO_HTTP_LIB::loadSymbolFromPart(), and SCH_IO_DATABASE::loadSymbolFromRow().

◆ ParseAssociatedFootprints()

std::vector< ASSOCIATED_FOOTPRINT > ParseAssociatedFootprints ( const nlohmann::json & aParent)

Parse the spec-form footprint associations from aParent["associated_footprints"] (issue #2282).

Returns an empty list when the key is absent or not an array. Shared by the database and HTTP backends.

Definition at line 254 of file pin_map.cpp.

References ASSOCIATED_FOOTPRINT::m_FootprintLibId, ASSOCIATED_FOOTPRINT::m_MapName, and LIB_ID::Parse().

Referenced by SCH_IO_DATABASE::loadSymbolFromRow(), and HTTP_LIB_CONNECTION::SelectOne().

◆ ParseLegacyPinAssignments()

std::unordered_map< wxString, std::vector< wxString > > ParseLegacyPinAssignments ( const nlohmann::json & aArray)

Parse the legacy flat pin-assignment JSON array (MR !2540 form) into a symbol-pin to footprint-pad(s) table (issue #2282).

Each element carries a "sym" (symbol pin number) and an "fp" pad number or array of pad numbers. Returns an empty table when aArray is not an array. Shared by the database and HTTP backends.

Definition at line 187 of file pin_map.cpp.

References pad.

Referenced by SCH_IO_DATABASE::loadSymbolFromRow(), and HTTP_LIB_CONNECTION::SelectOne().

◆ ParsePinMapSet()

PIN_MAP_SET ParsePinMapSet ( const nlohmann::json & aParent)

Parse the spec-form named maps from aParent["pin_maps"] into a PIN_MAP_SET (issue #2282).

Returns an empty set when the key is absent or not an array. Shared by the database and HTTP backends.

Definition at line 221 of file pin_map.cpp.

References PIN_MAP_SET::AddOrReplace(), and PIN_MAP::SetEntry().

Referenced by SCH_IO_DATABASE::loadSymbolFromRow(), and HTTP_LIB_CONNECTION::SelectOne().