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_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
 
DRC_ITEMGetItem (int aIndex) override
 Function GetItem retrieves a RC_ITEM by index. More...
 
void DeleteItem (int aIndex, bool aDeep) override
 Function DeleteItem removes (and optionally deletes) the indexed item from the list. More...
 
void DeleteAllItems () override
 Function DeleteAllItems removes and deletes all the items in the list. More...
 

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 84 of file drc_provider.h.

Constructor & Destructor Documentation

◆ BOARD_DRC_ITEMS_PROVIDER()

BOARD_DRC_ITEMS_PROVIDER::BOARD_DRC_ITEMS_PROVIDER ( BOARD aBoard)
inline

Definition at line 93 of file drc_provider.h.

93  :
94  m_board( aBoard ),
95  m_severities( 0 )
96  {
97  }

Member Function Documentation

◆ DeleteAllItems()

void BOARD_DRC_ITEMS_PROVIDER::DeleteAllItems ( )
inlineoverridevirtual

Function DeleteAllItems removes and deletes all the items in the list.

Implements RC_ITEMS_PROVIDER.

Definition at line 162 of file drc_provider.h.

163  {
165  m_filteredMarkers.clear();
166  }
std::vector< MARKER_PCB * > m_filteredMarkers
Definition: drc_provider.h:90
void DeleteMARKERs()
Function DeleteMARKERs deletes ALL MARKERS from the board.

References BOARD::DeleteMARKERs(), m_board, and m_filteredMarkers.

◆ DeleteItem()

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

Function DeleteItem removes (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 153 of file drc_provider.h.

154  {
155  MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
156  m_filteredMarkers.erase( m_filteredMarkers.begin() + aIndex );
157 
158  if( aDeep )
159  m_board->Delete( marker );
160  }
std::vector< MARKER_PCB * > m_filteredMarkers
Definition: drc_provider.h:90
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 121 of file drc_provider.h.

122  {
123  if( aSeverity < 0 )
124  return m_filteredMarkers.size();
125 
127 
128  int count = 0;
129 
130  for( MARKER_PCB* marker : m_board->Markers() )
131  {
132  int markerSeverity;
133 
134  if( marker->IsExcluded() )
135  markerSeverity = RPT_SEVERITY_EXCLUSION;
136  else
137  markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
138 
139  if( markerSeverity == aSeverity )
140  count++;
141  }
142 
143  return count;
144  }
MARKERS & Markers()
Definition: class_board.h:285
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
std::vector< MARKER_PCB * > m_filteredMarkers
Definition: drc_provider.h:90
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()

DRC_ITEM* BOARD_DRC_ITEMS_PROVIDER::GetItem ( int  aIndex)
inlineoverridevirtual

Function GetItem retrieves a RC_ITEM by index.

Implements RC_ITEMS_PROVIDER.

Definition at line 146 of file drc_provider.h.

147  {
148  MARKER_PCB* marker = m_filteredMarkers[ aIndex ];
149 
150  return marker ? static_cast<DRC_ITEM*>( marker->GetRCItem() ) : nullptr;
151  }
RC_ITEM * GetRCItem()
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.
Definition: marker_base.h:117
std::vector< MARKER_PCB * > m_filteredMarkers
Definition: drc_provider.h:90

References MARKER_BASE::GetRCItem(), and m_filteredMarkers.

◆ SetSeverities()

void BOARD_DRC_ITEMS_PROVIDER::SetSeverities ( int  aSeverities)
inlineoverridevirtual

Implements RC_ITEMS_PROVIDER.

Definition at line 99 of file drc_provider.h.

100  {
101  m_severities = aSeverities;
102 
104 
105  m_filteredMarkers.clear();
106 
107  for( MARKER_PCB* marker : m_board->Markers() )
108  {
109  int markerSeverity;
110 
111  if( marker->IsExcluded() )
112  markerSeverity = RPT_SEVERITY_EXCLUSION;
113  else
114  markerSeverity = bds.GetSeverity( marker->GetRCItem()->GetErrorCode() );
115 
116  if( markerSeverity & m_severities )
117  m_filteredMarkers.push_back( marker );
118  }
119  }
MARKERS & Markers()
Definition: class_board.h:285
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
std::vector< MARKER_PCB * > m_filteredMarkers
Definition: drc_provider.h:90
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 87 of file drc_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 90 of file drc_provider.h.

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

◆ m_severities

int BOARD_DRC_ITEMS_PROVIDER::m_severities
private

Definition at line 89 of file drc_provider.h.

Referenced by SetSeverities().


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