KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DESIGN_BLOCK_LIBRARY_ADAPTER Class Reference

#include <design_block_library_adapter.h>

Inheritance diagram for DESIGN_BLOCK_LIBRARY_ADAPTER:
LIBRARY_MANAGER_ADAPTER

Public Types

enum  SAVE_T { SAVE_OK , SAVE_SKIPPED }
 The set of return values from DesignBlockSave() below. More...
 

Public Member Functions

 DESIGN_BLOCK_LIBRARY_ADAPTER (LIBRARY_MANAGER &aManager)
 
 ~DESIGN_BLOCK_LIBRARY_ADAPTER () override
 
LIBRARY_TABLE_TYPE Type () const override
 The type of library table this adapter works with.
 
std::optional< LIB_STATUS > LoadOne (LIB_DATA *aLib) override
 
std::optional< LIB_STATUS > LoadOne (const wxString &nickname)
 
std::vector< DESIGN_BLOCK * > GetDesignBlocks (const wxString &aNickname)
 
std::vector< wxString > GetDesignBlockNames (const wxString &aNickname)
 
DESIGN_BLOCK * LoadDesignBlock (const wxString &aNickname, const wxString &aDesignBlockName, bool aKeepUUID=false, wxString *aErrorMsg=nullptr)
 Load a design block having aDesignBlockName from the library given by aNickname.
 
bool DesignBlockExists (const wxString &aNickname, const wxString &aDesignBlockName)
 Indicates whether or not the given design block already exists in the given library.
 
const DESIGN_BLOCK * GetEnumeratedDesignBlock (const wxString &aNickname, const wxString &aDesignBlockName)
 A version of LoadDesignBlock() for use after enumerateLibrary() for more efficient cache management.
 
SAVE_T SaveDesignBlock (const wxString &aNickname, const DESIGN_BLOCK *aDesignBlock, bool aOverwrite=true)
 Write aDesignBlock to an existing library given by aNickname.
 
void DeleteDesignBlock (const wxString &aNickname, const wxString &aDesignBlockName)
 Delete the aDesignBlockName from the library given by aNickname.
 
bool IsDesignBlockLibWritable (const wxString &aNickname)
 Return true if the library given by aNickname is writable.
 
DESIGN_BLOCK * DesignBlockLoadWithOptionalNickname (const LIB_ID &aDesignBlockId, bool aKeepUUID=false, wxString *aErrorMsg=nullptr)
 Load a design block having aDesignBlockId with possibly an empty nickname.
 
LIBRARY_MANAGER & Manager () const
 
LIBRARY_TABLE * GlobalTable () const
 Retrieves the global library table for this adapter type.
 
std::optional< LIBRARY_TABLE * > ProjectTable () const
 Retrieves the project library table for this adapter type, or nullopt if one doesn't exist.
 
std::optional< wxString > FindLibraryByURI (const wxString &aURI) const
 
std::vector< wxString > GetLibraryNames () const
 Returns a list of library nicknames that are available (skips any that failed to load)
 
bool HasLibrary (const wxString &aNickname, bool aCheckEnabled=false) const
 Test for the existence of aNickname in the library tables.
 
bool DeleteLibrary (const wxString &aNickname)
 Deletes the given library from disk if it exists; returns true if deleted.
 
std::optional< wxString > GetLibraryDescription (const wxString &aNickname) const
 
std::vector< LIBRARY_TABLE_ROW * > Rows (LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH, bool aIncludeInvalid=false) const
 Like LIBRARY_MANAGER::Rows but filtered to the LIBRARY_TABLE_TYPE of this adapter.
 
