KiCad PCB EDA Suite
NETLIST Class Reference

Store 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
 
void Clear ()
 Remove all components from the netlist. More...
 
unsigned GetCount () const
 
COMPONENTGetComponent (unsigned aIndex)
 Return the COMPONENT at aIndex. More...
 
void AddComponent (COMPONENT *aComponent)
 Add aComponent to the NETLIST. More...
 
COMPONENTGetComponentByReference (const wxString &aReference)
 Return a COMPONENT by aReference. More...
 
COMPONENTGetComponentByPath (const KIID_PATH &aPath)
 Return 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
 
void Format (const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
 
void FormatCvpcbNetlist (OUTPUTFORMATTER *aOut)
 

Private Attributes

COMPONENTS m_components
 
bool m_findByTimeStamp
 
bool m_replaceFootprints
 

Detailed Description

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

215 :
216 m_findByTimeStamp( false ),
217 m_replaceFootprints( false )
218 {
219 }
bool m_findByTimeStamp
Definition: pcb_netlist.h:301
bool m_replaceFootprints
Definition: pcb_netlist.h:302

Member Function Documentation

◆ AddComponent()

void NETLIST::AddComponent ( COMPONENT aComponent)

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

146{
147 m_components.push_back( aComponent );
148}
COMPONENTS m_components
Definition: pcb_netlist.h:299

References m_components.

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

◆ AnyFootprintsLinked()

bool NETLIST::AnyFootprintsLinked ( ) const
Returns
true if any component with a footprint link is found.

Definition at line 224 of file pcb_netlist.cpp.

225{
226 for( unsigned i = 0; i < m_components.size(); i++ )
227 {
228 if( !m_components[i].GetFPID().empty() )
229 return true;
230 }
231
232 return false;
233}
static bool empty(const wxTextEntryBase *aCtrl)

References empty(), and m_components.

Referenced by CVPCB_MAINFRAME::readNetListAndFpFiles().

◆ Clear()

void NETLIST::Clear ( )
inline

Remove all components from the netlist.

Definition at line 229 of file pcb_netlist.h.

229{ m_components.clear(); }

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

131{
132 int nl = aNestLevel;
133
134 aOut->Print( nl, "(%s\n", aDocName );
135
136 for( unsigned i = 0; i < m_components.size(); i++ )
137 {
138 m_components[i].Format( aOut, nl+1, aCtl );
139 }
140
141 aOut->Print( nl, ")\n" );
142}
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:431

References m_components, and OUTPUTFORMATTER::Print().

Referenced by FormatCvpcbNetlist().

◆ FormatCvpcbNetlist()

void NETLIST::FormatCvpcbNetlist ( OUTPUTFORMATTER aOut)
inline

Definition at line 293 of file pcb_netlist.h.

294 {
295 Format( "cvpcb_netlist", aOut, 0, CTL_FOR_CVPCB );
296 }
void Format(const char *aDocName, OUTPUTFORMATTER *aOut, int aNestLevel, int aCtl=0)
#define CTL_FOR_CVPCB
Definition: pcb_netlist.h:291

References CTL_FOR_CVPCB, and Format().

Referenced by CVPCB_MAINFRAME::SaveFootprintAssociation().

◆ GetComponent()

◆ GetComponentByPath()

COMPONENT * NETLIST::GetComponentByPath ( const KIID_PATH aPath)

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

169{
170 if( aUuidPath.empty() )
171 return nullptr;
172
173 KIID comp_uuid = aUuidPath.back();
174 KIID_PATH base = aUuidPath;
175
176 if( !base.empty() )
177 base.pop_back();
178
179 for( COMPONENT& component : m_components )
180 {
181 const std::vector<KIID>& kiids = component.GetKIIDs();
182
183 if( base != component.GetPath() )
184 continue;
185
186 if( std::find( kiids.begin(), kiids.end(), comp_uuid ) != kiids.end() )
187 return &component;
188 }
189
190 return nullptr;
191}
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
Definition: kiid.h:48

References m_components.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ GetComponentByReference()

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

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

152{
153 COMPONENT* component = nullptr;
154
155 for( unsigned i = 0; i < m_components.size(); i++ )
156 {
157 if( m_components[i].GetReference() == aReference )
158 {
159 component = &m_components[i];
160 break;
161 }
162 }
163
164 return component;
165}

References m_components.

Referenced by CMP_READER::Load(), LEGACY_NETLIST_READER::loadFootprintFilters(), KICAD_NETLIST_PARSER::parseNet(), DRC_TEST_PROVIDER_SCHEMATIC_PARITY::testNetlist(), and BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ GetCount()

◆ GetReplaceFootprints()

bool NETLIST::GetReplaceFootprints ( ) const
inline

Definition at line 277 of file pcb_netlist.h.

277{ return m_replaceFootprints; }

References m_replaceFootprints.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ IsEmpty()

bool NETLIST::IsEmpty ( ) const
inline

◆ IsFindByTimeStamp()

bool NETLIST::IsFindByTimeStamp ( ) const
inline

Definition at line 274 of file pcb_netlist.h.

274{ return m_findByTimeStamp; }

References m_findByTimeStamp.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ SetFindByTimeStamp()

void NETLIST::SetFindByTimeStamp ( bool  aFindByTimeStamp)
inline

Definition at line 273 of file pcb_netlist.h.

273{ m_findByTimeStamp = aFindByTimeStamp; }

References m_findByTimeStamp.

Referenced by DIALOG_UPDATE_PCB::PerformUpdate().

◆ SetReplaceFootprints()

void NETLIST::SetReplaceFootprints ( bool  aReplace)
inline

Definition at line 276 of file pcb_netlist.h.

276{ m_replaceFootprints = aReplace; }

References m_replaceFootprints.

Referenced by DIALOG_UPDATE_PCB::PerformUpdate().

◆ SortByFPID()

void NETLIST::SortByFPID ( )

Definition at line 203 of file pcb_netlist.cpp.

204{
205 m_components.sort( ByFPID );
206}
static bool ByFPID(const COMPONENT &ref, const COMPONENT &cmp)
A helper function used to sort the component list used by loadNewModules.

References ByFPID(), and m_components.

Referenced by PCB_EDIT_FRAME::LoadFootprints().

◆ SortByReference()

void NETLIST::SortByReference ( )

Definition at line 218 of file pcb_netlist.cpp.

219{
220 m_components.sort();
221}

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

Referenced by IsFindByTimeStamp(), and SetFindByTimeStamp().

◆ m_replaceFootprints

bool NETLIST::m_replaceFootprints
private

Definition at line 302 of file pcb_netlist.h.

Referenced by GetReplaceFootprints(), and SetReplaceFootprints().


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