KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_test_provider_library_parity.cpp File Reference
#include <layer_range.h>
#include <layer_utils.h>
#include <kiway.h>
#include <macros.h>
#include <netlist_reader/pcb_netlist.h>
#include <fp_lib_table.h>
#include <board.h>
#include <pcb_shape.h>
#include <zone.h>
#include <footprint.h>
#include <pad.h>
#include <drc/drc_engine.h>
#include <drc/drc_item.h>
#include <drc/drc_test_provider.h>
#include <project_pcb.h>
#include <string_utils.h>

Go to the source code of this file.

Classes

class  DRC_TEST_PROVIDER_LIBRARY_PARITY
 

Namespaces

namespace  detail
 

Macros

#define TEST(a, b, msg)
 
#define EPSILON   2
 
#define TEST_PT(a, b, msg)
 
#define EPSILON_D   0.000002
 
#define TEST_D(a, b, msg)
 
#define ITEM_DESC(item)
 
#define PAD_DESC(pad)
 
#define REPORT_MSG(s, p)
 
#define TEST_ATTR(a, b, attr, msg)
 
#define REPORT(msg)
 
#define CHECKPOINT   { if( diff && !aReporter ) return diff; }
 

Functions

LSET getBoardNormalizedLayerSet (const BOARD_ITEM *aLibItem, const BOARD *aBoard)
 
bool primitiveNeedsUpdate (const std::shared_ptr< PCB_SHAPE > &a, const std::shared_ptr< PCB_SHAPE > &b)
 
bool padHasOverrides (const PAD *a, const PAD *b, REPORTER &aReporter)
 
bool padNeedsUpdate (const PAD *a, const PAD *b, REPORTER *aReporter)
 
bool shapeNeedsUpdate (const PCB_SHAPE &curr_shape, const PCB_SHAPE &ref_shape)
 
bool zoneNeedsUpdate (const ZONE *a, const ZONE *b, REPORTER *aReporter)
 
bool stackupNeedsUpdate (const FOOTPRINT &a, const FOOTPRINT &b, REPORTER *aReporter)
 Compare the stackup related settings of two footprints.
 
bool footprintVsBoardStackup (const FOOTPRINT &aFp, const BOARD &aBoard, REPORTER *aReporter)
 Report board->footprint stackup differences.
 

Variables

UNITS_PROVIDER g_unitsProvider (pcbIUScale, EDA_UNITS::MM)
 
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_LIBRARY_PARITYdetail::dummy
 

Macro Definition Documentation

◆ CHECKPOINT

#define CHECKPOINT   { if( diff && !aReporter ) return diff; }

◆ EPSILON

#define EPSILON   2

Definition at line 85 of file drc_test_provider_library_parity.cpp.

◆ EPSILON_D

#define EPSILON_D   0.000002

Definition at line 101 of file drc_test_provider_library_parity.cpp.

◆ ITEM_DESC

#define ITEM_DESC ( item)
Value:
( item )->GetItemDescription( &g_unitsProvider, true )
UNITS_PROVIDER g_unitsProvider(pcbIUScale, EDA_UNITS::MM)

Definition at line 116 of file drc_test_provider_library_parity.cpp.

Referenced by zoneNeedsUpdate().

◆ PAD_DESC

#define PAD_DESC ( pad)
Value:
wxString::Format( _( "Pad %s" ), ( pad )->GetNumber() )
#define _(s)

Definition at line 117 of file drc_test_provider_library_parity.cpp.

Referenced by padHasOverrides(), and padNeedsUpdate().

◆ REPORT

#define REPORT ( msg)
Value:
{ if( aReporter ) aReporter->Report( msg ); }

◆ REPORT_MSG

#define REPORT_MSG ( s,
p )
Value:
aReporter.Report( wxString::Format( s, p ) )

Referenced by padHasOverrides().

◆ TEST

#define TEST ( a,
b,
msg )
Value:
do { \
if( a != b ) \
{ \
diff = true; \
\
if( aReporter && wxString( msg ).length() ) \
aReporter->Report( msg ); \
} \
\
if( diff && !aReporter ) \
return diff; \
} while (0)

Definition at line 71 of file drc_test_provider_library_parity.cpp.

Referenced by padNeedsUpdate(), primitiveNeedsUpdate(), shapeNeedsUpdate(), stackupNeedsUpdate(), and zoneNeedsUpdate().

◆ TEST_ATTR

#define TEST_ATTR ( a,
b,
attr,
msg )
Value:
TEST( ( a & attr ), ( b & attr ), msg )
#define TEST(a, b)

Referenced by FOOTPRINT::FootprintNeedsUpdate().

◆ TEST_D

#define TEST_D ( a,
b,
msg )
Value:
do { \
if( abs( a - b ) > EPSILON_D ) \
{ \
diff = true; \
\
if( aReporter && wxString( msg ).length() ) \
aReporter->Report( msg ); \
} \
\
if( diff && !aReporter ) \
return diff; \
} while (0)

Definition at line 102 of file drc_test_provider_library_parity.cpp.

Referenced by padNeedsUpdate(), and zoneNeedsUpdate().

◆ TEST_PT

#define TEST_PT ( a,
b,
msg )
Value:
do { \
if( abs( a.x - b.x ) > EPSILON \
|| abs( a.y - b.y ) > EPSILON ) \
{ \
diff = true; \
\
if( aReporter && wxString( msg ).length() ) \
aReporter->Report( msg ); \
} \
\
if( diff && !aReporter ) \
return diff; \
} while (0)
#define EPSILON

Definition at line 86 of file drc_test_provider_library_parity.cpp.

Referenced by padNeedsUpdate(), primitiveNeedsUpdate(), and shapeNeedsUpdate().

Function Documentation

◆ footprintVsBoardStackup()

bool footprintVsBoardStackup ( const FOOTPRINT & aFp,
const BOARD & aBoard,
REPORTER * aReporter )

Report board->footprint stackup differences.

This is not necessarily a comparison failure, but may be useful information for the user to see.

Returns
true if there is

Definition at line 621 of file drc_test_provider_library_parity.cpp.

References _, LAYER_UTILS::AccumulateNames(), LSET::AllCuMask(), LSET::AllCuMask(), EXPAND_INNER_LAYERS, BOARD::GetEnabledLayers(), FOOTPRINT::GetStackupLayers(), FOOTPRINT::GetStackupMode(), REPORTER::Report(), and LSET::UserDefinedLayersMask().

Referenced by FOOTPRINT::FootprintNeedsUpdate().

◆ getBoardNormalizedLayerSet()

LSET getBoardNormalizedLayerSet ( const BOARD_ITEM * aLibItem,
const BOARD * aBoard )

◆ padHasOverrides()

◆ padNeedsUpdate()

◆ primitiveNeedsUpdate()

bool primitiveNeedsUpdate ( const std::shared_ptr< PCB_SHAPE > & a,
const std::shared_ptr< PCB_SHAPE > & b )

◆ shapeNeedsUpdate()

◆ stackupNeedsUpdate()

bool stackupNeedsUpdate ( const FOOTPRINT & a,
const FOOTPRINT & b,
REPORTER * aReporter )

Compare the stackup related settings of two footprints.

Returns true if they differ.

Definition at line 596 of file drc_test_provider_library_parity.cpp.

References _, BOARD_ITEM::GetLayerSet(), FOOTPRINT::GetStackupMode(), and TEST.

Referenced by FOOTPRINT::FootprintNeedsUpdate().

◆ zoneNeedsUpdate()

Variable Documentation

◆ g_unitsProvider