std::optional< LIBRARY_TABLE_ROW * > GetRow (const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
 Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
 
std::optional< LIBRARY_TABLE_ROW * > FindRowByURI (const wxString &aUri, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
 Like LIBRARY_MANAGER::FindRowByURI but filtered to the LIBRARY_TABLE_TYPE of this adapter.
 
virtual void ProjectChanged ()
 Notify the adapter that the active project has changed.
 
void GlobalTablesChanged (std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables={})
 Notify the adapter that the global library tables have changed.
 
void ProjectTablesChanged (std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables={})
 Notify the adapter that the project library tables are about to be rebuilt.
 
void ProjectTablesReloaded (std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables={})
 Complements ProjectTablesChanged by erasing project-scope cache entries whose nicknames no longer appear in the rebuilt project table.
 
void CheckTableRow (LIBRARY_TABLE_ROW &aRow)
 
void AsyncLoad ()
 Loads all available libraries for this adapter type in the background.
 
virtual std::optional< LIB_STATUS > CheckLibrary (LIB_DATA *aLib)
 Validates that a library is loadable. May not necessarily load the library!
 
std::optional< float > AsyncLoadProgress () const
 Returns the fraction of the libraries queued by AsyncLoad() that have been processed, or nullopt when there is nothing to report (no load has been requested since the last reset, or every library was already loaded).
 
void BlockUntilLoaded ()
 
bool RunPreload (PROGRESS_REPORTER &aReporter, std::atomic_bool &aAbort)
 Starts AsyncLoad() and waits for it on the calling thread, reporting progress to aReporter.
 
void AbortAsyncLoad (bool aCancelPlugins=false)
 Aborts any async load in progress; blocks until fully done aborting.
 
void RestartAsyncLoad ()
 Queues again the libraries a cancelling abort left INVALID, when one has cut a load short since the last AsyncLoad() that started.
 
void LeakCachesAtExit ()
 Ends every load, then marks the cache of each library this adapter owns to be left unfreed when its plugin is destroyed.
 
bool IsLibraryLoaded (const wxString &aNickname)
 
std::optional< LIB_STATUS > GetLibraryStatus (const wxString &aNickname) const
 Returns the status of a loaded library, or nullopt if the library hasn't been loaded (yet)
 
std::vector< std::pair< wxString, LIB_STATUS > > GetLibraryStatuses () const
 Returns a list of all library nicknames and their status (even if they failed to load)
 
std::vector< KI_ERROR > GetLibraryLoadErrors () const
 Returns all library load errors as newline-separated strings for display.
 
void ReloadLibraryEntry (const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH)
 Synchronously recreates the plugin for and reloads the given library.
 
std::optional< LIB_STATUS > LoadLibraryEntry (const wxString &aNickname)
 Synchronously loads the named library to LOADED state.
 
virtual bool IsWritable (const wxString &aNickname) const
 Return true if the given nickname exists and is not a read-only library.
 
bool CreateLibrary (const wxString &aNickname)
 Creates the library (i.e. saves to disk) for the given row if it exists.
 
virtual bool SupportsConfigurationDialog (const LIBRARY_TABLE_ROW &aRow) const
 Configuration works from the row itself, so libraries that failed to load or are not yet committed to a table can still be configured.
 
virtual int ShowConfigurationDialog (const LIBRARY_TABLE_ROW &aRow, LIBRARY_TABLE_SCOPE aScope, wxWindow *aParent)
 Shows the plugin's configuration dialog for a library table row.
 
virtual std::optional< LIBRARY_ERROR > LibraryError (const wxString &aNickname) const
 

Static Public Member Functions

static wxString GlobalPathEnvVariableName ()
 

Protected Types

using LOADING_KEY = std::pair<wxString, LIBRARY_TABLE_SCOPE>
 

Protected Member Functions

wxString libraryUnavailableMessage (const wxString &aNickname) const
 
std::map< wxString, LIB_DATA > & globalLibs () override
 
std::map< wxString, LIB_DATA > & globalLibs () const override
 
std::shared_mutex & globalLibsMutex () override
 
std::shared_mutex & globalLibsMutex () const override
 
void enumerateLibrary (LIB_DATA *aLib, const wxString &aUri) override
 Override in derived class to perform library-specific enumeration.
 
LIBRARY_RESULT< IO_BASE * > createPlugin (const LIBRARY_TABLE_ROW *row) override
 Creates a concrete plugin for the given row.
 
IO_BASE * plugin (const LIB_DATA *aRow) override
 
wxString getUri (const LIBRARY_TABLE_ROW *aRow) const
 
std::optional< const LIB_DATA * > fetchIfLoaded (const wxString &aNickname) const
 
std::optional< LIB_DATA * > fetchIfLoaded (const wxString &aNickname)
 
LIBRARY_RESULT< LIB_DATA * > loadIfNeeded (const wxString &aNickname)
 Fetches a loaded library, triggering a load of that library if it isn't loaded yet.
 
LIBRARY_RESULT< LIB_DATA * > loadFromScope (const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope, std::map< wxString, LIB_DATA > &aTarget, std::shared_mutex &aMutex)
 
void evictOwnedGlobalEntries ()
 Erases this adapter's own entries (LIB_DATA::global_owner == this) from the process-wide globalLibs() cache.
 
void retireAllLibraries ()
 For derived destructors, while globalLibs() is still resolvable and plugin worker threads can still call back into the derived adapter.
 
void stopRefreshThreads (std::map< wxString, LIB_DATA > &aLibs, std::shared_mutex &aMutex, const std::function< bool(const wxString &aNickname, const LIB_DATA &aLib)> &aRetiring={})
 Stops the refresh threads of the plugins in aLibs that aRetiring selects, or of all of them when it is empty.
 
void abortLoad (bool aCancelPlugins=false)
 Aborts any async load in progress; blocks until fully done aborting.
 
void resetProjectCache (bool aCancelPlugins=false)
 Aborts pending loads and resets every project-scope cache entry in place (plugin and row cleared, status returned to INVALID) while preserving the nickname keys.
 
std::vector< LOADING_KEY > loadingSnapshot ()
 The libraries an async worker is enumerating right now.
 
void cancelLoadingPlugins (const std::vector< LOADING_KEY > &aSnapshot)
 Asks the plugins in aSnapshot to end their load early, so abortLoad() does not wait out their waits.
 
void resumeLoadingPlugins (const std::vector< LOADING_KEY > &aCancelled)
 Tells the plugins cancelLoadingPlugins() reached that the loads they were asked to end have ended.
 
void withPlugin (const LOADING_KEY &aKey, const std::function< void(IO_BASE &)> &aAction)
 Runs aAction on the plugin of a library when it is still in the map.
 

Static Protected Member Functions

static std::recursive_mutex & pluginMutex (const wxString &aNickname)
 Serializes access to a library's shared plugin instance so its single mutable cache is not raced by concurrent enumerate/load/save/delete calls from the loader pool, preview panels and tree refreshes.
 

Protected Attributes

LIBRARY_MANAGER & m_manager
 
std::map< wxString, LIB_DATA > m_libraries
 
std::shared_mutex m_librariesMutex
 
std::mutex m_loadingMutex
 Libraries an async worker is enumerating, so a cancel reaches exactly those plugins.
 
std::set< LOADING_KEY > m_loading
 
std::atomic_bool m_abort
 
std::atomic_bool m_cancelling { false }
 Set with m_abort by an abort that cancels, so only such an abort turns a failed load into INVALID.
 
std::atomic< unsigned > m_abortGeneration { 0 }
 Counts cancelling aborts, so a load can tell one that began after it started from one that already ended.
 
std::vector< std::future< void > > m_futures
 
bool m_rearmPending = false
 Set when a cancelling abort cut a worker short, and cleared only by an AsyncLoad() that starts.
 
std::atomic< size_t > m_loadCount { 0 }
 
std::atomic< size_t > m_loadTotal { 0 }
 
std::mutex m_loadMutex
 

Private Member Functions

void asyncLoadLocked ()
 The body of AsyncLoad(), run with m_loadMutex already held by the caller.
 
bool loadQueuedRow (const LOAD_WORK &aWork)
 Loads one queued library on a worker thread.
 
LIB_DATA & queuedRowEntry (const LOAD_WORK &aWork)
 The cache entry of a queued library, created and owned by this adapter when it is missing, so a global failure entry is still evicted with the adapter.
 
std::shared_mutex & scopeMutex (LIBRARY_TABLE_SCOPE aScope)
 

Static Private Member Functions

static DESIGN_BLOCK_IO * dbplugin (const LIB_DATA *aRow)
 Helper to cast the ABC plugin in the LIB_DATA* to a concrete plugin.
 

Static Private Attributes

static LEAK_AT_EXIT< std::map< wxString, LIB_DATA > > GlobalLibraries
 
static LEAK_AT_EXIT< std::shared_mutex > GlobalLibraryMutex
 

Detailed Description

Definition at line 35 of file design_block_library_adapter.h.

Member Typedef Documentation

◆ LOADING_KEY

using LIBRARY_MANAGER_ADAPTER::LOADING_KEY = std::pair<wxString, LIBRARY_TABLE_SCOPE>
protectedinherited

Definition at line 322 of file library_manager.h.

Member Enumeration Documentation

◆ SAVE_T

The set of return values from DesignBlockSave() below.

Enumerator
SAVE_OK 
SAVE_SKIPPED 

Definition at line 88 of file design_block_library_adapter.h.

Constructor & Destructor Documentation

◆ DESIGN_BLOCK_LIBRARY_ADAPTER()

DESIGN_BLOCK_LIBRARY_ADAPTER::DESIGN_BLOCK_LIBRARY_ADAPTER ( LIBRARY_MANAGER & aManager)

◆ ~DESIGN_BLOCK_LIBRARY_ADAPTER()

DESIGN_BLOCK_LIBRARY_ADAPTER::~DESIGN_BLOCK_LIBRARY_ADAPTER ( )
override

Member Function Documentation

◆ AbortAsyncLoad()

void LIBRARY_MANAGER_ADAPTER::AbortAsyncLoad ( bool aCancelPlugins = false)
inherited

Aborts any async load in progress; blocks until fully done aborting.

This is the public interface to allow LIBRARY_MANAGER to abort loads before project changes. Only a caller that discards the libraries, or leaves them to RestartAsyncLoad(), passes true to end the in-flight loads early.

Definition at line 1192 of file library_manager.cpp.

References abortLoad().

Referenced by ReconcileLegacyCacheSymbols(), RunPreload(), and SCH_SCREEN::UpdateSymbolLinks().

◆ abortLoad()

void LIBRARY_MANAGER_ADAPTER::abortLoad ( bool aCancelPlugins = false)
protectedinherited

Aborts any async load in progress; blocks until fully done aborting.

A cancelled library is left INVALID and recorded for RestartAsyncLoad(), so a caller that cancels and keeps its tables calls that once they are in place.

Definition at line 1617 of file library_manager.cpp.

References BlockUntilLoaded(), cancelLoadingPlugins(), LIBRARY_MANAGER_ADAPTER(), loadingSnapshot(), m_abort, m_abortGeneration, m_cancelling, m_futures, m_loadCount, m_loadMutex, m_loadTotal, m_rearmPending, resumeLoadingPlugins(), and traceLibraries.

Referenced by AbortAsyncLoad(), CheckTableRow(), evictOwnedGlobalEntries(), GlobalTablesChanged(), LeakCachesAtExit(), ReloadLibraryEntry(), resetProjectCache(), and retireAllLibraries().

◆ AsyncLoad()

◆ asyncLoadLocked()

void LIBRARY_MANAGER_ADAPTER::asyncLoadLocked ( )
privateinherited

The body of AsyncLoad(), run with m_loadMutex already held by the caller.

Definition at line 2127 of file library_manager.cpp.

References GetKiCadThreadPool(), getUri(), globalLibs(), globalLibsMutex(), LOADED, LOADING, m_futures, m_libraries, m_librariesMutex, m_loadCount, m_loadTotal, m_manager, m_rearmPending, PROJECT, rows, tp, traceLibraries, and Type().

Referenced by AsyncLoad(), and RestartAsyncLoad().

◆ AsyncLoadProgress()

std::optional< float > LIBRARY_MANAGER_ADAPTER::AsyncLoadProgress ( ) const
inherited

Returns the fraction of the libraries queued by AsyncLoad() that have been processed, or nullopt when there is nothing to report (no load has been requested since the last reset, or every library was already loaded).

This is the non-blocking view of the load: anything other than 1.0 means a load may still be running. It reaches 1.0 once the last library has been counted, which can be a moment before the workers retire, so a path that must not stall still waits with BlockUntilLoaded().

Definition at line 1674 of file library_manager.cpp.

References m_loadCount, and m_loadTotal.

Referenced by BOOST_AUTO_TEST_CASE(), footprintLibraryLoadProgress(), SCH::kiface(), and RunPreload().

◆ BlockUntilLoaded()

◆ cancelLoadingPlugins()

void LIBRARY_MANAGER_ADAPTER::cancelLoadingPlugins ( const std::vector< LOADING_KEY > & aSnapshot)
protectedinherited

Asks the plugins in aSnapshot to end their load early, so abortLoad() does not wait out their waits.

Definition at line 1591 of file library_manager.cpp.

References IO_BASE::CancelLoad(), and withPlugin().

Referenced by abortLoad().

◆ CheckLibrary()

virtual std::optional< LIB_STATUS > LIBRARY_MANAGER_ADAPTER::CheckLibrary ( LIB_DATA * aLib)
inlinevirtualinherited

Validates that a library is loadable. May not necessarily load the library!

Reimplemented in SYMBOL_LIBRARY_ADAPTER.

Definition at line 165 of file library_manager.h.

References LoadOne().

Referenced by CheckTableRow().

◆ CheckTableRow()

◆ CreateLibrary()

bool LIBRARY_MANAGER_ADAPTER::CreateLibrary ( const wxString & aNickname)
inherited

◆ createPlugin()

◆ dbplugin()

DESIGN_BLOCK_IO * DESIGN_BLOCK_LIBRARY_ADAPTER::dbplugin ( const LIB_DATA * aRow)
staticprivate

Helper to cast the ABC plugin in the LIB_DATA* to a concrete plugin.

Definition at line 57 of file design_block_library_adapter.cpp.

References LIB_DATA::plugin.

Referenced by DeleteDesignBlock(), DesignBlockExists(), enumerateLibrary(), GetDesignBlockNames(), GetDesignBlocks(), GetEnumeratedDesignBlock(), LoadDesignBlock(), LoadOne(), plugin(), and SaveDesignBlock().

◆ DeleteDesignBlock()

void DESIGN_BLOCK_LIBRARY_ADAPTER::DeleteDesignBlock ( const wxString & aNickname,
const wxString & aDesignBlockName )

Delete the aDesignBlockName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIBRARY_TABLE_ROW.
aDesignBlockNameis the name of a design block to delete from the specified library.
Exceptions
IO_ERRORif there is a problem finding the design block or the library, or deleting it.

Definition at line 369 of file design_block_library_adapter.cpp.

References dbplugin(), DESIGN_BLOCK_IO::DesignBlockDelete(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), and LIB_DATA::row.

◆ DeleteLibrary()

bool LIBRARY_MANAGER_ADAPTER::DeleteLibrary ( const wxString & aNickname)
inherited

Deletes the given library from disk if it exists; returns true if deleted.

Definition at line 1514 of file library_manager.cpp.

References IO_BASE::DeleteLibrary(), LIBRARY_TABLE_ROW::GetOptionsMap(), getUri(), loadIfNeeded(), LIB_DATA::plugin, pluginMutex(), result, and LIB_DATA::row.

Referenced by Type().

◆ DesignBlockExists()

bool DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockExists ( const wxString & aNickname,
const wxString & aDesignBlockName )

◆ DesignBlockLoadWithOptionalNickname()

DESIGN_BLOCK * DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockLoadWithOptionalNickname ( const LIB_ID & aDesignBlockId,
bool aKeepUUID = false,
wxString * aErrorMsg = nullptr )

Load a design block having aDesignBlockId with possibly an empty nickname.

Parameters
aDesignBlockIdthe [nickname] and name of the design block to load.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the design block editor, false if loaded in the board editor used only in kicad_plugin
aErrorMsgis an optional string that receives the reason a load failed.
Returns
the DESIGN_BLOCK if found caller owns it, else NULL.

Definition at line 393 of file design_block_library_adapter.cpp.

References _, DesignBlockExists(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIBRARY_MANAGER_ADAPTER::GetLibraryNames(), library, and LoadDesignBlock().

Referenced by DESIGN_BLOCK_PANE::GetDesignBlock().

◆ enumerateLibrary()

void DESIGN_BLOCK_LIBRARY_ADAPTER::enumerateLibrary ( LIB_DATA * aLib,
const wxString & aUri )
overrideprotectedvirtual

Override in derived class to perform library-specific enumeration.

Parameters
aLib
aUriis the pre-resolved library URI (must be resolved on the main thread since URI expansion accesses PROJECT data that is not thread-safe).

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 102 of file design_block_library_adapter.cpp.

References dbplugin(), DESIGN_BLOCK_IO::DesignBlockEnumerate(), LIBRARY_TABLE_ROW::GetOptionsMap(), and LIB_DATA::row.

◆ evictOwnedGlobalEntries()

void LIBRARY_MANAGER_ADAPTER::evictOwnedGlobalEntries ( )
protectedinherited

Erases this adapter's own entries (LIB_DATA::global_owner == this) from the process-wide globalLibs() cache.

The cached LIB_DATA::row pointers reference this manager's tables, so they must be dropped before the manager is destroyed or a later manager's fetchIfLoaded() would dereference freed rows.

Definition at line 1263 of file library_manager.cpp.

References abortLoad(), LIB_DATA::global_owner, globalLibs(), globalLibsMutex(), and stopRefreshThreads().

Referenced by enumerateLibrary(), and retireAllLibraries().

◆ fetchIfLoaded() [1/2]

std::optional< LIB_DATA * > LIBRARY_MANAGER_ADAPTER::fetchIfLoaded ( const wxString & aNickname)
protectedinherited

◆ fetchIfLoaded() [2/2]

std::optional< const LIB_DATA * > LIBRARY_MANAGER_ADAPTER::fetchIfLoaded ( const wxString & aNickname) const
protectedinherited

◆ FindLibraryByURI()

std::optional< wxString > LIBRARY_MANAGER_ADAPTER::FindLibraryByURI ( const wxString & aURI) const
inherited

◆ FindRowByURI()

std::optional< LIBRARY_TABLE_ROW * > LIBRARY_MANAGER_ADAPTER::FindRowByURI ( const wxString & aUri,
LIBRARY_TABLE_SCOPE aScope = LIBRARY_TABLE_SCOPE::BOTH ) const
inherited

Like LIBRARY_MANAGER::FindRowByURI but filtered to the LIBRARY_TABLE_TYPE of this adapter.

Definition at line 1562 of file library_manager.cpp.

References m_manager, and Type().

Referenced by FOOTPRINT_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), and Type().

◆ GetDesignBlockNames()

std::vector< wxString > DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlockNames ( const wxString & aNickname)
Returns
all the names of design blocks in the given library, if it exists and is loaded (or an empty list)

Definition at line 185 of file design_block_library_adapter.cpp.

References dbplugin(), DESIGN_BLOCK_IO::DesignBlockEnumerate(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), name, and LIB_DATA::row.

◆ GetDesignBlocks()

std::vector< DESIGN_BLOCK * > DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlocks ( const wxString & aNickname)
Returns
all the design blocks in the given library, if it exists and is loaded (or an empty list) Vector of design blocks is allocated, caller responsible for lifetime

Definition at line 147 of file design_block_library_adapter.cpp.

References dbplugin(), DESIGN_BLOCK_IO::DesignBlockEnumerate(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_TABLE_ROW::Nickname(), LIB_DATA::row, traceLibraries, and IO_ERROR::What().

Referenced by DESIGN_BLOCK_TREE_MODEL_ADAPTER::getDesignBlocks().

◆ GetEnumeratedDesignBlock()

const DESIGN_BLOCK * DESIGN_BLOCK_LIBRARY_ADAPTER::GetEnumeratedDesignBlock ( const wxString & aNickname,
const wxString & aDesignBlockName )

A version of LoadDesignBlock() for use after enumerateLibrary() for more efficient cache management.

The return value is const to allow it to return a reference to a cached item.

Definition at line 334 of file design_block_library_adapter.cpp.

References dbplugin(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), DESIGN_BLOCK_IO::GetEnumeratedDesignBlock(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), and LIB_DATA::row.

◆ GetLibraryDescription()

std::optional< wxString > LIBRARY_MANAGER_ADAPTER::GetLibraryDescription ( const wxString & aNickname) const
inherited

◆ GetLibraryLoadErrors()

std::vector< KI_ERROR > LIBRARY_MANAGER_ADAPTER::GetLibraryLoadErrors ( ) const
inherited

Returns all library load errors as newline-separated strings for display.

Definition at line 1800 of file library_manager.cpp.

References _, GetLibraryStatuses(), LOAD_ERROR, and RPT_SEVERITY_ERROR.

Referenced by PCB_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::KiwayMailIn(), PCB::IFACE::PreloadLibraries(), and SCH::IFACE::PreloadLibraries().

◆ GetLibraryNames()

◆ GetLibraryStatus()

std::optional< LIB_STATUS > LIBRARY_MANAGER_ADAPTER::GetLibraryStatus ( const wxString & aNickname) const
inherited

◆ GetLibraryStatuses()

std::vector< std::pair< wxString, LIB_STATUS > > LIBRARY_MANAGER_ADAPTER::GetLibraryStatuses ( ) const
inherited

Returns a list of all library nicknames and their status (even if they failed to load)

Definition at line 1770 of file library_manager.cpp.

References GetLibraryStatus(), INVALID, m_manager, result, and Type().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), GetLibraryLoadErrors(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync().

◆ GetRow()

std::optional< LIBRARY_TABLE_ROW * > LIBRARY_MANAGER_ADAPTER::GetRow ( const wxString & aNickname,
LIBRARY_TABLE_SCOPE aScope = LIBRARY_TABLE_SCOPE::BOTH ) const
inherited

◆ getUri()

wxString LIBRARY_MANAGER_ADAPTER::getUri ( const LIBRARY_TABLE_ROW * aRow) const
protectedinherited

◆ globalLibs() [1/2]

std::map< wxString, LIB_DATA > & DESIGN_BLOCK_LIBRARY_ADAPTER::globalLibs ( ) const
inlineoverrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 149 of file design_block_library_adapter.h.

References GlobalLibraries.

◆ globalLibs() [2/2]

std::map< wxString, LIB_DATA > & DESIGN_BLOCK_LIBRARY_ADAPTER::globalLibs ( )
inlineoverrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 148 of file design_block_library_adapter.h.

References GlobalLibraries.

◆ globalLibsMutex() [1/2]

std::shared_mutex & DESIGN_BLOCK_LIBRARY_ADAPTER::globalLibsMutex ( ) const
inlineoverrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 151 of file design_block_library_adapter.h.

References GlobalLibraryMutex.

◆ globalLibsMutex() [2/2]

std::shared_mutex & DESIGN_BLOCK_LIBRARY_ADAPTER::globalLibsMutex ( )
inlineoverrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 150 of file design_block_library_adapter.h.

References GlobalLibraryMutex.

◆ GlobalPathEnvVariableName()

wxString DESIGN_BLOCK_LIBRARY_ADAPTER::GlobalPathEnvVariableName ( )
static

◆ GlobalTable()

LIBRARY_TABLE * LIBRARY_MANAGER_ADAPTER::GlobalTable ( ) const
inherited

Retrieves the global library table for this adapter type.

Definition at line 1455 of file library_manager.cpp.

References GLOBAL, m_manager, and Type().

Referenced by Type().

◆ GlobalTablesChanged()

void LIBRARY_MANAGER_ADAPTER::GlobalTablesChanged ( std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables = {})
inherited

Notify the adapter that the global library tables have changed.

Definition at line 1233 of file library_manager.cpp.

References abortLoad(), globalLibs(), globalLibsMutex(), stopRefreshThreads(), and Type().

Referenced by Type().

◆ HasLibrary()

◆ IsDesignBlockLibWritable()

bool DESIGN_BLOCK_LIBRARY_ADAPTER::IsDesignBlockLibWritable ( const wxString & aNickname)

Return true if the library given by aNickname is writable.

Often system libraries are read only because of where they are installed.

Exceptions
IO_ERRORif no library at aLibraryPath exists.

Definition at line 381 of file design_block_library_adapter.cpp.

References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_MANAGER_ADAPTER::getUri(), IO_BASE::IsLibraryWritable(), plugin(), and LIB_DATA::row.

◆ IsLibraryLoaded()

◆ IsWritable()

bool LIBRARY_MANAGER_ADAPTER::IsWritable ( const wxString & aNickname) const
virtualinherited

Return true if the given nickname exists and is not a read-only library.

Definition at line 1901 of file library_manager.cpp.

References fetchIfLoaded(), getUri(), IO_BASE::IsLibraryWritable(), LIB_DATA::plugin, pluginMutex(), result, and LIB_DATA::row.

◆ LeakCachesAtExit()

void LIBRARY_MANAGER_ADAPTER::LeakCachesAtExit ( )
inherited

Ends every load, then marks the cache of each library this adapter owns to be left unfreed when its plugin is destroyed.

Only for use as the process exits.

Definition at line 1208 of file library_manager.cpp.

References abortLoad(), globalLibs(), globalLibsMutex(), m_libraries, and m_librariesMutex.

◆ LibraryError()

std::optional< LIBRARY_ERROR > LIBRARY_MANAGER_ADAPTER::LibraryError ( const wxString & aNickname) const
virtualinherited

◆ libraryUnavailableMessage()

wxString DESIGN_BLOCK_LIBRARY_ADAPTER::libraryUnavailableMessage ( const wxString & aNickname) const
protected

◆ LoadDesignBlock()

DESIGN_BLOCK * DESIGN_BLOCK_LIBRARY_ADAPTER::LoadDesignBlock ( const wxString & aNickname,
const wxString & aDesignBlockName,
bool aKeepUUID = false,
wxString * aErrorMsg = nullptr )

Load a design block having aDesignBlockName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIBRARY_TABLE_ROW.
aDesignBlockNameis the name of the design block to load.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the design block editor, false if loaded in the board editor. Used only in kicad_plugin
aErrorMsgis an optional string that receives the reason a load failed.
Returns
the design block if found caller owns it, else NULL.

Definition at line 275 of file design_block_library_adapter.cpp.

References dbplugin(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), libraryUnavailableMessage(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), LIB_DATA::row, traceLibraries, and IO_ERROR::What().

Referenced by DesignBlockLoadWithOptionalNickname(), API_HANDLER_LIBRARIES::packLibraryItem(), and PANEL_DESIGN_BLOCK_CHOOSER::rebuildHistoryNode().

◆ loadFromScope()

LIBRARY_RESULT< LIB_DATA * > LIBRARY_MANAGER_ADAPTER::loadFromScope ( const wxString & aNickname,
LIBRARY_TABLE_SCOPE aScope,
std::map< wxString, LIB_DATA > & aTarget,
std::shared_mutex & aMutex )
protectedinherited

◆ loadIfNeeded()

LIBRARY_RESULT< LIB_DATA * > LIBRARY_MANAGER_ADAPTER::loadIfNeeded ( const wxString & aNickname)
protectedinherited

◆ loadingSnapshot()

std::vector< LIBRARY_MANAGER_ADAPTER::LOADING_KEY > LIBRARY_MANAGER_ADAPTER::loadingSnapshot ( )
protectedinherited

The libraries an async worker is enumerating right now.

Definition at line 1584 of file library_manager.cpp.

References m_loading, and m_loadingMutex.

Referenced by abortLoad().

◆ LoadLibraryEntry()

std::optional< LIB_STATUS > LIBRARY_MANAGER_ADAPTER::LoadLibraryEntry ( const wxString & aNickname)
inherited

Synchronously loads the named library to LOADED state.

Returns the resulting status, or nullopt if the library is not found in any table.

Definition at line 1824 of file library_manager.cpp.

References loadIfNeeded(), LoadOne(), and result.

Referenced by API_HANDLER_LIBRARIES::handleGetItemsFromLibrary(), API_HANDLER_LIBRARIES::handleGetLibraryItems(), and loadLibrary().

◆ LoadOne() [1/2]

std::optional< LIB_STATUS > DESIGN_BLOCK_LIBRARY_ADAPTER::LoadOne ( const wxString & nickname)

◆ LoadOne() [2/2]

◆ loadQueuedRow()

◆ Manager()

LIBRARY_MANAGER & LIBRARY_MANAGER_ADAPTER::Manager ( ) const
inherited

Definition at line 1156 of file library_manager.cpp.

References m_manager.

◆ plugin()

IO_BASE * DESIGN_BLOCK_LIBRARY_ADAPTER::plugin ( const LIB_DATA * aRow)
overrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 96 of file design_block_library_adapter.cpp.

References dbplugin().

Referenced by createPlugin(), and IsDesignBlockLibWritable().

◆ pluginMutex()

std::recursive_mutex & LIBRARY_MANAGER_ADAPTER::pluginMutex ( const wxString & aNickname)
staticprotectedinherited

Serializes access to a library's shared plugin instance so its single mutable cache is not raced by concurrent enumerate/load/save/delete calls from the loader pool, preview panels and tree refreshes.

Keyed by nickname, a safe over-approximation of the real resource (the plugin instance): sharing one mutex across two distinct resources can only over-serialize, never under-protect. Static because global-library plugins are shared process-wide. Recursive because database/http libraries resolve references back through the adapter into other plugins' LoadSymbol paths while already holding their own mutex.

Definition at line 55 of file library_manager.cpp.

Referenced by SYMBOL_LIBRARY_ADAPTER::CheckLibrary(), CreateLibrary(), FOOTPRINT_LIBRARY_ADAPTER::DeleteFootprint(), DeleteLibrary(), SYMBOL_LIBRARY_ADAPTER::DeleteSymbol(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockExists(), FOOTPRINT_LIBRARY_ADAPTER::enumerateLibrary(), SYMBOL_LIBRARY_ADAPTER::enumerateLibrary(), FOOTPRINT_LIBRARY_ADAPTER::FootprintExists(), FOOTPRINT_LIBRARY_ADAPTER::GetFootprintNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbolNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbols(), FOOTPRINT_LIBRARY_ADAPTER::IsFootprintLibWritable(), IsWritable(), DESIGN_BLOCK_LIBRARY_ADAPTER::LoadDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), SYMBOL_LIBRARY_ADAPTER::LoadOne(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), plugin(), FOOTPRINT_LIBRARY_ADAPTER::SaveFootprint(), and SYMBOL_LIBRARY_ADAPTER::SaveSymbol().

◆ ProjectChanged()

void LIBRARY_MANAGER_ADAPTER::ProjectChanged ( )
virtualinherited

Notify the adapter that the active project has changed.

Definition at line 1162 of file library_manager.cpp.

References resetProjectCache().

◆ ProjectTable()

std::optional< LIBRARY_TABLE * > LIBRARY_MANAGER_ADAPTER::ProjectTable ( ) const
inherited

◆ ProjectTablesChanged()

void LIBRARY_MANAGER_ADAPTER::ProjectTablesChanged ( std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables = {})
inherited

Notify the adapter that the project library tables are about to be rebuilt.

Mirrors GlobalTablesChanged: aborts any in-progress loads and invalidates cached LIB_DATA entries so raw LIBRARY_TABLE_ROW pointers do not dangle when the backing LIBRARY_TABLE objects are destroyed and rebuilt. Entries are reset in place (rather than erased) so their nicknames continue to mask same-named global libraries until the project scope is repopulated.

Definition at line 1328 of file library_manager.cpp.

References resetProjectCache(), and Type().

◆ ProjectTablesReloaded()

void LIBRARY_MANAGER_ADAPTER::ProjectTablesReloaded ( std::initializer_list< LIBRARY_TABLE_TYPE > aChangedTables = {})
inherited

Complements ProjectTablesChanged by erasing project-scope cache entries whose nicknames no longer appear in the rebuilt project table.

Must be called AFTER the new project table is loaded; otherwise removed libraries would be permanently masked by stale sentinels installed during the reset.

Definition at line 1348 of file library_manager.cpp.

References m_libraries, m_librariesMutex, m_manager, PROJECT, stopRefreshThreads(), and Type().

◆ queuedRowEntry()

LIB_DATA & LIBRARY_MANAGER_ADAPTER::queuedRowEntry ( const LOAD_WORK & aWork)
privateinherited

The cache entry of a queued library, created and owned by this adapter when it is missing, so a global failure entry is still evicted with the adapter.

The caller holds the lock of the library's scope.

Definition at line 2362 of file library_manager.cpp.

References GLOBAL, LIB_DATA::global_owner, globalLibs(), m_libraries, LIBRARY_MANAGER_ADAPTER::LOAD_WORK::nickname, and LIBRARY_MANAGER_ADAPTER::LOAD_WORK::scope.

Referenced by loadQueuedRow().

◆ ReloadLibraryEntry()

void LIBRARY_MANAGER_ADAPTER::ReloadLibraryEntry ( const wxString & aNickname,
LIBRARY_TABLE_SCOPE aScope = LIBRARY_TABLE_SCOPE::BOTH )
inherited

◆ resetProjectCache()

void LIBRARY_MANAGER_ADAPTER::resetProjectCache ( bool aCancelPlugins = false)
protectedinherited

Aborts pending loads and resets every project-scope cache entry in place (plugin and row cleared, status returned to INVALID) while preserving the nickname keys.

Keeping the keys acts as a sentinel: fetchIfLoaded() finds the entry, sees it is no longer LOADED, and returns nullopt instead of falling through to globalLibs(), which is what preserves project-over- global shadowing across a project table reload. Shared between ProjectChanged() and ProjectTablesChanged() so both hooks stay in sync. Derived destructors pass true, since nothing is left to load the cancelled libraries for.

Definition at line 1168 of file library_manager.cpp.

References abortLoad(), m_libraries, m_librariesMutex, and stopRefreshThreads().

Referenced by ProjectChanged(), ProjectTablesChanged(), and retireAllLibraries().

◆ RestartAsyncLoad()

void LIBRARY_MANAGER_ADAPTER::RestartAsyncLoad ( )
inherited

Queues again the libraries a cancelling abort left INVALID, when one has cut a load short since the last AsyncLoad() that started.

Unlike AsyncLoad() it waits for a load lock held elsewhere, so it is never dropped.

Definition at line 1198 of file library_manager.cpp.

References asyncLoadLocked(), m_loadMutex, and m_rearmPending.

Referenced by ReloadLibraryEntry().

◆ resumeLoadingPlugins()

void LIBRARY_MANAGER_ADAPTER::resumeLoadingPlugins ( const std::vector< LOADING_KEY > & aCancelled)
protectedinherited

Tells the plugins cancelLoadingPlugins() reached that the loads they were asked to end have ended.

Definition at line 1604 of file library_manager.cpp.

References IO_BASE::ResumeLoad(), and withPlugin().

Referenced by abortLoad().

◆ retireAllLibraries()

void LIBRARY_MANAGER_ADAPTER::retireAllLibraries ( )
protectedinherited

For derived destructors, while globalLibs() is still resolvable and plugin worker threads can still call back into the derived adapter.

Stops the refresh threads of both scopes before either is retired, since a thread of one scope may read libraries of the other, then resets the project cache and evicts this adapter's global entries.

Definition at line 1289 of file library_manager.cpp.

References abortLoad(), evictOwnedGlobalEntries(), LIB_DATA::global_owner, globalLibs(), globalLibsMutex(), m_libraries, m_librariesMutex, resetProjectCache(), and stopRefreshThreads().

Referenced by enumerateLibrary(), DESIGN_BLOCK_LIBRARY_ADAPTER::~DESIGN_BLOCK_LIBRARY_ADAPTER(), FOOTPRINT_LIBRARY_ADAPTER::~FOOTPRINT_LIBRARY_ADAPTER(), and SYMBOL_LIBRARY_ADAPTER::~SYMBOL_LIBRARY_ADAPTER().

◆ Rows()

◆ RunPreload()

bool LIBRARY_MANAGER_ADAPTER::RunPreload ( PROGRESS_REPORTER & aReporter,
std::atomic_bool & aAbort )
inherited

Starts AsyncLoad() and waits for it on the calling thread, reporting progress to aReporter.

Setting aAbort asks the plugins to cancel, but the call still waits for the workers, so one blocked in I/O that cannot be cancelled delays the return.

Returns
false when aAbort cut the load short, in which case the flag has been cleared

Definition at line 1686 of file library_manager.cpp.

References AbortAsyncLoad(), AsyncLoad(), AsyncLoadProgress(), BlockUntilLoaded(), and PROGRESS_REPORTER::SetCurrentProgress().

Referenced by PGM_BASE::PreloadDesignBlockLibraries(), PCB::IFACE::PreloadLibraries(), and SCH::IFACE::PreloadLibraries().

◆ SaveDesignBlock()

DESIGN_BLOCK_LIBRARY_ADAPTER::SAVE_T DESIGN_BLOCK_LIBRARY_ADAPTER::SaveDesignBlock ( const wxString & aNickname,
const DESIGN_BLOCK * aDesignBlock,
bool aOverwrite = true )

Write aDesignBlock to an existing library given by aNickname.

If a design block by the same name already exists, it is replaced.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIBRARY_TABLE_ROW.
aDesignBlockis what to store in the library. The caller continues to own the design block after this call.
aOverwritewhen true means overwrite any existing design block by the same name, else if false means skip the write and return SAVE_SKIPPED.
Returns
SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
Exceptions
IO_ERRORif there is a problem saving.

Definition at line 349 of file design_block_library_adapter.cpp.

References dbplugin(), DesignBlockExists(), DESIGN_BLOCK_IO::DesignBlockSave(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), DESIGN_BLOCK::GetName(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIB_DATA::row, SAVE_OK, and SAVE_SKIPPED.

Referenced by PCB_EDIT_FRAME::SaveBoardAsDesignBlock(), SCH_EDIT_FRAME::SaveSelectionAsDesignBlock(), PCB_EDIT_FRAME::saveSelectionToDesignBlock(), SCH_EDIT_FRAME::SaveSheetAsDesignBlock(), PCB_EDIT_FRAME::UpdateDesignBlockFromBoard(), SCH_EDIT_FRAME::UpdateDesignBlockFromSelection(), and SCH_EDIT_FRAME::UpdateDesignBlockFromSheet().

◆ scopeMutex()

std::shared_mutex & LIBRARY_MANAGER_ADAPTER::scopeMutex ( LIBRARY_TABLE_SCOPE aScope)
privateinherited

Definition at line 2356 of file library_manager.cpp.

References GLOBAL, globalLibsMutex(), and m_librariesMutex.

Referenced by loadQueuedRow().

◆ ShowConfigurationDialog()

virtual int LIBRARY_MANAGER_ADAPTER::ShowConfigurationDialog ( const LIBRARY_TABLE_ROW & aRow,
LIBRARY_TABLE_SCOPE aScope,
wxWindow * aParent )
inlinevirtualinherited

Shows the plugin's configuration dialog for a library table row.

On OK, the committed library with the same nickname, type and URI in aScope is reloaded.

Reimplemented in SYMBOL_LIBRARY_ADAPTER.

Definition at line 238 of file library_manager.h.

Referenced by LIB_TABLE_GRID_TRICKS::doPopupSelection(), and LIB_TABLE_GRID_TRICKS::onGridCellLeftClick().

◆ stopRefreshThreads()

void LIBRARY_MANAGER_ADAPTER::stopRefreshThreads ( std::map< wxString, LIB_DATA > & aLibs,
std::shared_mutex & aMutex,
const std::function< bool(const wxString &aNickname, const LIB_DATA &aLib)> & aRetiring = {} )
protectedinherited

Stops the refresh threads of the plugins in aLibs that aRetiring selects, or of all of them when it is empty.

Called before those entries change, since the threads read other entries through this adapter without holding its locks.

Definition at line 1306 of file library_manager.cpp.

References plugin().

Referenced by enumerateLibrary(), evictOwnedGlobalEntries(), GlobalTablesChanged(), ProjectTablesReloaded(), resetProjectCache(), and retireAllLibraries().

◆ SupportsConfigurationDialog()

virtual bool LIBRARY_MANAGER_ADAPTER::SupportsConfigurationDialog ( const LIBRARY_TABLE_ROW & aRow) const
inlinevirtualinherited

Configuration works from the row itself, so libraries that failed to load or are not yet committed to a table can still be configured.

Reimplemented in SYMBOL_LIBRARY_ADAPTER.

Definition at line 232 of file library_manager.h.

Referenced by LIB_TABLE_GRID_TRICKS::onGridCellLeftClick().

◆ Type()

LIBRARY_TABLE_TYPE DESIGN_BLOCK_LIBRARY_ADAPTER::Type ( ) const
inlineoverridevirtual

The type of library table this adapter works with.

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 42 of file design_block_library_adapter.h.

References DESIGN_BLOCK.

◆ withPlugin()

void LIBRARY_MANAGER_ADAPTER::withPlugin ( const LOADING_KEY & aKey,
const std::function< void(IO_BASE &)> & aAction )
protectedinherited

Runs aAction on the plugin of a library when it is still in the map.

Definition at line 1570 of file library_manager.cpp.

References GLOBAL, globalLibs(), globalLibsMutex(), m_libraries, and m_librariesMutex.

Referenced by cancelLoadingPlugins(), and resumeLoadingPlugins().

Member Data Documentation

◆ GlobalLibraries

LEAK_AT_EXIT< std::map< wxString, LIB_DATA > > DESIGN_BLOCK_LIBRARY_ADAPTER::GlobalLibraries
staticprivate

Definition at line 167 of file design_block_library_adapter.h.

Referenced by globalLibs(), and globalLibs().

◆ GlobalLibraryMutex

LEAK_AT_EXIT< std::shared_mutex > DESIGN_BLOCK_LIBRARY_ADAPTER::GlobalLibraryMutex
staticprivate

Definition at line 171 of file design_block_library_adapter.h.

Referenced by globalLibsMutex(), and globalLibsMutex().

◆ m_abort

std::atomic_bool LIBRARY_MANAGER_ADAPTER::m_abort
protectedinherited

Definition at line 347 of file library_manager.h.

Referenced by abortLoad().

◆ m_abortGeneration

std::atomic<unsigned> LIBRARY_MANAGER_ADAPTER::m_abortGeneration { 0 }
protectedinherited

Counts cancelling aborts, so a load can tell one that began after it started from one that already ended.

Definition at line 353 of file library_manager.h.

Referenced by abortLoad(), and SYMBOL_LIBRARY_ADAPTER::LoadOne().

◆ m_cancelling

std::atomic_bool LIBRARY_MANAGER_ADAPTER::m_cancelling { false }
protectedinherited

Set with m_abort by an abort that cancels, so only such an abort turns a failed load into INVALID.

Definition at line 350 of file library_manager.h.

Referenced by abortLoad(), SYMBOL_LIBRARY_ADAPTER::LoadOne(), and loadQueuedRow().

◆ m_futures

std::vector<std::future<void> > LIBRARY_MANAGER_ADAPTER::m_futures
protectedinherited

Definition at line 355 of file library_manager.h.

Referenced by abortLoad(), asyncLoadLocked(), and BlockUntilLoaded().

◆ m_libraries

◆ m_librariesMutex

◆ m_loadCount

std::atomic<size_t> LIBRARY_MANAGER_ADAPTER::m_loadCount { 0 }
protectedinherited

Definition at line 362 of file library_manager.h.

Referenced by abortLoad(), asyncLoadLocked(), AsyncLoadProgress(), and BlockUntilLoaded().

◆ m_loading

std::set<LOADING_KEY> LIBRARY_MANAGER_ADAPTER::m_loading
protectedinherited

Definition at line 345 of file library_manager.h.

Referenced by loadingSnapshot(), and loadQueuedRow().

◆ m_loadingMutex

std::mutex LIBRARY_MANAGER_ADAPTER::m_loadingMutex
protectedinherited

Libraries an async worker is enumerating, so a cancel reaches exactly those plugins.

Definition at line 344 of file library_manager.h.

Referenced by loadingSnapshot(), and loadQueuedRow().

◆ m_loadMutex

std::mutex LIBRARY_MANAGER_ADAPTER::m_loadMutex
protectedinherited

Definition at line 364 of file library_manager.h.

Referenced by abortLoad(), AsyncLoad(), BlockUntilLoaded(), and RestartAsyncLoad().

◆ m_loadTotal

std::atomic<size_t> LIBRARY_MANAGER_ADAPTER::m_loadTotal { 0 }
protectedinherited

Definition at line 363 of file library_manager.h.

Referenced by abortLoad(), asyncLoadLocked(), AsyncLoadProgress(), and BlockUntilLoaded().

◆ m_manager

◆ m_rearmPending

bool LIBRARY_MANAGER_ADAPTER::m_rearmPending = false
protectedinherited

Set when a cancelling abort cut a worker short, and cleared only by an AsyncLoad() that starts.

It outlives later aborts, so whichever caller restarts the loads finds what an earlier one cancelled. Guarded by m_loadMutex.

Definition at line 360 of file library_manager.h.

Referenced by abortLoad(), asyncLoadLocked(), and RestartAsyncLoad().


The documentation for this class was generated from the following files: