KiCad PCB EDA Suite
NETLIST Class Reference

NETLIST stores all of information read from a netlist along with the flags used to update the NETLIST in the BOARD. More...

#include <pcb_netlist.h>

Public Member Functions

 NETLIST ()
 
bool IsEmpty () const
 Function IsEmpty() More...
 
void Clear ()
 Function Clear removes all components from the netlist. More...
 
unsigned GetCount () const
 Function GetCount. More...
 
COMPONENTGetComponent (unsigned aIndex)
 Function GetComponent returns the COMPONENT at aIndex. More...
 
void AddComponent (COMPONENT *aComponent)
 Function AddComponent adds aComponent to the NETLIST. More...
 
COMPONENTGetComponentByReference (const wxString &aReference)
 Function GetComponentByReference returns a COMPONENT by aReference. More...
 
COMPONENTGetComponentByPath (const KIID_PATH &aPath)
 Function GetComponentByPath returns a COMPONENT by aPath. More...
 
void SortByFPID ()
 
void SortByReference ()
 
void SetDeleteExtraFootprints (bool aDeleteExtraFootprints)
 
bool GetDeleteExtraFootprints () const
 
void SetIsDryRun (bool aIsDryRun)
 
bool IsDryRun () const
 
void SetFindByTimeStamp (bool aFindByTimeStamp)
 
bool IsFindByTimeStamp () const
 
void SetReplaceFootprints (bool aReplaceFootprints)
 
bool GetReplaceFootprints () const
 
bool AnyFootprintsLinked () const
 Function AnyFootprintsLinked. More...
 
bool AllFootprintsLinked () const
 Function AllFootprintsLinked. More...
 
bool NoFootprintsLinked () const
 Function NoFootprintsLinked. More...
 
bool AnyFootprintsChanged () const
 Function AnyFootprintsChanged. More...
 
