KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KICAD_DIFF::LIB_MERGE_APPLIER< ITEM > Class Template Reference

Materialize a MERGE_PLAN into a merged name-keyed library. More...

#include <lib_merge_applier.h>

Classes

struct  REPORT
 

Public Types

using ITEM_MAP = std::map<wxString, const ITEM*>
 
using COMBINER = std::function<std::unique_ptr<ITEM>( const KIID_PATH& aId )>
 Both sides' edits of the item with this id applied to one copy, or null when they cannot be combined.
 

Public Member Functions

 LIB_MERGE_APPLIER (const ITEM_MAP &aAncestor, const ITEM_MAP &aOurs, const ITEM_MAP &aTheirs, MERGE_PLAN aPlan, COMBINER aCombine={})
 
std::vector< std::unique_ptr< ITEM > > Apply ()
 
const REPORT & GetReport () const
 

Static Private Member Functions

static const ITEM * findItem (const ITEM_MAP &aMap, const wxString &aName)
 
static std::set< wxString > collectNames (const ITEM_MAP &aAncestor, const ITEM_MAP &aOurs, const ITEM_MAP &aTheirs)
 
static void takeFrom (const ITEM_MAP &aSource, const wxString &aName, std::map< wxString, const ITEM * > &aLive, std::size_t &aCounter)
 

Private Attributes

const ITEM_MAP & m_ancestor
 
const ITEM_MAP & m_ours
 
const ITEM_MAP & m_theirs
 
MERGE_PLAN m_plan
 
COMBINER m_combine
 
REPORT m_report
 

Detailed Description

template<typename ITEM>
class KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >

Materialize a MERGE_PLAN into a merged name-keyed library.

Library identity is the canonical item name (LIB_SYMBOL or FOOTPRINT). Plan IDs come from LibraryItemKiidPath(name) on the differ side; the applier reconstructs the same KIID_PATH from each input map's keys and looks up matching resolutions.

A MERGE_PROPS item is built by the combiner, which owns the knowledge of how two edits of one item fit together. Without a combiner, or when it returns null, the item is downgraded to TAKE_OURS and counted in mergePropsFallback so the job handler can surface it as unresolved.

Definition at line 59 of file lib_merge_applier.h.

Member Typedef Documentation

◆ COMBINER

template<typename ITEM>
using KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::COMBINER = std::function<std::unique_ptr<ITEM>( const KIID_PATH& aId )>

Both sides' edits of the item with this id applied to one copy, or null when they cannot be combined.

Definition at line 65 of file lib_merge_applier.h.

◆ ITEM_MAP

template<typename ITEM>
using KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::ITEM_MAP = std::map<wxString, const ITEM*>

Definition at line 62 of file lib_merge_applier.h.

Constructor & Destructor Documentation

◆ LIB_MERGE_APPLIER()

template<typename ITEM>
KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::LIB_MERGE_APPLIER ( const ITEM_MAP & aAncestor,
const ITEM_MAP & aOurs,
const ITEM_MAP & aTheirs,
MERGE_PLAN aPlan,
COMBINER aCombine = {} )
inline

Definition at line 67 of file lib_merge_applier.h.

Member Function Documentation

◆ Apply()

◆ collectNames()

template<typename ITEM>
static std::set< wxString > KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::collectNames ( const ITEM_MAP & aAncestor,
const ITEM_MAP & aOurs,
const ITEM_MAP & aTheirs )
inlinestaticprivate

◆ findItem()

template<typename ITEM>
static const ITEM * KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::findItem ( const ITEM_MAP & aMap,
const wxString & aName )
inlinestaticprivate

◆ GetReport()

◆ takeFrom()

template<typename ITEM>
static void KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::takeFrom ( const ITEM_MAP & aSource,
const wxString & aName,
std::map< wxString, const ITEM * > & aLive,
std::size_t & aCounter )
inlinestaticprivate

Member Data Documentation

◆ m_ancestor

template<typename ITEM>
const ITEM_MAP& KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_ancestor
private

Definition at line 221 of file lib_merge_applier.h.

◆ m_combine

template<typename ITEM>
COMBINER KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_combine
private

◆ m_ours

template<typename ITEM>
const ITEM_MAP& KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_ours
private

Definition at line 222 of file lib_merge_applier.h.

◆ m_plan

template<typename ITEM>
MERGE_PLAN KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_plan
private

Definition at line 224 of file lib_merge_applier.h.

◆ m_report

template<typename ITEM>
REPORT KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_report
private

Definition at line 226 of file lib_merge_applier.h.

◆ m_theirs

template<typename ITEM>
const ITEM_MAP& KICAD_DIFF::LIB_MERGE_APPLIER< ITEM >::m_theirs
private

Definition at line 223 of file lib_merge_applier.h.


The documentation for this class was generated from the following file: