KiCad PCB EDA Suite
BOARD_DRC_ITEMS_PROVIDER Class Reference

BOARD_DRC_ITEMS_PROVIDER is an implementation of the RC_ITEMS_PROVIDER interface which uses a BOARD instance to fulfill the interface. More...

#include <drc_results_provider.h>

Inheritance diagram for BOARD_DRC_ITEMS_PROVIDER:
RC_ITEMS_PROVIDER

Public Member Functions

 BOARD_DRC_ITEMS_PROVIDER (BOARD *aBoard)
 
void SetSeverities (int aSeverities) override
 
int GetCount (int aSeverity=-1) override
 
std::shared_ptr< RC_ITEMGetItem (int aIndex) override
 Retrieve a RC_ITEM by index. More...
 
void DeleteItem (int aIndex, bool aDeep) override
 Remove (and optionally deletes) the indexed item from the list. More...
 
void DeleteAllItems (bool aIncludeExclusions, bool aDeep) override
 

Private Attributes

BOARDm_board
 
int m_severities
 
std::vector< MARKER_PCB * > m_filteredMarkers
 

Detailed Description

BOARD_DRC_ITEMS_PROVIDER is an implementation of the RC_ITEMS_PROVIDER interface which uses a BOARD instance to fulfill the interface.

Definition at line 41 of file drc_results_provider.h.

Constructor & Destructor Documentation

◆ BOARD_DRC_ITEMS_PROVIDER()

BOARD_DRC_ITEMS_PROVIDER::BOARD_DRC_ITEMS_PROVIDER ( BOARD aBoard)
inline

Definition at line 50 of file drc_results_provider.h.

50  :
51  m_board( aBoard ),
52  m_severities( 0 )
53  {
54  }

Member Function Documentation

◆ DeleteAllItems()

void BOARD_DRC_ITEMS_PROVIDER::DeleteAllItems ( bool  aIncludeExclusions,
bool  aDeep 
)
inlineoverridevirtual

Implements RC_ITEMS_PROVIDER.

Definition at line 119 of file drc_results_provider.h.

120  {
121  // Filtered list was already handled through DeleteItem() by the tree control
122 
123  if( aDeep )
124  m_board->DeleteMARKERs( true, aIncludeExclusions );
125  }
void DeleteMARKERs()
Delete all MARKERS from the board.

References BOARD::DeleteMARKERs(), and m_board.

◆ DeleteItem()

void BOARD_DRC_ITEMS_PROVIDER::DeleteItem ( int  aIndex,
bool  aDeep 
)
inlineoverridevirtual

Remove (and optionally deletes) the indexed item from the list.

Parameters
aDeepIf true, the source item should be deleted as well as its entry in the list.

Implements RC_ITEMS_PROVIDER.

Definition at line 110 of file drc_results_provider.h.

111  {
112  MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
113  m_filteredMarkers.erase( m_filteredMarkers.begin() + aIndex );
114 
115  if( aDeep )
116  m_board->Delete( marker );
117  }
std::vector< MARKER_PCB * > m_filteredMarkers
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the container and deletes it.

References BOARD_ITEM_CONTAINER::Delete(), m_board, and m_filteredMarkers.

◆ GetCount()

int BOARD_DRC_ITEMS_PROVIDER::GetCount ( int  aSeverity = -1)
inlineoverridevirtual

Implements RC_ITEMS_PROVIDER.

Definition at line 78 of file drc_results_provider.h.

79  {
80  if( aSeverity < 0 )
81  return m_filteredMarkers.size();
82 
84 
85  int count = 0;
86 
87  for( MARKER_PCB* marker : m_board->Markers() )
88  {
89  int markerSeverity;
90 
91  if( marker->IsExcluded() )
92  markerSeverity = RPT_SEVERITY_EXCLUSION;
93  else
94  markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
95 
96  if( markerSeverity == aSeverity )
97  count++;
98  }
99 
100  return count;
101  }
MARKERS & Markers()
Definition: class_board.h:293
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
std::vector< MARKER_PCB * > m_filteredMarkers
int GetSeverity(int aDRCErrorCode)
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetSeverity(), m_board, m_filteredMarkers, BOARD::Markers(), and RPT_SEVERITY_EXCLUSION.

◆ GetItem()

std::shared_ptr<RC_ITEM> BOARD_DRC_ITEMS_PROVIDER::GetItem ( int  aIndex)
inlineoverridevirtual

Retrieve a RC_ITEM by index.

Implements RC_ITEMS_PROVIDER.

Definition at line 103 of file drc_results_provider.h.

104  {
105  MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
106 
107  return marker ? marker->GetRCItem() : nullptr;
108  }
std::vector< MARKER_PCB * > m_filteredMarkers
std::shared_ptr< RC_ITEM > GetRCItem() const
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.
Definition: marker_base.h:120

References MARKER_BASE::GetRCItem(), and m_filteredMarkers.

◆ SetSeverities()

void BOARD_DRC_ITEMS_PROVIDER::SetSeverities ( int  aSeverities)
inlineoverridevirtual

Implements RC_ITEMS_PROVIDER.

Definition at line 56 of file drc_results_provider.h.

57  {
58  m_severities = aSeverities;
59 
61 
62  m_filteredMarkers.clear();
63 
64  for( MARKER_PCB* marker : m_board->Markers() )
65  {
66  int markerSeverity;
67 
68  if( marker->IsExcluded() )
69  markerSeverity = RPT_SEVERITY_EXCLUSION;
70  else
71  markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
72 
73  if( markerSeverity & m_severities )
74  m_filteredMarkers.push_back( marker );
75  }
76  }
MARKERS & Markers()
Definition: class_board.h:293
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
std::vector< MARKER_PCB * > m_filteredMarkers
int GetSeverity(int aDRCErrorCode)
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

References BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetSeverity(), m_board, m_filteredMarkers, m_severities, BOARD::Markers(), and RPT_SEVERITY_EXCLUSION.

Member Data Documentation

◆ m_board

BOARD* BOARD_DRC_ITEMS_PROVIDER::m_board
private

Definition at line 44 of file drc_results_provider.h.

Referenced by DeleteAllItems(), DeleteItem(), GetCount(), and SetSeverities().

◆ m_filteredMarkers

std::vector<MARKER_PCB*> BOARD_DRC_ITEMS_PROVIDER::m_filteredMarkers
private

Definition at line 47 of file drc_results_provider.h.

Referenced by DeleteItem(), GetCount(), GetItem(), and SetSeverities().

◆ m_severities

int BOARD_DRC_ITEMS_PROVIDER::m_severities
private

Definition at line 46 of file drc_results_provider.h.

Referenced by SetSeverities().


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