KiCad PCB EDA Suite
DRC_NETCLASS_TESTER Class Reference

#include <drc_netclass_tester.h>

Inheritance diagram for DRC_NETCLASS_TESTER:
DRC_TEST_PROVIDER

Public Types

using MARKER_HANDLER = std::function< void(MARKER_PCB *)>
 A callable that can handle a single generated PCB_MARKER. More...
 

Public Member Functions

 DRC_NETCLASS_TESTER (MARKER_HANDLER aMarkerHandler)
 
virtual ~DRC_NETCLASS_TESTER ()
 
bool RunDRC (EDA_UNITS aUnits, BOARD &aBoard) override
 Runs this provider against the given PCB with configured options (if any). More...
 

Protected Member Functions

void HandleMarker (MARKER_PCB *aMarker) const
 Pass a given marker to the marker handler. More...
 

Private Member Functions

bool checkNetClass (const NETCLASSPTR &nc)
 

Private Attributes

EDA_UNITS m_units
 
BOARDm_board
 
wxString m_msg
 

Detailed Description

Definition at line 35 of file drc_netclass_tester.h.

Member Typedef Documentation

◆ MARKER_HANDLER

using DRC_TEST_PROVIDER::MARKER_HANDLER = std::function<void( MARKER_PCB* )>
inherited

A callable that can handle a single generated PCB_MARKER.

Definition at line 47 of file drc_provider.h.

Constructor & Destructor Documentation

◆ DRC_NETCLASS_TESTER()

DRC_NETCLASS_TESTER::DRC_NETCLASS_TESTER ( MARKER_HANDLER  aMarkerHandler)

Definition at line 28 of file drc_netclass_tester.cpp.

28  :
29  DRC_TEST_PROVIDER( std::move( aMarkerHandler ) ),
31  m_board( nullptr )
32 {
33 }
DRC_TEST_PROVIDER(MARKER_HANDLER aMarkerHandler)
Definition: drc_provider.h:60

◆ ~DRC_NETCLASS_TESTER()

virtual DRC_NETCLASS_TESTER::~DRC_NETCLASS_TESTER ( )
inlinevirtual

Definition at line 40 of file drc_netclass_tester.h.

40 {};

Member Function Documentation

◆ checkNetClass()

bool DRC_NETCLASS_TESTER::checkNetClass ( const NETCLASSPTR &  nc)
private

Definition at line 53 of file drc_netclass_tester.cpp.

54 {
56 
57  if( nc->GetClearance() < bds.m_MinClearance )
58  return false;
59 
60  if( nc->GetTrackWidth() < bds.m_TrackMinWidth )
61  return false;
62 
63  if( nc->GetViaDiameter() < bds.m_ViasMinSize )
64  return false;
65 
66  if( nc->GetViaDrill() < bds.m_MinThroughDrill )
67  return false;
68 
69  int ncViaAnnulus = ( nc->GetViaDiameter() - nc->GetViaDrill() ) / 2;
70 
71  if( ncViaAnnulus < bds.m_ViasMinAnnulus )
72  return false;
73 
74  if( nc->GetuViaDiameter() < bds.m_MicroViasMinSize )
75  return false;
76 
77  if( nc->GetuViaDrill() < bds.m_MicroViasMinDrill )
78  return false;
79 
80  return true;
81 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References BOARD::GetDesignSettings(), m_board, BOARD_DESIGN_SETTINGS::m_MicroViasMinDrill, BOARD_DESIGN_SETTINGS::m_MicroViasMinSize, BOARD_DESIGN_SETTINGS::m_MinClearance, BOARD_DESIGN_SETTINGS::m_MinThroughDrill, BOARD_DESIGN_SETTINGS::m_TrackMinWidth, BOARD_DESIGN_SETTINGS::m_ViasMinAnnulus, and BOARD_DESIGN_SETTINGS::m_ViasMinSize.

Referenced by RunDRC().

◆ HandleMarker()

void DRC_TEST_PROVIDER::HandleMarker ( MARKER_PCB aMarker) const
inlineprotectedinherited

◆ RunDRC()

bool DRC_NETCLASS_TESTER::RunDRC ( EDA_UNITS  aUnits,
BOARD aBoard 
)
overridevirtual

Runs this provider against the given PCB with configured options (if any).

Note: Board is non-const, as some DRC functions modify the board (e.g. zone fill or polygon coalescing)

Implements DRC_TEST_PROVIDER.

Definition at line 36 of file drc_netclass_tester.cpp.

37 {
38  m_units = aUnits;
39  m_board = &aBoard;
40 
41  bool success = true;
43 
44  success &= checkNetClass( netclasses.GetDefault() );
45 
46  for( NETCLASSES::const_iterator i = netclasses.begin(); i != netclasses.end(); ++i )
47  success &= checkNetClass( i->second );
48 
49  return success;
50 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
iterator end()
Definition: netclass.h:246
bool checkNetClass(const NETCLASSPTR &nc)
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:248
iterator begin()
Definition: netclass.h:245
NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:221
NETCLASSES & GetNetClasses() const
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:265

References NETCLASSES::begin(), checkNetClass(), NETCLASSES::end(), NETCLASSES::GetDefault(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetNetClasses(), m_board, and m_units.

Member Data Documentation

◆ m_board

BOARD* DRC_NETCLASS_TESTER::m_board
private

Definition at line 49 of file drc_netclass_tester.h.

Referenced by checkNetClass(), and RunDRC().

◆ m_msg

wxString DRC_NETCLASS_TESTER::m_msg
private

Definition at line 51 of file drc_netclass_tester.h.

◆ m_units

EDA_UNITS DRC_NETCLASS_TESTER::m_units
private

Definition at line 48 of file drc_netclass_tester.h.

Referenced by RunDRC().


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