|
KiCad PCB EDA Suite
|
Materialize a MERGE_PLAN into a real merged BOARD. More...
#include <pcb_merge_applier.h>
Classes | |
| struct | REPORT |
| Report on the application after Apply() runs. More... | |
Public Member Functions | |
| PCB_MERGE_APPLIER (const BOARD *aAncestor, const BOARD *aOurs, const BOARD *aTheirs, MERGE_PLAN aPlan) | |
| std::unique_ptr< BOARD > | Apply () |
| Produce the merged board. | |
| const REPORT & | GetReport () const |
Private Member Functions | |
| const BOARD_ITEM * | findItem (const BOARD *aBoard, const KIID &aId) const |
| Locate an item (top-level or footprint child) by UUID on one of the source boards. | |
| BOARD_ITEM * | cloneInto (BOARD *aTarget, const BOARD_ITEM *aSource) const |
Clone a board item using its virtual Clone(); returns nullptr if the source is null, the clone fails, or BOARD::Add() rejects the item. | |
| std::size_t | applyPropertyResolutions (BOARD_ITEM *aTarget, const std::vector< PROPERTY_RESOLUTION > &aProps, const BOARD_ITEM *aOurs, const BOARD_ITEM *aTheirs, const BOARD_ITEM *aAncestor) |
Apply property-level resolutions to a clone of aOurs (or aTheirs per PROP_RES). | |
Private Attributes | |
| const BOARD * | m_ancestor |
| const BOARD * | m_ours |
| const BOARD * | m_theirs |
| MERGE_PLAN | m_plan |
| REPORT | m_report |
Materialize a MERGE_PLAN into a real merged BOARD.
Construction takes the three input boards (ancestor, ours, theirs) by reference and a plan. Apply() produces a new BOARD that owns its items; the input boards are never mutated.
Resolution semantics:
Items that exist on no side, or are listed in the plan with no surviving source, are silently dropped.
The applier never invents item state. If a MERGE_PROPS resolution references a property that cannot be set (read-only, hidden, missing on the target), the property is left at the OURS value and the failure is logged via wxLogTrace( traceDiffMerge ).
The plan is stored by value so a temporary engine.Plan(...) result is safe to pass into the constructor.
Definition at line 67 of file pcb_merge_applier.h.
| KICAD_DIFF::PCB_MERGE_APPLIER::PCB_MERGE_APPLIER | ( | const BOARD * | aAncestor, |
| const BOARD * | aOurs, | ||
| const BOARD * | aTheirs, | ||
| MERGE_PLAN | aPlan ) |
Definition at line 50 of file pcb_merge_applier.cpp.
References m_ancestor, m_ours, m_plan, m_theirs, and move.
| std::unique_ptr< BOARD > KICAD_DIFF::PCB_MERGE_APPLIER::Apply | ( | ) |
Produce the merged board.
Returns a unique_ptr; on null indicates a fatal application error (currently only "no input boards").
Definition at line 115 of file pcb_merge_applier.cpp.
References FOOTPRINT::Add(), KICAD_DIFF::VALIDATION_INPUT::ancestorSchemaVersion, APPEND, KICAD_DIFF::VALIDATION_INPUT::applierReportedRebuild, applyPropertyResolutions(), EDA_ITEM::Clone(), cloneInto(), KICAD_DIFF::CollectTopLevelIds(), KICAD_DIFF::DELETE_ITEM, FILEEXT::DesignRulesFileExtension, KICAD_DIFF::DOC_PROP_BOARD_THICKNESS, KICAD_DIFF::DOC_PROP_CUSTOM_RULES, KICAD_DIFF::DOC_PROP_DRAWING_SHEET, KICAD_DIFF::DOC_PROP_DRC_SEVERITIES, KICAD_DIFF::DOC_PROP_FP_LIB_TABLE, KICAD_DIFF::DOC_PROP_LAYER_STACKUP, KICAD_DIFF::DOC_PROP_NET_CLASSES, KICAD_DIFF::DOC_PROP_PAGE_FORMAT, KICAD_DIFF::DOC_PROP_PAGE_ORIENTATION, KICAD_DIFF::DOC_PROP_SYM_LIB_TABLE, findItem(), KICAD_DIFF::FOOTPRINT, FILEEXT::FootprintLibraryTableFileName, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetDesignSettings(), FOOTPRINT::GetFields(), BOARD::GetFileName(), BOARD::GetPageSettings(), BOARD::GetProject(), PROJECT::GetProjectFile(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), PAGE_INFO::GetType(), FOOTPRINT::GraphicalItems(), KICAD_DIFF::ITEM_RESOLUTION::id, KICAD_DIFF::REFDES_ENTRY::id, PAGE_INFO::IsPortrait(), KICAD_DIFF::KEEP, KICAD_DIFF::ITEM_RESOLUTION::kind, KICAD_DIFF::PROPERTY_RESOLUTION::kind, m_ancestor, PROJECT_FILE::m_BoardDrawingSheetFile, BOARD_DESIGN_SETTINGS::m_DRCSeverities, BOARD_DESIGN_SETTINGS::m_NetSettings, m_ours, m_plan, m_report, m_theirs, KICAD_DIFF::MERGE_PROPS, KICAD_DIFF::PROPERTY_RESOLUTION::name, KICAD_DIFF::OURS, KICAD_DIFF::VALIDATION_INPUT::oursSchemaVersion, pad, FOOTPRINT::Pads(), path, KICAD_DIFF::VALIDATION_INPUT::planRequiredRebuild, KICAD_DIFF::ITEM_RESOLUTION::props, KICAD_DIFF::REFDES_ENTRY::refdes, KICAD_DIFF::VALIDATION_INPUT::refdesEntries, FOOTPRINT::Remove(), res, result, KICAD_DIFF::RunPostApplyValidators(), PAGE_INFO::SetPortrait(), PAGE_INFO::SetType(), FILEEXT::SymbolLibraryTableFileName, KICAD_DIFF::TAKE_ANCESTOR, KICAD_DIFF::TAKE_OURS, KICAD_DIFF::TAKE_THEIRS, KICAD_DIFF::THEIRS, KICAD_DIFF::VALIDATION_INPUT::theirsSchemaVersion, and FOOTPRINT::Zones().
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(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), KIGIT_PCB_MERGE::Merge(), and PCBNEW_JOBS_HANDLER::runPcbMerge().
|
private |
Apply property-level resolutions to a clone of aOurs (or aTheirs per PROP_RES).
Returns the number of properties successfully applied.
Definition at line 99 of file pcb_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().
|
private |
Clone a board item using its virtual Clone(); returns nullptr if the source is null, the clone fails, or BOARD::Add() rejects the item.
Definition at line 73 of file pcb_merge_applier.cpp.
References BOARD::Add(), APPEND, and EDA_ITEM::Clone().
Referenced by Apply().
|
private |
Locate an item (top-level or footprint child) by UUID on one of the source boards.
Delegates to BOARD::ResolveItem, which maintains its own KIID->item cache and resolves footprint children under their own UUIDs.
Definition at line 59 of file pcb_merge_applier.cpp.
References BOARD::ResolveItem().
Referenced by Apply().
|
inline |
Definition at line 145 of file pcb_merge_applier.h.
References m_report.
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(), and PCBNEW_JOBS_HANDLER::runPcbMerge().
|
private |
Definition at line 166 of file pcb_merge_applier.h.
Referenced by Apply(), and PCB_MERGE_APPLIER().
|
private |
Definition at line 167 of file pcb_merge_applier.h.
Referenced by Apply(), and PCB_MERGE_APPLIER().
|
private |
Definition at line 169 of file pcb_merge_applier.h.
Referenced by Apply(), and PCB_MERGE_APPLIER().
|
private |
Definition at line 170 of file pcb_merge_applier.h.
Referenced by Apply(), applyPropertyResolutions(), and GetReport().
|
private |
Definition at line 168 of file pcb_merge_applier.h.
Referenced by Apply(), and PCB_MERGE_APPLIER().