KiCad PCB EDA Suite
NETLIST Class Reference

Class 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...
 
COMPONENTGetComponentByTimeStamp (const wxString &aTimeStamp)
 Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp. 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

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

Definition at line 214 of file pcb_netlist.h.

Constructor & Destructor Documentation

NETLIST::NETLIST ( )
inline

Definition at line 232 of file pcb_netlist.h.

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

Member Function Documentation

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.

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

139 {
140  m_components.push_back( aComponent );
141 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:216
bool NETLIST::AllFootprintsLinked ( ) const

Function AllFootprintsLinked.

Returns
true if all components have a footprint link.

Definition at line 222 of file pcb_netlist.cpp.

References i.

223 {
224  for( unsigned i = 0; i < m_components.size(); i++ )
225  {
226  if( m_components[i].GetFPID().empty() )
227  return false;
228  }
229 
230  return true;
231 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:216
size_t i
Definition: json11.cpp:597
bool NETLIST::AnyFootprintsChanged ( ) const

Function AnyFootprintsChanged.

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

Function AnyFootprintsLinked.

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

Definition at line 210 of file pcb_netlist.cpp.

References i.

Referenced by CVPCB_MAINFRAME::ReadNetListAndFpFiles().

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

Function Clear removes all components from the netlist.

Definition at line 250 of file pcb_netlist.h.

Referenced by CVPCB_MAINFRAME::ReadSchematicNetlist().

250 { m_components.clear(); }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:216
void NETLIST::Format ( const char *  aDocName,
OUTPUTFORMATTER aOut,
int  aNestLevel,
int  aCtl = 0 
)

Definition at line 123 of file pcb_netlist.cpp.

References i, and OUTPUTFORMATTER::Print().

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
Components found in the netlist.
Definition: pcb_netlist.h:216
size_t i
Definition: json11.cpp:597
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
void NETLIST::FormatBackAnnotation ( OUTPUTFORMATTER aOut)
inline

Definition at line 355 of file pcb_netlist.h.

References CTL_FOR_BACKANNO, and COMPONENT_NET::Format().

Referenced by CVPCB_MAINFRAME::SaveFootprintAssociation().

356  {
357  Format( "back_annotation", aOut, 0, CTL_FOR_BACKANNO );
358  }
void Format(const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
#define CTL_FOR_BACKANNO
Definition: pcb_netlist.h:353
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.

References i.

Referenced by BOARD_NETLIST_UPDATER::deleteUnusedComponents(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadFootprintFilters(), KICAD_NETLIST_PARSER::parseNet(), BOARD::ReplaceNetlist(), and DIALOG_NETLIST::verifyFootprints().

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
Components found in the netlist.
Definition: pcb_netlist.h:216
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
size_t i
Definition: json11.cpp:597
COMPONENT * NETLIST::GetComponentByTimeStamp ( const wxString &  aTimeStamp)

Function GetComponentByTimeStamp returns a COMPONENT by aTimeStamp.

Parameters
aTimeStampis the time stamp the COMPONENT.
Returns
a pointer to the COMPONENT that matches aTimeStamp if found. Otherwise NULL.

Definition at line 161 of file pcb_netlist.cpp.

References i.

Referenced by BOARD_NETLIST_UPDATER::deleteUnusedComponents(), and BOARD::ReplaceNetlist().

162 {
163  COMPONENT* component = NULL;
164 
165  for( unsigned i = 0; i < m_components.size(); i++ )
166  {
167  if( m_components[i].GetTimeStamp() == aTimeStamp )
168  {
169  component = &m_components[i];
170  break;
171  }
172  }
173 
174  return component;
175 }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:216
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
size_t i
Definition: json11.cpp:597
bool NETLIST::GetDeleteExtraFootprints ( ) const
inline

Definition at line 305 of file pcb_netlist.h.

Referenced by BOARD::ReplaceNetlist().

305 { return m_deleteExtraFootprints; }
bool m_deleteExtraFootprints
Remove footprints from BOARD not found in netlist when true.
Definition: pcb_netlist.h:219
bool NETLIST::GetReplaceFootprints ( ) const
inline

Definition at line 320 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::LoadFootprints(), and BOARD::ReplaceNetlist().

320 { return m_replaceFootprints; }
bool m_replaceFootprints
Replace component footprints when they differ from the netlist if true.
Definition: pcb_netlist.h:229
bool NETLIST::IsDryRun ( ) const
inline

Definition at line 309 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::ReadPcbNetlist(), and BOARD::ReplaceNetlist().

309 { return m_isDryRun; }
bool m_isDryRun
Do not actually make any changes.
Definition: pcb_netlist.h:223
bool NETLIST::IsEmpty ( ) const
inline

Function IsEmpty()

Returns
true if there are no components in the netlist.

Definition at line 244 of file pcb_netlist.h.

Referenced by CVPCB_MAINFRAME::AutomaticFootprintMatching(), PCB_EDIT_FRAME::LoadFootprints(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), CVPCB_MAINFRAME::SetNewPkg(), CVPCB_MAINFRAME::ToFirstNA(), and CVPCB_MAINFRAME::ToPreviousNA().

244 { return m_components.empty(); }
COMPONENTS m_components
Components found in the netlist.
Definition: pcb_netlist.h:216
bool NETLIST::IsFindByTimeStamp ( ) const
inline

Definition at line 313 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::LoadFootprints(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

313 { return m_findByTimeStamp; }
bool m_findByTimeStamp
Find component by time stamp if true or reference designator if false.
Definition: pcb_netlist.h:226
bool NETLIST::NoFootprintsLinked ( ) const
inline

Function NoFootprintsLinked.

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

Definition at line 338 of file pcb_netlist.h.

References COMPONENT_NET::Format().

338 { return !AnyFootprintsLinked(); }
bool AnyFootprintsLinked() const
Function AnyFootprintsLinked.
void NETLIST::SetDeleteExtraFootprints ( bool  aDeleteExtraFootprints)
inline

Definition at line 300 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), DIALOG_UPDATE_PCB::PerformUpdate(), and PCB_EDIT_FRAME::ReadPcbNetlist().

301  {
302  m_deleteExtraFootprints = aDeleteExtraFootprints;
303  }
bool m_deleteExtraFootprints
Remove footprints from BOARD not found in netlist when true.
Definition: pcb_netlist.h:219
void NETLIST::SetFindByTimeStamp ( bool  aFindByTimeStamp)
inline

Definition at line 311 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), DIALOG_UPDATE_PCB::PerformUpdate(), and PCB_EDIT_FRAME::ReadPcbNetlist().

311 { m_findByTimeStamp = aFindByTimeStamp; }
bool m_findByTimeStamp
Find component by time stamp if true or reference designator if false.
Definition: pcb_netlist.h:226
void NETLIST::SetIsDryRun ( bool  aIsDryRun)
inline

Definition at line 307 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::ReadPcbNetlist().

307 { m_isDryRun = aIsDryRun; }
bool m_isDryRun
Do not actually make any changes.
Definition: pcb_netlist.h:223
void NETLIST::SetReplaceFootprints ( bool  aReplaceFootprints)
inline

Definition at line 315 of file pcb_netlist.h.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), DIALOG_UPDATE_PCB::PerformUpdate(), and PCB_EDIT_FRAME::ReadPcbNetlist().

316  {
317  m_replaceFootprints = aReplaceFootprints;
318  }
bool m_replaceFootprints
Replace component footprints when they differ from the netlist if true.
Definition: pcb_netlist.h:229
void NETLIST::SortByFPID ( )

Definition at line 188 of file pcb_netlist.cpp.

References ByFPID().

Referenced by PCB_EDIT_FRAME::LoadFootprints().

189 {
190  m_components.sort( ByFPID );
191 }
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:216
void NETLIST::SortByReference ( )

Definition at line 204 of file pcb_netlist.cpp.

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

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

Member Data Documentation

COMPONENTS NETLIST::m_components
private

Components found in the netlist.

Definition at line 216 of file pcb_netlist.h.

bool NETLIST::m_deleteExtraFootprints
private

Remove footprints from BOARD not found in netlist when true.

Definition at line 219 of file pcb_netlist.h.

bool NETLIST::m_findByTimeStamp
private

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

Definition at line 226 of file pcb_netlist.h.

bool NETLIST::m_isDryRun
private

Do not actually make any changes.

Only report changes to BOARD from netlist when true.

Definition at line 223 of file pcb_netlist.h.

bool NETLIST::m_replaceFootprints
private

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

Definition at line 229 of file pcb_netlist.h.


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