KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pin_map.h File Reference
#include <kicommon.h>
#include <lib_id.h>
#include <nlohmann/json_fwd.hpp>
#include <unordered_map>
#include <vector>
#include <wx/string.h>

Go to the source code of this file.

Classes

struct  PIN_MAP_ENTRY
 One symbol-pin to footprint-pad mapping inside a PIN_MAP. More...
 
class  PIN_MAP
 A named pin map. More...
 
class  PIN_MAP_SET
 A symbol-owned ordered set of named pin maps. More...
 
struct  ASSOCIATED_FOOTPRINT
 A first-class footprint choice on a LIB_SYMBOL, tied to a named pin map. More...
 
struct  PIN_MAP_INSTANCE_OVERRIDE
 Per-instance override of the active pin map and a sparse delta on top. More...
 

Enumerations

enum class  PIN_MAP_OVERRIDE_MODE { USE_LIBRARY_DEFAULT , USE_NAMED_MAP , FORCE_IDENTITY , DELEGATE_TO_UNIT_1 }
 Override mode stored on a SCH_SYMBOL_INSTANCE. More...
 

Functions

KICOMMON_API 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).
 
KICOMMON_API 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).
 
KICOMMON_API 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).
 
KICOMMON_API std::vector< ASSOCIATED_FOOTPRINTParseAssociatedFootprints (const nlohmann::json &aParent)
 Parse the spec-form footprint associations from aParent["associated_footprints"] (issue #2282).
 

Enumeration Type Documentation

◆ PIN_MAP_OVERRIDE_MODE

enum class PIN_MAP_OVERRIDE_MODE
strong

Override mode stored on a SCH_SYMBOL_INSTANCE.

The mode is the source of truth. m_ActiveMapName is read only when m_Mode == USE_NAMED_MAP; m_Edits are ignored when m_Mode == FORCE_IDENTITY and never apply on a DELEGATE_TO_UNIT_1 instance.

Enumerator
USE_LIBRARY_DEFAULT 
USE_NAMED_MAP 
FORCE_IDENTITY 
DELEGATE_TO_UNIT_1 

Definition at line 176 of file pin_map.h.

Function Documentation

◆ MakeLegacyPinMap()

KICOMMON_API 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()

KICOMMON_API 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()

KICOMMON_API 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()

KICOMMON_API 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().