|
KiCad PCB EDA Suite
|
Reconciles item identity across two snapshots of the same document. More...
#include <identity_reconciler.h>
Classes | |
| struct | CONFIG |
Public Member Functions | |
| IDENTITY_RECONCILER ()=default | |
| IDENTITY_RECONCILER (const CONFIG &aConfig) | |
| const CONFIG & | GetConfig () const |
| void | SetConfig (const CONFIG &aConfig) |
| RECONCILIATION | Reconcile (const std::vector< ITEM_DESCRIPTOR > &aA, const std::vector< ITEM_DESCRIPTOR > &aB) const |
| double | ScoreSimilarity (const ITEM_DESCRIPTOR &aA, const ITEM_DESCRIPTOR &aB) const |
| Compute the similarity score between two items of the same type. | |
Private Attributes | |
| CONFIG | m_config |
Reconciles item identity across two snapshots of the same document.
Primary key is KIID_PATH. Items with the same KIID_PATH on both sides are matched directly. Items that exist only on one side are then candidates for similarity matching — useful when UUIDs churn from imports, copy-paste, or third-party tools rewriting identifiers.
Similarity score is 0..1 and combines:
Items with score >= threshold are matched; ties prefer the closest position. A given B item is matched at most once (greedy by best score; deterministic order).
Definition at line 96 of file identity_reconciler.h.
|
default |
|
inlineexplicit |
Definition at line 108 of file identity_reconciler.h.
References m_config.
|
inline |
Definition at line 110 of file identity_reconciler.h.
References m_config.
Referenced by BOOST_AUTO_TEST_CASE().
| RECONCILIATION KICAD_DIFF::IDENTITY_RECONCILER::Reconcile | ( | const std::vector< ITEM_DESCRIPTOR > & | aA, |
| const std::vector< ITEM_DESCRIPTOR > & | aB ) const |
Definition at line 120 of file identity_reconciler.cpp.
References m_config, result, and ScoreSimilarity().
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(), BOOST_AUTO_TEST_CASE(), KICAD_DIFF::PCB_DIFFER::Diff(), KICAD_DIFF::SCH_DIFFER::Diff(), and KICAD_DIFF::PCB_DIFFER::diffFootprintChildren().
| double KICAD_DIFF::IDENTITY_RECONCILER::ScoreSimilarity | ( | const ITEM_DESCRIPTOR & | aA, |
| const ITEM_DESCRIPTOR & | aB ) const |
Compute the similarity score between two items of the same type.
Exposed publicly so per-document differs can tune the threshold against representative fixtures.
Definition at line 100 of file identity_reconciler.cpp.
References KICAD_DIFF::ITEM_DESCRIPTOR::bbox, KICAD_DIFF::ITEM_DESCRIPTOR::keyProps, m_config, KICAD_DIFF::ITEM_DESCRIPTOR::position, and KICAD_DIFF::ITEM_DESCRIPTOR::type.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and Reconcile().
|
inline |
Definition at line 111 of file identity_reconciler.h.
References m_config.
Referenced by BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 125 of file identity_reconciler.h.
Referenced by GetConfig(), IDENTITY_RECONCILER(), Reconcile(), ScoreSimilarity(), and SetConfig().