21 #ifndef KICAD_SYMBOL_ASYNC_LOADER_H 22 #define KICAD_SYMBOL_ASYNC_LOADER_H 27 #include <unordered_map> 30 #include <wx/string.h> 50 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* aOutput =
nullptr,
72 typedef std::pair<wxString, std::vector<LIB_SYMBOL*>>
LOADED_PAIR;
76 std::vector<LOADED_PAIR>
worker();
88 std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>*
m_output;
98 std::vector<std::future<std::vector<LOADED_PAIR>>>
m_returns;
bool m_onlyPowerSymbols
Handle to map that will be filled with the loaded parts per library.
void Start()
Spins up threads to load all the libraries in m_nicknames.
std::atomic< size_t > m_nextLibrary
bool Join()
Finalizes the threads and combines the output into the target output map.
A progress reporter interface for use in multi-threaded environments.
std::pair< wxString, std::vector< LIB_SYMBOL * > > LOADED_PAIR
Define a library symbol object.
bool Done()
Returns a string containing any errors generated during the load.
const wxString & GetErrors() const
Represents a pair of <nickname, loaded parts list>
std::unordered_map< wxString, std::vector< LIB_SYMBOL * > > * m_output
Progress reporter (may be null)
SYMBOL_LIB_TABLE * m_table
True if we are loading only power symbols.
std::vector< wxString > m_nicknames
Handle to the symbol library table being loaded into.
std::vector< LOADED_PAIR > worker()
< Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>
std::vector< std::future< std::vector< LOADED_PAIR > > > m_returns
PROGRESS_REPORTER * m_reporter
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.