31 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* aOutput,
33 m_nicknames( aNicknames ),
35 m_onlyPowerSymbols( aOnlyPowerSymbols ),
37 m_reporter( aReporter ),
41 m_threadCount = std::max<size_t>( 1, std::thread::hardware_concurrency() );
70 const std::vector<LOADED_PAIR>& ret =
m_returns[ii].get();
98 std::vector<LOADED_PAIR> ret;
105 const wxString& nickname =
m_nicknames[libraryIndex];
118 ret.emplace_back( std::move( pair ) );
122 wxString msg = wxString::Format(
_(
"Error loading symbol library %s.\n\n%s\n" ),
123 nickname, ioe.
What() );
128 catch( std::exception& e )
130 wxString msg = wxString::Format(
_(
"Error loading symbol library %s.\n\n%s\n" ),
131 nickname, e.what() );
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
A progress reporter interface for use in multi-threaded environments.
virtual bool IsCancelled() const =0
virtual void AdvancePhase()=0
Use the next available virtual zone of the dialog progress bar.
std::vector< LOADED_PAIR > worker()
< Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>
bool Done()
Returns a string containing any errors generated during the load.
std::vector< std::future< std::vector< LOADED_PAIR > > > m_returns
void Start()
Spins up threads to load all the libraries in m_nicknames.
std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > * m_output
Progress reporter (may be null)
bool m_onlyPowerSymbols
Handle to map that will be filled with the loaded parts per library.
bool Join()
Finalizes the threads and combines the output into the target output map.
SYMBOL_LIB_TABLE * m_table
True if we are loading only power symbols.
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.
PROGRESS_REPORTER * m_reporter
std::pair< wxString, std::vector< LIB_SYMBOL * > > LOADED_PAIR
std::vector< wxString > m_nicknames
Handle to the symbol library table being loaded into.
std::atomic< size_t > m_nextLibrary
void LoadSymbolLib(std::vector< LIB_SYMBOL * > &aAliasList, const wxString &aNickname, bool aPowerSymbolsOnly=false)