|
KiCad PCB EDA Suite
|
Materialize a MERGE_PLAN into a merged SCHEMATIC by mutating the ancestor in place. More...
#include <sch_merge_applier.h>
Classes | |
| struct | PathedItem |
| struct | REPORT |
Public Member Functions | |
| SCH_MERGE_APPLIER (SCHEMATIC *aAncestor, const SCHEMATIC *aOurs, const SCHEMATIC *aTheirs, MERGE_PLAN aPlan) | |
| bool | Apply () |
| Apply the plan to the ancestor. | |
| const REPORT & | GetReport () const |
Private Member Functions | |
| std::map< KIID_PATH, PathedItem > | indexSchematic (const SCHEMATIC *aSchematic, std::vector< std::unique_ptr< SCH_SHEET_PATH > > &aStorage) const |
| Walk a schematic into a KIID_PATH-keyed table of (item, sheet_path). | |
| std::size_t | applyPropertyResolutions (SCH_ITEM *aTarget, const std::vector< PROPERTY_RESOLUTION > &aProps, const SCH_ITEM *aOurs, const SCH_ITEM *aTheirs, const SCH_ITEM *aAncestor) |
Private Attributes | |
| SCHEMATIC * | m_ancestor |
| const SCHEMATIC * | m_ours |
| const SCHEMATIC * | m_theirs |
| MERGE_PLAN | m_plan |
| REPORT | m_report |
Materialize a MERGE_PLAN into a merged SCHEMATIC by mutating the ancestor in place.
Schematics are hierarchical: an item lives on one SCH_SCREEN identified by a sheet path. The applier indexes every (KIID_PATH, SCH_ITEM*) tuple in the three input schematics, then for each ITEM_RESOLUTION it either removes from the target, clones an item onto the correct sheet, or applies a property delta against the target item.
Unlike the PCB applier which builds a fresh output BOARD, the SCH applier mutates the ancestor schematic in place. The reason: SCHEMATIC carries hierarchy, project-relative paths, sheet UUIDs, and instance data that cannot be cleanly recomputed from a fresh empty schematic. Working off the ancestor preserves all of that automatically.
Definition at line 56 of file sch_merge_applier.h.
| KICAD_DIFF::SCH_MERGE_APPLIER::SCH_MERGE_APPLIER | ( | SCHEMATIC * | aAncestor, |
| const SCHEMATIC * | aOurs, | ||
| const SCHEMATIC * | aTheirs, | ||
| MERGE_PLAN | aPlan ) |
Definition at line 76 of file sch_merge_applier.cpp.
References m_ancestor, m_ours, m_plan, m_theirs, and move.
| bool KICAD_DIFF::SCH_MERGE_APPLIER::Apply | ( | ) |
Apply the plan to the ancestor.
Returns true on success.
Definition at line 129 of file sch_merge_applier.cpp.
References SCH_SYMBOL::AddHierarchicalReference(), KICAD_DIFF::VALIDATION_INPUT::ancestorSchemaVersion, SCH_SCREEN::Append(), KICAD_DIFF::VALIDATION_INPUT::applierReportedRebuild, applyPropertyResolutions(), EDA_ITEM::Clone(), KICAD_DIFF::DELETE_ITEM, KICAD_DIFF::DOC_PROP_DRAWING_SHEET, KICAD_DIFF::DOC_PROP_ERC_SEVERITIES, KICAD_DIFF::DOC_PROP_PAGE_FORMAT, KICAD_DIFF::DOC_PROP_PAGE_ORIENTATION, SCHEMATIC::ErcSettings(), SCH_SYMBOL::GetInstance(), SCH_SCREEN::GetPageSettings(), SCH_SYMBOL::GetRef(), PAGE_INFO::GetType(), KICAD_DIFF::REFDES_ENTRY::id, indexSchematic(), PAGE_INFO::IsPortrait(), KICAD_DIFF::isSheetItem(), SCHEMATIC::IsValid(), SCH_SCREEN::Items(), KICAD_DIFF::KEEP, KICAD_DIFF::PROPERTY_RESOLUTION::kind, SCH_SHEET_PATH::LastScreen(), m_ancestor, ERC_SETTINGS::m_ERCSeverities, m_ours, m_plan, m_report, SCHEMATIC_SETTINGS::m_SchDrawingSheetFileName, m_theirs, EDA_ITEM::m_Uuid, KICAD_DIFF::MERGE_PROPS, KICAD_DIFF::PROPERTY_RESOLUTION::name, EE_RTREE::OfType(), KICAD_DIFF::OURS, KICAD_DIFF::VALIDATION_INPUT::oursSchemaVersion, SCH_SHEET_PATH::Path(), KICAD_DIFF::VALIDATION_INPUT::planRequiredRebuild, KICAD_DIFF::REFDES_ENTRY::refdes, KICAD_DIFF::VALIDATION_INPUT::refdesEntries, SCH_SCREEN::Remove(), res, KICAD_DIFF::rootFileFormatVersion(), SCHEMATIC::RootScreen(), KICAD_DIFF::RunPostApplyValidators(), SCH_SYMBOL_T, KICAD_DIFF::SchScreenSentinelKiid(), BASE_SCREEN::SetContentModified(), SCH_SCREEN::SetPageSettings(), PAGE_INFO::SetPortrait(), SCHEMATIC::Settings(), PAGE_INFO::SetType(), KICAD_DIFF::TAKE_ANCESTOR, KICAD_DIFF::TAKE_OURS, KICAD_DIFF::TAKE_THEIRS, KICAD_DIFF::THEIRS, KICAD_DIFF::VALIDATION_INPUT::theirsSchemaVersion, traceDiffMerge, and SCH_SCREEN::Update().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EESCHEMA_JOBS_HANDLER::runSchMerge().
|
private |
Definition at line 113 of file sch_merge_applier.cpp.
References KICAD_DIFF::PROPERTY_APPLY_COUNTS::applied, KICAD_DIFF::ApplyPropertyResolutions(), KICAD_DIFF::PROPERTY_APPLY_COUNTS::failed, and m_report.
Referenced by Apply().
|
inline |
Definition at line 102 of file sch_merge_applier.h.
References m_report.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EESCHEMA_JOBS_HANDLER::runSchMerge().
|
private |
Walk a schematic into a KIID_PATH-keyed table of (item, sheet_path).
Definition at line 86 of file sch_merge_applier.cpp.
References index, and KICAD_DIFF::WalkSchematic().
Referenced by Apply().
|
private |
Definition at line 123 of file sch_merge_applier.h.
Referenced by Apply(), and SCH_MERGE_APPLIER().
|
private |
Definition at line 124 of file sch_merge_applier.h.
Referenced by Apply(), and SCH_MERGE_APPLIER().
|
private |
Definition at line 126 of file sch_merge_applier.h.
Referenced by Apply(), and SCH_MERGE_APPLIER().
|
private |
Definition at line 127 of file sch_merge_applier.h.
Referenced by Apply(), applyPropertyResolutions(), and GetReport().
|
private |
Definition at line 125 of file sch_merge_applier.h.
Referenced by Apply(), and SCH_MERGE_APPLIER().