void Format (const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
 
void FormatBackAnnotation (OUTPUTFORMATTER *aOut)
 

Private Attributes

COMPONENTS m_components
 Components found in the netlist. More...
 
bool m_deleteExtraFootprints
 Remove footprints from BOARD not found in netlist when true. More...
 
bool m_isDryRun
 Do not actually make any changes. More...
 
bool m_findByTimeStamp
 Find component by time stamp if true or reference designator if false. More...
 
bool m_replaceFootprints
 Replace component footprints when they differ from the netlist if true. More...
 

Detailed Description

NETLIST stores all of information read from a netlist along with the flags used to update the NETLIST in the BOARD.

Definition at line 212 of file pcb_netlist.h.

Constructor & Destructor Documentation

◆ NETLIST()

NETLIST::NETLIST ( )
inline

Definition at line 230 of file pcb_netlist.h.

230  :
231  m_deleteExtraFootprints( false ),
232  m_isDryRun( false ),
233  m_findByTimeStamp( false ),
234  m_replaceFootprints( false )
235  {
236  }
bool m_replaceFootprints
Replace component footprints when they differ from the netlist if true.
Definition: pcb_netlist.h:227
bool m_findByTimeStamp
Find component by time stamp if true or reference designator if false.
Definition: pcb_netlist.h:224
bool m_isDryRun
Do not actually make any changes.
Definition: pcb_netlist.h:221
bool m_deleteExtraFootprints
Remove footprints from BOARD not found in netlist when true.
Definition: pcb_netlist.h:217

Member Function Documentation

◆ AddComponent()

void NETLIST::AddComponent ( COMPONENT aComponent)

Function AddComponent adds aComponent to the NETLIST.

Note
If aComponent already exists in the NETLIST, aComponent is deleted to prevent memory leaks. An assertion is raised in debug builds.
Parameters
aComponentis the COMPONENT to save to the NETLIST.

Definition at line 144 of file pcb_netlist.cpp.

145 {
146  m_components.push_back( aComponent );
147 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), LEGACY_NETLIST_READER::loadComponent(), and KICAD_NETLIST_PARSER::parseComponent().

◆ AllFootprintsLinked()

bool NETLIST::AllFootprintsLinked ( ) const

Function AllFootprintsLinked.

Returns
true if all components have a footprint link.

Definition at line 223 of file pcb_netlist.cpp.

224 {
225  for( unsigned i = 0; i < m_components.size(); i++ )
226  {
227  if( m_components[i].GetFPID().empty() )
228  return false;
229  }
230 
231  return true;
232 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

◆ AnyFootprintsChanged()

bool NETLIST::AnyFootprintsChanged ( ) const

Function AnyFootprintsChanged.

Returns
true if any components footprints were changed when the footprint link file (*.cmp) was loaded.

◆ AnyFootprintsLinked()

bool NETLIST::AnyFootprintsLinked ( ) const

Function AnyFootprintsLinked.

Returns
true if any component with a footprint link is found.

Definition at line 211 of file pcb_netlist.cpp.

212 {
213  for( unsigned i = 0; i < m_components.size(); i++ )
214  {
215  if( !m_components[i].GetFPID().empty() )
216  return true;
217  }
218 
219  return false;
220 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

Referenced by NoFootprintsLinked(), and CVPCB_MAINFRAME::ReadNetListAndFpFiles().

◆ Clear()

void NETLIST::Clear ( )
inline

Function Clear removes all components from the netlist.

Definition at line 248 of file pcb_netlist.h.

248 { m_components.clear(); }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

Referenced by CVPCB_MAINFRAME::ReadSchematicNetlist().

◆ Format()

void NETLIST::Format ( const char *  aDocName,
OUTPUTFORMATTER aOut,
int  aNestLevel,
int  aCtl = 0 
)

Definition at line 129 of file pcb_netlist.cpp.

130 {
131  int nl = aNestLevel;
132 
133  aOut->Print( nl, "(%s\n", aDocName );
134 
135  for( unsigned i = 0; i < m_components.size(); i++ )
136  {
137  m_components[i].Format( aOut, nl+1, aCtl );
138  }
139 
140  aOut->Print( nl, ")\n" );
141 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404

References m_components, and OUTPUTFORMATTER::Print().

Referenced by FormatBackAnnotation(), and PCB_EDIT_FRAME::KiwayMailIn().

◆ FormatBackAnnotation()

void NETLIST::FormatBackAnnotation ( OUTPUTFORMATTER aOut)
inline

Definition at line 353 of file pcb_netlist.h.

354  {
355  Format( "back_annotation", aOut, 0, CTL_FOR_BACKANNO );
356  }
void Format(const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
#define CTL_FOR_BACKANNO
Definition: pcb_netlist.h:351

References CTL_FOR_BACKANNO, and Format().

Referenced by CVPCB_MAINFRAME::SaveFootprintAssociation().

◆ GetComponent()

◆ GetComponentByPath()

COMPONENT * NETLIST::GetComponentByPath ( const KIID_PATH aPath)

Function GetComponentByPath returns a COMPONENT by aPath.

Parameters
aPathis the KIID_PATH [ sheetUUID, .., compUUID ] of the COMPONENT.
Returns
a pointer to the COMPONENT that matches aPath if found. Otherwise NULL.

Definition at line 167 of file pcb_netlist.cpp.

168 {
169  for( COMPONENT& component : m_components )
170  {
171  if( component.GetPath() == aUuidPath )
172  return &component;
173  }
174 
175  return nullptr;
176 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:80

References m_components.

Referenced by TEST_NETLISTS_FIXTURE::compareNetlists(), and BOARD_NETLIST_UPDATER::deleteUnusedComponents().

◆ GetComponentByReference()

COMPONENT * NETLIST::GetComponentByReference ( const wxString &  aReference)

Function GetComponentByReference returns a COMPONENT by aReference.

Parameters
aReferenceis the reference designator the COMPONENT.
Returns
a pointer to the COMPONENT that matches aReference if found. Otherwise NULL.

Definition at line 150 of file pcb_netlist.cpp.

151 {
152  COMPONENT* component = NULL;
153 
154  for( unsigned i = 0; i < m_components.size(); i++ )
155  {
156  if( m_components[i].GetReference() == aReference )
157  {
158  component = &m_components[i];
159  break;
160  }
161  }
162 
163  return component;
164 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214
#define NULL
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:80

References m_components, and NULL.

Referenced by TEST_NETLISTS_FIXTURE::compareNetlists(), BOARD_NETLIST_UPDATER::deleteUnusedComponents(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadFootprintFilters(), KICAD_NETLIST_PARSER::parseNet(), and TestFootprints().

◆ GetCount()

◆ GetDeleteExtraFootprints()

bool NETLIST::GetDeleteExtraFootprints ( ) const
inline

Definition at line 303 of file pcb_netlist.h.

303 { return m_deleteExtraFootprints; }
bool m_deleteExtraFootprints
Remove footprints from BOARD not found in netlist when true.
Definition: pcb_netlist.h:217

References m_deleteExtraFootprints.

◆ GetReplaceFootprints()

bool NETLIST::GetReplaceFootprints ( ) const
inline

Definition at line 318 of file pcb_netlist.h.

318 { return m_replaceFootprints; }
bool m_replaceFootprints
Replace component footprints when they differ from the netlist if true.
Definition: pcb_netlist.h:227

References m_replaceFootprints.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ IsDryRun()

bool NETLIST::IsDryRun ( ) const
inline

Definition at line 307 of file pcb_netlist.h.

307 { return m_isDryRun; }
bool m_isDryRun
Do not actually make any changes.
Definition: pcb_netlist.h:221

References m_isDryRun.

◆ IsEmpty()

bool NETLIST::IsEmpty ( ) const
inline

Function IsEmpty()

Returns
true if there are no components in the netlist.

Definition at line 242 of file pcb_netlist.h.

242 { return m_components.empty(); }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

Referenced by CVPCB_MAINFRAME::AssociateFootprint(), CVPCB_MAINFRAME::AutomaticFootprintMatching(), CVPCB_MAINFRAME::GetComponentIndices(), PCB_EDIT_FRAME::LoadFootprints(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), and CVPCB_MAINFRAME::SendMessageToEESCHEMA().

◆ IsFindByTimeStamp()

bool NETLIST::IsFindByTimeStamp ( ) const
inline

Definition at line 311 of file pcb_netlist.h.

311 { return m_findByTimeStamp; }
bool m_findByTimeStamp
Find component by time stamp if true or reference designator if false.
Definition: pcb_netlist.h:224

References m_findByTimeStamp.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ NoFootprintsLinked()

bool NETLIST::NoFootprintsLinked ( ) const
inline

Function NoFootprintsLinked.

Returns
true if none of the components have a footprint link.

Definition at line 336 of file pcb_netlist.h.

336 { return !AnyFootprintsLinked(); }
bool AnyFootprintsLinked() const
Function AnyFootprintsLinked.

References AnyFootprintsLinked().

◆ SetDeleteExtraFootprints()

void NETLIST::SetDeleteExtraFootprints ( bool  aDeleteExtraFootprints)
inline

Definition at line 298 of file pcb_netlist.h.

299  {
300  m_deleteExtraFootprints = aDeleteExtraFootprints;
301  }
bool m_deleteExtraFootprints
Remove footprints from BOARD not found in netlist when true.
Definition: pcb_netlist.h:217

References m_deleteExtraFootprints.

Referenced by DIALOG_NETLIST::loadNetlist(), and DIALOG_UPDATE_PCB::PerformUpdate().

◆ SetFindByTimeStamp()

void NETLIST::SetFindByTimeStamp ( bool  aFindByTimeStamp)
inline

Definition at line 309 of file pcb_netlist.h.

309 { m_findByTimeStamp = aFindByTimeStamp; }
bool m_findByTimeStamp
Find component by time stamp if true or reference designator if false.
Definition: pcb_netlist.h:224

References m_findByTimeStamp.

Referenced by DIALOG_NETLIST::loadNetlist(), and DIALOG_UPDATE_PCB::PerformUpdate().

◆ SetIsDryRun()

void NETLIST::SetIsDryRun ( bool  aIsDryRun)
inline

Definition at line 305 of file pcb_netlist.h.

305 { m_isDryRun = aIsDryRun; }
bool m_isDryRun
Do not actually make any changes.
Definition: pcb_netlist.h:221

References m_isDryRun.

◆ SetReplaceFootprints()

void NETLIST::SetReplaceFootprints ( bool  aReplaceFootprints)
inline

Definition at line 313 of file pcb_netlist.h.

314  {
315  m_replaceFootprints = aReplaceFootprints;
316  }
bool m_replaceFootprints
Replace component footprints when they differ from the netlist if true.
Definition: pcb_netlist.h:227

References m_replaceFootprints.

Referenced by DIALOG_NETLIST::loadNetlist(), and DIALOG_UPDATE_PCB::PerformUpdate().

◆ SortByFPID()

void NETLIST::SortByFPID ( )

Definition at line 189 of file pcb_netlist.cpp.

190 {
191  m_components.sort( ByFPID );
192 }
static bool ByFPID(const COMPONENT &ref, const COMPONENT &cmp)
Function ByFPID is a helper function used to sort the component list used by loadNewModules.
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References ByFPID(), and m_components.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ SortByReference()

void NETLIST::SortByReference ( )

Definition at line 205 of file pcb_netlist.cpp.

206 {
207  m_components.sort();
208 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:214

References m_components.

Referenced by DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), and CVPCB_MAINFRAME::ReadSchematicNetlist().

Member Data Documentation

◆ m_components

COMPONENTS NETLIST::m_components
private

◆ m_deleteExtraFootprints

bool NETLIST::m_deleteExtraFootprints
private

Remove footprints from BOARD not found in netlist when true.

Definition at line 217 of file pcb_netlist.h.

Referenced by GetDeleteExtraFootprints(), and SetDeleteExtraFootprints().

◆ m_findByTimeStamp

bool NETLIST::m_findByTimeStamp
private

Find component by time stamp if true or reference designator if false.

Definition at line 224 of file pcb_netlist.h.

Referenced by IsFindByTimeStamp(), and SetFindByTimeStamp().

◆ m_isDryRun

bool NETLIST::m_isDryRun
private

Do not actually make any changes.

Only report changes to BOARD from netlist when true.

Definition at line 221 of file pcb_netlist.h.

Referenced by IsDryRun(), and SetIsDryRun().

◆ m_replaceFootprints

bool NETLIST::m_replaceFootprints
private

Replace component footprints when they differ from the netlist if true.

Definition at line 227 of file pcb_netlist.h.

Referenced by GetReplaceFootprints(), and SetReplaceFootprints().


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