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 SetFindByTimeStamp (bool aFindByTimeStamp)
 
bool IsFindByTimeStamp () const
 
void SetReplaceFootprints (bool aReplace)
 
bool GetReplaceFootprints () const
 
bool AnyFootprintsLinked () const
 Function AnyFootprintsLinked. More...
 
void Format (const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
 
void FormatBackAnnotation (OUTPUTFORMATTER *aOut)
 

Private Attributes

COMPONENTS m_components
 
bool m_findByTimeStamp
 
bool m_replaceFootprints
 

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 194 of file pcb_netlist.h.

Constructor & Destructor Documentation

◆ NETLIST()

NETLIST::NETLIST ( )
inline

Definition at line 202 of file pcb_netlist.h.

202  :
203  m_findByTimeStamp( false ),
204  m_replaceFootprints( false )
205  {
206  }
bool m_replaceFootprints
Definition: pcb_netlist.h:199
bool m_findByTimeStamp
Definition: pcb_netlist.h:198

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 138 of file pcb_netlist.cpp.

139 {
140  m_components.push_back( aComponent );
141 }
COMPONENTS m_components
Definition: pcb_netlist.h:196

References m_components.

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

◆ AnyFootprintsLinked()

bool NETLIST::AnyFootprintsLinked ( ) const

Function AnyFootprintsLinked.

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

Definition at line 205 of file pcb_netlist.cpp.

206 {
207  for( unsigned i = 0; i < m_components.size(); i++ )
208  {
209  if( !m_components[i].GetFPID().empty() )
210  return true;
211  }
212 
213  return false;
214 }
COMPONENTS m_components
Definition: pcb_netlist.h:196

References m_components.

Referenced by CVPCB_MAINFRAME::ReadNetListAndFpFiles().

◆ Clear()

void NETLIST::Clear ( )
inline

Function Clear removes all components from the netlist.

Definition at line 218 of file pcb_netlist.h.

218 { m_components.clear(); }
COMPONENTS m_components
Definition: pcb_netlist.h:196

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 123 of file pcb_netlist.cpp.

124 {
125  int nl = aNestLevel;
126 
127  aOut->Print( nl, "(%s\n", aDocName );
128 
129  for( unsigned i = 0; i < m_components.size(); i++ )
130  {
131  m_components[i].Format( aOut, nl+1, aCtl );
132  }
133 
134  aOut->Print( nl, ")\n" );
135 }
COMPONENTS m_components
Definition: pcb_netlist.h:196
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(), PCB_EDIT_FRAME::KiwayMailIn(), and DIALOG_BOARD_REANNOTATE::ReannotateBoard().

◆ FormatBackAnnotation()

void NETLIST::FormatBackAnnotation ( OUTPUTFORMATTER aOut)
inline

Definition at line 287 of file pcb_netlist.h.

288  {
289  Format( "back_annotation", aOut, 0, CTL_FOR_BACKANNO );
290  }
void Format(const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
#define CTL_FOR_BACKANNO
Definition: pcb_netlist.h:285

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 161 of file pcb_netlist.cpp.

162 {
163  for( COMPONENT& component : m_components )
164  {
165  if( component.GetPath() == aUuidPath )
166  return &component;
167  }
168 
169  return nullptr;
170 }
COMPONENTS m_components
Definition: pcb_netlist.h:196
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 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 144 of file pcb_netlist.cpp.

145 {
146  COMPONENT* component = NULL;
147 
148  for( unsigned i = 0; i < m_components.size(); i++ )
149  {
150  if( m_components[i].GetReference() == aReference )
151  {
152  component = &m_components[i];
153  break;
154  }
155  }
156 
157  return component;
158 }
COMPONENTS m_components
Definition: pcb_netlist.h:196
#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 BOARD_NETLIST_UPDATER::deleteUnusedComponents(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadFootprintFilters(), KICAD_NETLIST_PARSER::parseNet(), and DRC_TEST_PROVIDER_LVS::testFootprints().

◆ GetCount()

◆ GetReplaceFootprints()

bool NETLIST::GetReplaceFootprints ( ) const
inline

Definition at line 271 of file pcb_netlist.h.

271 { return m_replaceFootprints; }
bool m_replaceFootprints
Definition: pcb_netlist.h:199

References m_replaceFootprints.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ IsEmpty()

bool NETLIST::IsEmpty ( ) const
inline

◆ IsFindByTimeStamp()

bool NETLIST::IsFindByTimeStamp ( ) const
inline

Definition at line 268 of file pcb_netlist.h.

268 { return m_findByTimeStamp; }
bool m_findByTimeStamp
Definition: pcb_netlist.h:198

References m_findByTimeStamp.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ SetFindByTimeStamp()

void NETLIST::SetFindByTimeStamp ( bool  aFindByTimeStamp)
inline

Definition at line 267 of file pcb_netlist.h.

267 { m_findByTimeStamp = aFindByTimeStamp; }
bool m_findByTimeStamp
Definition: pcb_netlist.h:198

References m_findByTimeStamp.

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

◆ SetReplaceFootprints()

void NETLIST::SetReplaceFootprints ( bool  aReplace)
inline

Definition at line 270 of file pcb_netlist.h.

270 { m_replaceFootprints = aReplace; }
bool m_replaceFootprints
Definition: pcb_netlist.h:199

References m_replaceFootprints.

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

◆ SortByFPID()

void NETLIST::SortByFPID ( )

Definition at line 183 of file pcb_netlist.cpp.

184 {
185  m_components.sort( ByFPID );
186 }
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
Definition: pcb_netlist.h:196

References ByFPID(), and m_components.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ SortByReference()

void NETLIST::SortByReference ( )

Definition at line 199 of file pcb_netlist.cpp.

200 {
201  m_components.sort();
202 }
COMPONENTS m_components
Definition: pcb_netlist.h:196

References m_components.

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

Member Data Documentation

◆ m_components

◆ m_findByTimeStamp

bool NETLIST::m_findByTimeStamp
private

Definition at line 198 of file pcb_netlist.h.

Referenced by IsFindByTimeStamp(), and SetFindByTimeStamp().

◆ m_replaceFootprints

bool NETLIST::m_replaceFootprints
private

Definition at line 199 of file pcb_netlist.h.

Referenced by GetReplaceFootprints(), and SetReplaceFootprints().


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