KiCad PCB EDA Suite
|
#include <symbol_async_loader.h>
Public Types | |
typedef std::pair< wxString, std::vector< LIB_SYMBOL * > > | LOADED_PAIR |
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) | |
Constructs a loader for symbol libraries. | |
~SYMBOL_ASYNC_LOADER () | |
void | Start () |
Spins up threads to load all the libraries in m_nicknames. | |
bool | Join () |
Finalizes the threads and combines the output into the target output map. | |
bool | Done () |
Returns a string containing any errors generated during the load. | |
const wxString & | GetErrors () const |
Represents a pair of <nickname, loaded parts list> | |
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 |
Handle to the symbol library table being loaded into. | |
SYMBOL_LIB_TABLE * | m_table |
True if we are loading only power symbols. | |
bool | m_onlyPowerSymbols |
Handle to map that will be filled with the loaded parts per library. | |
std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > * | m_output |
Progress reporter (may be null) | |
PROGRESS_REPORTER * | m_reporter |
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 |
Definition at line 72 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 |
||
) |
Constructs 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 repord 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 | ( | ) |
Returns a string containing any errors generated during the load.
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 |
Represents a pair of <nickname, loaded parts list>
Definition at line 69 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 | ( | ) |
Finalizes the threads and combines the output into the target output map.
Return true if loading is done
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 | ( | ) |
Spins 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>
list of libraries to load
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 96 of file symbol_async_loader.h.
Referenced by worker().
|
private |
Definition at line 95 of file symbol_async_loader.h.
Referenced by GetErrors(), and worker().
|
private |
Definition at line 94 of file symbol_async_loader.h.
|
private |
Handle to the symbol library table being loaded into.
Definition at line 79 of file symbol_async_loader.h.
|
private |
Handle to map that will be filled with the loaded parts per library.
Definition at line 85 of file symbol_async_loader.h.
|
private |
Progress reporter (may be null)
Definition at line 88 of file symbol_async_loader.h.
Referenced by Join().
|
private |
Definition at line 91 of file symbol_async_loader.h.
Referenced by worker().
|
private |
Definition at line 98 of file symbol_async_loader.h.
Referenced by Join(), Start(), and SYMBOL_ASYNC_LOADER().
|
private |
True if we are loading only power symbols.
Definition at line 82 of file symbol_async_loader.h.
Referenced by SYMBOL_ASYNC_LOADER(), and worker().
|
private |
Definition at line 93 of file symbol_async_loader.h.
Referenced by Join(), Start(), and SYMBOL_ASYNC_LOADER().