KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FOOTPRINT_LIST_IMPL Class Reference

#include <footprint_info_impl.h>

Inheritance diagram for FOOTPRINT_LIST_IMPL:
FOOTPRINT_LIST

Public Types

typedef std::vector< std::unique_ptr< FOOTPRINT_INFO > > FPILIST
 
typedef SYNC_QUEUE< std::unique_ptr< IO_ERROR > > ERRLIST
 

Public Member Functions

 FOOTPRINT_LIST_IMPL ()
 
virtual ~FOOTPRINT_LIST_IMPL ()
 
void WriteCacheToFile (const wxString &aFilePath) override
 
void ReadCacheFromFile (const wxString &aFilePath) override
 
bool ReadFootprintFiles (FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
 Read all the footprints provided by the combination of aTable and aNickname. More...
 
unsigned GetCount () const
 
const FPILISTGetList () const
 Was forced to add this by modview_frame.cpp. More...
 
void Clear ()
 
FOOTPRINT_INFOGetFootprintInfo (const wxString &aFootprintName)
 Get info for a footprint by id. More...
 
FOOTPRINT_INFOGetFootprintInfo (const wxString &aLibNickname, const wxString &aFootprintName)
 Get info for a footprint by libNickname/footprintName. More...
 
FOOTPRINT_INFOGetItem (unsigned aIdx) const
 Get info for a footprint by index. More...
 
unsigned GetErrorCount () const
 
std::unique_ptr< IO_ERRORPopError ()
 
void DisplayErrors (wxTopLevelWindow *aCaller=nullptr)
 
FP_LIB_TABLEGetTable () const
 

Static Public Member Functions

static FOOTPRINT_LISTGetInstance (KIWAY &aKiway)
 Factory function to return a FOOTPRINT_LIST via Kiway. More...
 

Protected Member Functions

void loadLibs ()
 
void loadFootprints ()
 

Protected Attributes

FP_LIB_TABLEm_lib_table
 no ownership More...
 
FPILIST m_list
 
ERRLIST m_errors
 some can be PARSE_ERRORs also More...
 

Private Member Functions

bool CatchErrors (const std::function< void()> &aFunc)
 Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors. More...
 

Private Attributes

SYNC_QUEUE< wxString > m_queue_in
 
SYNC_QUEUE< wxString > m_queue_out
 
long long m_list_timestamp
 
PROGRESS_REPORTERm_progress_reporter
 
std::atomic_bool m_cancelled
 
std::mutex m_join
 

Detailed Description

Definition at line 84 of file footprint_info_impl.h.

Member Typedef Documentation

◆ ERRLIST

typedef SYNC_QUEUE<std::unique_ptr<IO_ERROR> > FOOTPRINT_LIST::ERRLIST
inherited

Definition at line 164 of file footprint_info.h.

◆ FPILIST

typedef std::vector<std::unique_ptr<FOOTPRINT_INFO> > FOOTPRINT_LIST::FPILIST
inherited

Definition at line 163 of file footprint_info.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_LIST_IMPL()

FOOTPRINT_LIST_IMPL::FOOTPRINT_LIST_IMPL ( )

Definition at line 301 of file footprint_info_impl.cpp.

◆ ~FOOTPRINT_LIST_IMPL()

virtual FOOTPRINT_LIST_IMPL::~FOOTPRINT_LIST_IMPL ( )
inlinevirtual

Definition at line 88 of file footprint_info_impl.h.

Member Function Documentation

◆ CatchErrors()

bool FOOTPRINT_LIST_IMPL::CatchErrors ( const std::function< void()> &  aFunc)
private

Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors.

Returns
true if no error occurred.

Definition at line 69 of file footprint_info_impl.cpp.

References FOOTPRINT_LIST::m_errors, SYNC_QUEUE< T >::move_push(), and THROW_IO_ERROR.

Referenced by loadFootprints(), loadLibs(), and ReadFootprintFiles().

◆ Clear()

void FOOTPRINT_LIST::Clear ( )
inlineinherited
Returns
Clears the footprint info cache

Definition at line 194 of file footprint_info.h.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ DisplayErrors()

void FOOTPRINT_LIST::DisplayErrors ( wxTopLevelWindow *  aCaller = nullptr)
inherited

◆ GetCount()

◆ GetErrorCount()

unsigned FOOTPRINT_LIST::GetErrorCount ( ) const
inlineinherited

◆ GetFootprintInfo() [1/2]

◆ GetFootprintInfo() [2/2]

FOOTPRINT_INFO * FOOTPRINT_LIST::GetFootprintInfo ( const wxString &  aLibNickname,
const wxString &  aFootprintName 
)
inherited

Get info for a footprint by libNickname/footprintName.

Definition at line 43 of file footprint_info.cpp.

References FOOTPRINT_LIST::m_list.

◆ GetInstance()

FOOTPRINT_LIST * FOOTPRINT_LIST::GetInstance ( KIWAY aKiway)
staticinherited

Factory function to return a FOOTPRINT_LIST via Kiway.

This is not guaranteed to succeed and will return null if the kiface is not available.

Parameters
aKiwayactive kiway instance.

Definition at line 163 of file footprint_info.cpp.

References get_instance_from_id(), FOOTPRINT_LIST::GetCount(), PROJECT::GetProjectPath(), KIFACE_FOOTPRINT_LIST, KIWAY::Prj(), and FOOTPRINT_LIST::ReadCacheFromFile().

Referenced by PANEL_SYMBOL_CHOOSER::constructRightPanel(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), FOOTPRINT_SELECT_WIDGET::Load(), and FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList().

◆ GetItem()

FOOTPRINT_INFO & FOOTPRINT_LIST::GetItem ( unsigned  aIdx) const
inlineinherited

Get info for a footprint by index.

Parameters
aIdxindex of the given item.
Returns
the aIdx item in list.

Definition at line 216 of file footprint_info.h.

Referenced by FOOTPRINT_FILTER::ITERATOR::increment().

◆ GetList()

const FPILIST & FOOTPRINT_LIST::GetList ( ) const
inlineinherited

Was forced to add this by modview_frame.cpp.

Definition at line 186 of file footprint_info.h.

Referenced by FP_TREE_MODEL_ADAPTER::getFootprints().

◆ GetTable()

FP_LIB_TABLE * FOOTPRINT_LIST::GetTable ( ) const
inlineinherited

Definition at line 251 of file footprint_info.h.

Referenced by FOOTPRINT_INFO_IMPL::load().

◆ loadFootprints()

◆ loadLibs()

◆ PopError()

std::unique_ptr< IO_ERROR > FOOTPRINT_LIST::PopError ( )
inlineinherited

Definition at line 226 of file footprint_info.h.

Referenced by FOOTPRINT_LIST::DisplayErrors().

◆ ReadCacheFromFile()

void FOOTPRINT_LIST_IMPL::ReadCacheFromFile ( const wxString &  aFilePath)
overridevirtual

◆ ReadFootprintFiles()

bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles ( FP_LIB_TABLE aTable,
const wxString *  aNickname = nullptr,
PROGRESS_REPORTER aProgressReporter = nullptr 
)
overridevirtual

Read all the footprints provided by the combination of aTable and aNickname.

Parameters
aTabledefines all the libraries.
aNicknameis the library to read from, or if NULL means read all footprints from all known libraries in aTable.
aProgressReporteris an optional progress reporter. ReadFootprintFiles() will use 2 phases within the reporter.
Returns
true if it ran to completion, else false if it aborted after some number of errors. If true, it does not mean there were no errors, check GetErrorCount() for that, should be zero to indicate success.

Implements FOOTPRINT_LIST.

Definition at line 100 of file footprint_info_impl.cpp.

References _, PROGRESS_REPORTER::AdvancePhase(), CatchErrors(), SYNC_QUEUE< T >::clear(), SYNC_QUEUE< T >::empty(), FP_LIB_TABLE::GenerateTimestamp(), LIB_TABLE::GetLogicalLibs(), loadFootprints(), loadLibs(), m_cancelled, FOOTPRINT_LIST::m_errors, FOOTPRINT_LIST::m_lib_table, FOOTPRINT_LIST::m_list, m_list_timestamp, m_progress_reporter, m_queue_in, m_queue_out, SYNC_QUEUE< T >::push(), PROGRESS_REPORTER::Report(), PROGRESS_REPORTER::SetMaxProgress(), and SYNC_QUEUE< T >::size().

Referenced by FOOTPRINT_EDIT_FRAME::initLibraryTree(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), and FOOTPRINT_EDIT_FRAME::SyncLibraryTree().

◆ WriteCacheToFile()

void FOOTPRINT_LIST_IMPL::WriteCacheToFile ( const wxString &  aFilePath)
overridevirtual

Member Data Documentation

◆ m_cancelled

std::atomic_bool FOOTPRINT_LIST_IMPL::m_cancelled
private

Definition at line 112 of file footprint_info_impl.h.

Referenced by loadFootprints(), loadLibs(), and ReadFootprintFiles().

◆ m_errors

ERRLIST FOOTPRINT_LIST::m_errors
protectedinherited

some can be PARSE_ERRORs also

Definition at line 269 of file footprint_info.h.

Referenced by CatchErrors(), and ReadFootprintFiles().

◆ m_join

std::mutex FOOTPRINT_LIST_IMPL::m_join
private

Definition at line 113 of file footprint_info_impl.h.

◆ m_lib_table

FP_LIB_TABLE* FOOTPRINT_LIST::m_lib_table
protectedinherited

no ownership

Definition at line 266 of file footprint_info.h.

Referenced by loadFootprints(), loadLibs(), and ReadFootprintFiles().

◆ m_list

◆ m_list_timestamp

long long FOOTPRINT_LIST_IMPL::m_list_timestamp
private

Definition at line 110 of file footprint_info_impl.h.

Referenced by ReadCacheFromFile(), ReadFootprintFiles(), and WriteCacheToFile().

◆ m_progress_reporter

PROGRESS_REPORTER* FOOTPRINT_LIST_IMPL::m_progress_reporter
private

Definition at line 111 of file footprint_info_impl.h.

Referenced by loadFootprints(), loadLibs(), and ReadFootprintFiles().

◆ m_queue_in

SYNC_QUEUE<wxString> FOOTPRINT_LIST_IMPL::m_queue_in
private

Definition at line 108 of file footprint_info_impl.h.

Referenced by loadLibs(), and ReadFootprintFiles().

◆ m_queue_out

SYNC_QUEUE<wxString> FOOTPRINT_LIST_IMPL::m_queue_out
private

Definition at line 109 of file footprint_info_impl.h.

Referenced by loadFootprints(), loadLibs(), and ReadFootprintFiles().


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