KiCad PCB EDA Suite
|
#include <symbol_async_loader.h>
Public Types | |
typedef std::pair< wxString, std::vector< LIB_SYMBOL * > > | LOADED_PAIR |
Represent a pair of <nickname, loaded parts list>. | |
Public Member Functions | |
SYMBOL_ASYNC_LOADER (const std::vector< wxString > &aNicknames, SYMBOL_LIB_TABLE *aTable, bool aOnlyPowerSymbols=false, std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > *aOutput=nullptr, PROGRESS_REPORTER *aReporter=nullptr) | |
Construct a loader for symbol libraries. | |
~SYMBOL_ASYNC_LOADER () | |
void | Start () |
Spin up threads to load all the libraries in m_nicknames. | |
bool | Join () |
Finalize the threads and combines the output into the target output map. | |
bool | Done () |
const wxString & | GetErrors () const |
Private Member Functions | |
std::vector< LOADED_PAIR > | worker () |
Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>. | |
Private Attributes | |
std::vector< wxString > | m_nicknames |
List of libraries to load. | |
SYMBOL_LIB_TABLE * | m_table |
Handle to the symbol library table being loaded into. | |
bool | m_onlyPowerSymbols |
True if we are loading only power symbols. | |
std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > * | m_output |
Handle to map that will be filled with the loaded parts per library. | |
PROGRESS_REPORTER * | m_reporter |
Progress reporter (may be null). | |
size_t | m_threadCount |
std::atomic< size_t > | m_nextLibrary |
wxString | m_errors |
std::mutex | m_errorMutex |
std::vector< std::future< std::vector< LOADED_PAIR > > > | m_returns |
Definition at line 37 of file symbol_async_loader.h.
typedef std::pair<wxString, std::vector<LIB_SYMBOL*> > SYMBOL_ASYNC_LOADER::LOADED_PAIR |
Represent a pair of <nickname, loaded parts list>.
Definition at line 73 of file symbol_async_loader.h.
SYMBOL_ASYNC_LOADER::SYMBOL_ASYNC_LOADER | ( | const std::vector< wxString > & | aNicknames, |
SYMBOL_LIB_TABLE * | aTable, | ||
bool | aOnlyPowerSymbols = false , |
||
std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > * | aOutput = nullptr , |
||
PROGRESS_REPORTER * | aReporter = nullptr |
||
) |
Construct a loader for symbol libraries.
aNicknames | is a list of library nicknames to load. |
aTable | is a pointer to the symbol library table to load libraries for. |
aOnlyPowerSymbols,if | true, will only return power symbols in the output map. |
aOutput | will be filled with the loaded parts. |
aReporter | will be used to report progress, of not null. |
Definition at line 29 of file symbol_async_loader.cpp.
References m_returns, m_table, and m_threadCount.
SYMBOL_ASYNC_LOADER::~SYMBOL_ASYNC_LOADER | ( | ) |
Definition at line 48 of file symbol_async_loader.cpp.
References Join().
bool SYMBOL_ASYNC_LOADER::Done | ( | ) |
Definition at line 90 of file symbol_async_loader.cpp.
References m_nextLibrary, and m_nicknames.
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_VIEWER_FRAME::loadAllLibraries(), and SYMBOL_LIBRARY_MANAGER::Preload().
|
inline |
Definition at line 70 of file symbol_async_loader.h.
References m_errors.
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_VIEWER_FRAME::loadAllLibraries(), and SYMBOL_LIBRARY_MANAGER::Preload().
bool SYMBOL_ASYNC_LOADER::Join | ( | ) |
Finalize the threads and combines the output into the target output map.
Definition at line 61 of file symbol_async_loader.cpp.
References m_onlyPowerSymbols, m_output, m_returns, and m_threadCount.
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_VIEWER_FRAME::loadAllLibraries(), SYMBOL_LIBRARY_MANAGER::Preload(), and ~SYMBOL_ASYNC_LOADER().
void SYMBOL_ASYNC_LOADER::Start | ( | ) |
Spin up threads to load all the libraries in m_nicknames.
Definition at line 54 of file symbol_async_loader.cpp.
References m_returns, m_threadCount, and worker().
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_VIEWER_FRAME::loadAllLibraries(), and SYMBOL_LIBRARY_MANAGER::Preload().
|
private |
Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>.
Definition at line 96 of file symbol_async_loader.cpp.
References _, PROGRESS_REPORTER::AdvancePhase(), PROGRESS_REPORTER::IsCancelled(), SYMBOL_LIB_TABLE::LoadSymbolLib(), m_errorMutex, m_errors, m_nextLibrary, m_nicknames, m_onlyPowerSymbols, m_reporter, m_table, and IO_ERROR::What().
Referenced by Start().
|
private |
Definition at line 97 of file symbol_async_loader.h.
Referenced by worker().
|
private |
Definition at line 96 of file symbol_async_loader.h.
Referenced by GetErrors(), and worker().
|
private |
Definition at line 95 of file symbol_async_loader.h.
|
private |
List of libraries to load.
Definition at line 80 of file symbol_async_loader.h.
|
private |
True if we are loading only power symbols.
Definition at line 86 of file symbol_async_loader.h.
|
private |
Handle to map that will be filled with the loaded parts per library.
Definition at line 89 of file symbol_async_loader.h.
Referenced by Join().
|
private |
Progress reporter (may be null).
Definition at line 92 of file symbol_async_loader.h.
Referenced by worker().
|
private |
Definition at line 99 of file symbol_async_loader.h.
Referenced by Join(), Start(), and SYMBOL_ASYNC_LOADER().
|
private |
Handle to the symbol library table being loaded into.
Definition at line 83 of file symbol_async_loader.h.
Referenced by SYMBOL_ASYNC_LOADER(), and worker().
|
private |
Definition at line 94 of file symbol_async_loader.h.
Referenced by Join(), Start(), and SYMBOL_ASYNC_LOADER().