33#include <wx/txtstrm.h>
34#include <wx/wfstream.h>
48 m_doc = design_block->GetLibDescription();
63 m_errors.move_push( std::make_unique<IO_ERROR>( ioe ) );
66 catch(
const std::exception& se )
76 m_errors.move_push( std::make_unique<IO_ERROR>( ioe ) );
87 const wxString* aNickname,
90 long long int generatedTimestamp = 0;
154 size_t num_elements =
m_queue.size();
155 std::vector<std::future<size_t>> returns( num_elements );
158 [
this, &queue_parsed ]() ->
size_t
165 wxArrayString dbnames;
170 m_lib_table->DesignBlockEnumerate( dbnames, nickname,
false );
173 for( wxString dbname : dbnames )
179 queue_parsed.
move_push( std::unique_ptr<DESIGN_BLOCK_INFO>( dbinfo ) );
192 for(
size_t ii = 0; ii < num_elements; ++ii )
193 returns[ii] =
tp.submit_task( db_thread );
195 for(
const std::future<size_t>& ret : returns )
197 std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
199 while( status != std::future_status::ready )
204 status = ret.wait_for( std::chrono::milliseconds( 250 ) );
208 std::unique_ptr<DESIGN_BLOCK_INFO> dbi;
210 while( queue_parsed.
pop( dbi ) )
211 m_list.push_back( std::move( dbi ) );
214 []( std::unique_ptr<DESIGN_BLOCK_INFO>
const& lhs,
215 std::unique_ptr<DESIGN_BLOCK_INFO>
const& rhs ) ->
bool
virtual void load() override
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
DESIGN_BLOCK_LIST * m_owner
provides access to DESIGN_BLOCK_LIB_TABLE
wxString m_nickname
library as known in DESIGN_BLOCK_LIB_TABLE
wxString m_dbname
Module name.
wxString m_keywords
Design block keywords.
wxString m_doc
Design block description.
long long GenerateTimestamp(const wxString *aNickname)
Generate a hashed timestamp representing the last-mod-times of the library indicated by aNickname,...
const DESIGN_BLOCK * GetEnumeratedDesignBlock(const wxString &aNickname, const wxString &aDesignBlockName)
A version of DesignBlockLoad() for use after DesignBlockEnumerate() for more efficient cache manageme...
std::atomic_bool m_cancelled
bool CatchErrors(const std::function< void()> &aFunc)
Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors.
PROGRESS_REPORTER * m_progress_reporter
long long m_list_timestamp
bool ReadDesignBlockFiles(DESIGN_BLOCK_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Read all the design blocks provided by the combination of aTable and aNickname.
SYNC_QUEUE< wxString > m_queue
SYNC_QUEUE< std::unique_ptr< IO_ERROR > > m_errors
some can be PARSE_ERRORs also
std::vector< std::unique_ptr< DESIGN_BLOCK_INFO > > m_list
DESIGN_BLOCK_LIB_TABLE * m_lib_table
no ownership
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
RAII class to safely set/reset nil KIIDs for use in footprint/symbol loading.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
A progress reporter interface for use in multi-threaded environments.
Synchronized, locking queue.
bool pop(T &aReceiver)
Pop a value if the queue into the provided variable.
void move_push(T &&aValue)
Move a value onto the queue.
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
BS::thread_pool< 0 > thread_pool
Definition of file extensions used in Kicad.