|
KiCad PCB EDA Suite
|
An interface to the global shared library manager that is schematic-specific and linked to one project in particular. More...
#include <symbol_library_adapter.h>
Public Types | |
| enum class | SYMBOL_TYPE { ALL_SYMBOLS , POWER_ONLY } |
| enum | SAVE_T { SAVE_OK , SAVE_SKIPPED } |
| The set of return values from SaveSymbol() below. More... | |
Public Member Functions | |
| SYMBOL_LIBRARY_ADAPTER (LIBRARY_MANAGER &aManager) | |
| ~SYMBOL_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 |
| Loads or reloads the given library, if it exists. | |
| std::optional< LIB_STATUS > | CheckLibrary (LIB_DATA *aLib) override |
| Validates that a library is loadable. May not necessarily load the library! | |
| std::optional< LIB_STATUS > | LoadOne (const wxString &aNickname) |
| Loads or reloads the given library, if it exists. | |
| std::vector< wxString > | GetAvailableExtraFields (const wxString &aNickname) |
| Returns a list of additional (non-mandatory) symbol fields present in the given library. | |
| bool | SupportsSubLibraries (const wxString &aNickname) const |
| std::vector< SUB_LIBRARY > | GetSubLibraries (const wxString &aNickname) const |
| bool | SupportsConfigurationDialog (const LIBRARY_TABLE_ROW &aRow) const override |
| Configuration works from the row itself, so libraries that failed to load or are not yet committed to a table can still be configured. | |
| int | ShowConfigurationDialog (const LIBRARY_TABLE_ROW &aRow, LIBRARY_TABLE_SCOPE aScope, wxWindow *aParent) override |
| Shows the plugin's configuration dialog for a library table row. | |
| std::vector< LIB_SYMBOL * > | GetSymbols (const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS) |
| std::vector< wxString > | GetSymbolNames (const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS) |
| LIB_SYMBOL * | LoadSymbol (const wxString &aNickname, const wxString &aName) |
| Load a LIB_SYMBOL having aName from the library given by aNickname. | |
| LIB_SYMBOL * | LoadSymbol (const LIB_ID &aLibId) |
| SAVE_T | SaveSymbol (const wxString &aNickname, std::unique_ptr< LIB_SYMBOL > aSymbol, bool aOverwrite=true) |
| Write aSymbol to an existing library given by aNickname. | |
| void | DeleteSymbol (const wxString &aNickname, const wxString &aSymbolName) |
| Deletes the aSymbolName from the library given by aNickname. | |
| bool | IsSymbolLibWritable (const wxString &aNickname) |
| Return true if the library given by aNickname is writable. | |
| int | GetModifyHash () const |
| std::optional< int > | GetLibraryModifyHash (const wxString &aNickname) const |
| Return the modify hash of a single library if it is currently loaded. | |
| 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. | |
| 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 std::optional< LIBRARY_ERROR > | LibraryError (const wxString &aNickname) const |
Static Public Member Functions | |
| static wxString | GlobalPathEnvVariableName () |
Static Public Attributes | |
| static const char * | PropPowerSymsOnly = "pwr_sym_only" |
| static const char * | PropNonPowerSymsOnly = "non_pwr_sym_only" |
Protected Types | |
| using | LOADING_KEY = std::pair<wxString, LIBRARY_TABLE_SCOPE> |
Protected Member Functions | |
| 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 SCH_IO * | schplugin (const LIB_DATA *aRow) |
Private Attributes | |
| std::map< wxString, LIB_DATA > | m_scopedGlobalLibraries |
| std::shared_mutex | m_scopedGlobalLibraryMutex |
Static Private Attributes | |
| static LEAK_AT_EXIT< std::map< wxString, LIB_DATA > > | GlobalLibraries |
| static LEAK_AT_EXIT< std::shared_mutex > | GlobalLibraryMutex |
An interface to the global shared library manager that is schematic-specific and linked to one project in particular.
This is what can return actual concrete schematic library content (symbols).
Definition at line 52 of file symbol_library_adapter.h.
|
protectedinherited |
Definition at line 322 of file library_manager.h.
The set of return values from SaveSymbol() below.
| Enumerator | |
|---|---|
| SAVE_OK | |
| SAVE_SKIPPED | |
Definition at line 121 of file symbol_library_adapter.h.
|
strong |
| Enumerator | |
|---|---|
| ALL_SYMBOLS | |
| POWER_ONLY | |
Definition at line 87 of file symbol_library_adapter.h.
| SYMBOL_LIBRARY_ADAPTER::SYMBOL_LIBRARY_ADAPTER | ( | LIBRARY_MANAGER & | aManager | ) |
Definition at line 52 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::LIBRARY_MANAGER_ADAPTER().
|
override |
Definition at line 58 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::retireAllLibraries().
|
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().
|
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().
|
inherited |
Loads all available libraries for this adapter type in the background.
Definition at line 2116 of file library_manager.cpp.
References asyncLoadLocked(), and m_loadMutex.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), filterFootprints(), SCH::filterFootprintUsers(), PCB::IFACE::handleOpenFootprint(), SCH::IFACE::handleOpenSymbol(), PCBNEW_JOBS_HANDLER::JobExportDrc(), EESCHEMA_JOBS_HANDLER::JobSchErc(), PCB::IFACE::LoadAllLibraries(), SCH::IFACE::LoadAllLibraries(), API_HANDLER_LIBRARIES::loadAllLibraries(), LoadNetlistFootprints(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), API_HANDLER_SCH::ERC_TASK::Run(), RunPreload(), startFootprintLibraryLoad(), and SCH::startSymbolLibraryLoad().
|
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().
|
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().
|
inherited |
Definition at line 1715 of file library_manager.cpp.
References m_futures, m_loadCount, m_loadMutex, m_loadTotal, and traceLibraries.
Referenced by abortLoad(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), filterFootprints(), SCH::filterFootprintUsers(), PCB::IFACE::handleOpenFootprint(), SCH::IFACE::handleOpenSymbol(), PCBNEW_JOBS_HANDLER::JobExportDrc(), EESCHEMA_JOBS_HANDLER::JobSchErc(), LoadNetlistFootprints(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), API_HANDLER_SCH::ERC_TASK::Run(), RunPreload(), and SYMBOL_EDIT_FRAME::SyncLibraries().
|
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().
|
overridevirtual |
Validates that a library is loadable. May not necessarily load the library!
Reimplemented from LIBRARY_MANAGER_ADAPTER.
Definition at line 128 of file symbol_library_adapter.cpp.
References SCH_IO::CheckLibrary(), LIB_STATUS::error, LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LOAD_ERROR, LIB_STATUS::load_status, LOADED, LOADING, LIBRARY_TABLE_ROW::Nickname(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), IO_ERROR::Problem(), LIB_DATA::row, schplugin(), LIB_DATA::status, traceLibraries, IO_ERROR::What(), and IO_ERROR::Where().
|
inherited |
Definition at line 1397 of file library_manager.cpp.
References abortLoad(), CheckLibrary(), createPlugin(), LIBRARY_TABLE_ROW::Disabled(), fetchIfLoaded(), LIBRARY_TABLE_ROW::IsOk(), LOADED, message, LIBRARY_TABLE_ROW::Nickname(), LIB_DATA::plugin, plugin(), LIB_DATA::row, LIBRARY_TABLE_ROW::SetErrorDescription(), LIBRARY_TABLE_ROW::SetOk(), LIBRARY_TABLE_ROW::Type(), and LIBRARY_TABLE_ROW::URI().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and LIB_TABLE_NOTEBOOK_PANEL::onGridCellChanging().
|
inherited |
Creates the library (i.e. saves to disk) for the given row if it exists.
Definition at line 1918 of file library_manager.cpp.
References IO_BASE::CreateLibrary(), LIBRARY_TABLE_ROW::GetOptionsMap(), getUri(), loadIfNeeded(), LIB_DATA::plugin, pluginMutex(), result, LIB_DATA::row, traceLibraries, and IO_ERROR::What().
Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), and SaveRemoteSymbolToLibrary().
|
overrideprotectedvirtual |
Creates a concrete plugin for the given row.
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 165 of file symbol_library_adapter.cpp.
References _, SCH_IO_MGR::EnumFromStr(), LIBRARY_MANAGER_ADAPTER::m_manager, LIBRARY_TABLE_ROW::Nickname(), plugin(), LIBRARY_TABLE_ROW::Scope(), traceLibraries, LIBRARY_TABLE_ROW::Type(), and LIBRARY_TABLE_ROW::URI().
|
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().
| void SYMBOL_LIBRARY_ADAPTER::DeleteSymbol | ( | const wxString & | aNickname, |
| const wxString & | aSymbolName ) |
Deletes the aSymbolName from the library given by aNickname.
| aNickname | is a locator for the "library", it is a "name" in LIB_TABLE_ROW. |
| aSymbolName | is the name of a symbol to delete from the specified library. |
| IO_ERROR | if there is a problem finding the footprint or the library, or deleting it. |
Definition at line 359 of file symbol_library_adapter.cpp.
References SCH_IO::DeleteSymbol(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_MANAGER_ADAPTER::loadIfNeeded(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), LIB_DATA::row, schplugin(), and traceLibraries.
|
overrideprotectedvirtual |
Override in derived class to perform library-specific enumeration.
| aLib | |
| aUri | is 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 78 of file symbol_library_adapter.cpp.
References SCH_IO::EnumerateSymbolLib(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_TABLE_ROW::Nickname(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), LIB_DATA::row, and schplugin().
|
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().
|
protectedinherited |
Definition at line 1991 of file library_manager.cpp.
References find, globalLibs(), globalLibsMutex(), LOADED, m_libraries, m_librariesMutex, m_manager, PROJECT, and Type().
|
protectedinherited |
Definition at line 1958 of file library_manager.cpp.
References find, globalLibs(), globalLibsMutex(), LOADED, m_libraries, m_librariesMutex, m_manager, PROJECT, and Type().
Referenced by CheckTableRow(), DESIGN_BLOCK_LIBRARY_ADAPTER::DeleteDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::DeleteFootprint(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockExists(), enumerateLibrary(), FOOTPRINT_LIBRARY_ADAPTER::FootprintExists(), FOOTPRINT_LIBRARY_ADAPTER::GenerateTimestamp(), SYMBOL_LIBRARY_ADAPTER::GetAvailableExtraFields(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlockNames(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlocks(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetEnumeratedDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::GetFootprintNames(), GetLibraryDescription(), SYMBOL_LIBRARY_ADAPTER::GetLibraryModifyHash(), GetLibraryNames(), SYMBOL_LIBRARY_ADAPTER::GetModifyHash(), SYMBOL_LIBRARY_ADAPTER::GetSubLibraries(), SYMBOL_LIBRARY_ADAPTER::GetSymbolNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbols(), HasLibrary(), DESIGN_BLOCK_LIBRARY_ADAPTER::IsDesignBlockLibWritable(), FOOTPRINT_LIBRARY_ADAPTER::IsFootprintLibWritable(), SYMBOL_LIBRARY_ADAPTER::IsSymbolLibWritable(), IsWritable(), DESIGN_BLOCK_LIBRARY_ADAPTER::LoadDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), FOOTPRINT_LIBRARY_ADAPTER::RefreshLibraryIfChanged(), DESIGN_BLOCK_LIBRARY_ADAPTER::SaveDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::SaveFootprint(), and SYMBOL_LIBRARY_ADAPTER::SupportsSubLibraries().
|
inherited |
Definition at line 1468 of file library_manager.cpp.
References LIBRARY_MANAGER::GetFullURI(), m_manager, Type(), and LIBRARY_MANAGER::UrisAreEquivalent().
Referenced by Type().
|
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().
| std::vector< wxString > SYMBOL_LIBRARY_ADAPTER::GetAvailableExtraFields | ( | const wxString & | aNickname | ) |
Returns a list of additional (non-mandatory) symbol fields present in the given library.
Definition at line 389 of file symbol_library_adapter.cpp.
References LIB_DATA::available_fields_cache, LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), SCH_IO::GetAvailableSymbolFields(), SCH_IO::GetModifyHash(), LIB_DATA::modify_hash, result, and schplugin().
Referenced by SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
|
inherited |
Definition at line 1539 of file library_manager.cpp.
References fetchIfLoaded().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PCB_BASE_FRAME::GetLibraryItemsForListDialog(), SCH_BASE_FRAME::GetLibraryItemsForListDialog(), and Type().
|
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().
| std::optional< int > SYMBOL_LIBRARY_ADAPTER::GetLibraryModifyHash | ( | const wxString & | aNickname | ) | const |
Return the modify hash of a single library if it is currently loaded.
Unlike GetModifyHash(), which sums the hashes of every loaded library, this reports just the named library so callers can react to changes in a specific dependency without being disturbed by unrelated (for example asynchronously loading) libraries.
| aNickname | is the library nickname in the symbol library table. |
Definition at line 523 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), SCH_IO::GetModifyHash(), result, LIB_DATA::row, and schplugin().
|
inherited |
Returns a list of library nicknames that are available (skips any that failed to load)
Definition at line 1480 of file library_manager.cpp.
References fetchIfLoaded(), IGNORE_CASE, m_manager, rows, StrNumSort(), traceLibraries, and Type().
Referenced by BOOST_AUTO_TEST_CASE(), CVPCB_MAINFRAME::BuildLibrariesList(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockLoadWithOptionalNickname(), filterFootprints(), SCH::filterFootprintUsers(), FOOTPRINT_LIBRARY_ADAPTER::GenerateTimestamp(), SYMBOL_LIBRARY_MANAGER::GetLibraryCount(), PCB_BASE_FRAME::GetLibraryItemsForListDialog(), SCH_BASE_FRAME::GetLibraryItemsForListDialog(), guessNickname(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprintWithOptionalNickname(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), FOOTPRINT_LIBRARY_ADAPTER::RefreshChangedLibraries(), SAVE_AS_DIALOG::SAVE_AS_DIALOG(), and Type().
|
inherited |
Returns the status of a loaded library, or nullopt if the library hasn't been loaded (yet)
Definition at line 2096 of file library_manager.cpp.
References find, globalLibs(), globalLibsMutex(), m_libraries, and m_librariesMutex.
Referenced by GetLibraryStatuses(), API_HANDLER_LIBRARIES::handleGetLibraryStatuses(), DESIGN_BLOCK_LIBRARY_ADAPTER::libraryUnavailableMessage(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), and CV::testFootprintLink().
|
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().
| int SYMBOL_LIBRARY_ADAPTER::GetModifyHash | ( | ) | const |
Definition at line 505 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), SCH_IO::GetModifyHash(), LIBRARY_MANAGER_ADAPTER::m_manager, result, LIB_DATA::row, schplugin(), and Type().
Referenced by SYMBOL_LIBRARY_MANAGER::GetHash().
|
inherited |
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
Definition at line 1555 of file library_manager.cpp.
References m_manager, and Type().
Referenced by PANEL_PREVIEW_3D_MODEL::alignmentModel(), BOOST_AUTO_TEST_CASE(), EXPORTER_STEP::buildFootprint3DShapes(), FOOTPRINT_EDITOR_CONTROL::CompareLibraryWithFile(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), IDF_EXPORTER::exportFootprintIdfModels(), SYMBOL_EDITOR_CONTROL::ExportForOlderVersion(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), BOARD_ADAPTER::GetFootprintLibraryPath(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDIT_FRAME::IsSymbolFromLegacyLibrary(), SYMBOL_EDIT_FRAME::KiwayMailIn(), SYMBOL_VIEWER_FRAME::KiwayMailIn(), DESIGN_BLOCK_LIBRARY_ADAPTER::libraryUnavailableMessage(), SCH_SYMBOL::LoadAlternateFromLibrary(), SCH_EDIT_FRAME::LoadSheetFromFile(), PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), SYMBOL_EDIT_FRAME::saveLibrary(), PCB_BASE_FRAME::setFPWatcher(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), DIALOG_FOOTPRINT_ASSOCIATIONS::TransferDataToWindow(), Type(), SCH_SCREEN::UpdateSymbolLinks(), and PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists().
| std::vector< SUB_LIBRARY > SYMBOL_LIBRARY_ADAPTER::GetSubLibraries | ( | const wxString & | aNickname | ) | const |
Definition at line 424 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), SCH_IO::GetSubLibraryDescription(), SCH_IO::GetSubLibraryNames(), name, result, schplugin(), traceLibraries, and IO_ERROR::What().
Referenced by SYMBOL_VIEWER_FRAME::ReCreateLibList().
| std::vector< wxString > SYMBOL_LIBRARY_ADAPTER::GetSymbolNames | ( | const wxString & | aNickname, |
| SYMBOL_TYPE | aType = SYMBOL_TYPE::ALL_SYMBOLS ) |
Definition at line 238 of file symbol_library_adapter.cpp.
References SCH_IO::EnumerateSymbolLib(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), name, LIBRARY_TABLE_ROW::Nickname(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), POWER_ONLY, PropPowerSymsOnly, LIB_DATA::row, schplugin(), traceLibraries, and IO_ERROR::What().
Referenced by DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), ReconcileLegacyCacheSymbols(), and SYMBOL_VIEWER_FRAME::ReCreateLibList().
| std::vector< LIB_SYMBOL * > SYMBOL_LIBRARY_ADAPTER::GetSymbols | ( | const wxString & | aNickname, |
| SYMBOL_TYPE | aType = SYMBOL_TYPE::ALL_SYMBOLS ) |
Definition at line 200 of file symbol_library_adapter.cpp.
References SCH_IO::EnumerateSymbolLib(), LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_TABLE_ROW::Nickname(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), POWER_ONLY, PropPowerSymsOnly, LIB_DATA::row, schplugin(), LIB_ID::SetLibNickname(), traceLibraries, and IO_ERROR::What().
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::EnumerateSymbols(), SCH::filterFootprintUsers(), SYMBOL_LIBRARY_MANAGER::getOriginalSymbols(), SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary(), and SYMBOL_VIEWER_FRAME::ReCreateSymbolList().
|
protectedinherited |
Definition at line 1952 of file library_manager.cpp.
References LIBRARY_MANAGER::ExpandURI(), m_manager, and LIBRARY_TABLE_ROW::URI().
Referenced by asyncLoadLocked(), SYMBOL_LIBRARY_ADAPTER::CheckLibrary(), CreateLibrary(), DESIGN_BLOCK_LIBRARY_ADAPTER::DeleteDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::DeleteFootprint(), DeleteLibrary(), SYMBOL_LIBRARY_ADAPTER::DeleteSymbol(), DESIGN_BLOCK_LIBRARY_ADAPTER::DesignBlockExists(), enumerateLibrary(), FOOTPRINT_LIBRARY_ADAPTER::FootprintExists(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlockNames(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetDesignBlocks(), DESIGN_BLOCK_LIBRARY_ADAPTER::GetEnumeratedDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::GetFootprintNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbolNames(), SYMBOL_LIBRARY_ADAPTER::GetSymbols(), DESIGN_BLOCK_LIBRARY_ADAPTER::IsDesignBlockLibWritable(), FOOTPRINT_LIBRARY_ADAPTER::IsFootprintLibWritable(), SYMBOL_LIBRARY_ADAPTER::IsSymbolLibWritable(), IsWritable(), DESIGN_BLOCK_LIBRARY_ADAPTER::LoadDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::LoadFootprint(), DESIGN_BLOCK_LIBRARY_ADAPTER::LoadOne(), FOOTPRINT_LIBRARY_ADAPTER::LoadOne(), SYMBOL_LIBRARY_ADAPTER::LoadOne(), SYMBOL_LIBRARY_ADAPTER::LoadSymbol(), FOOTPRINT_LIBRARY_ADAPTER::RefreshLibraryIfChanged(), DESIGN_BLOCK_LIBRARY_ADAPTER::SaveDesignBlock(), FOOTPRINT_LIBRARY_ADAPTER::SaveFootprint(), SYMBOL_LIBRARY_ADAPTER::SaveSymbol(), and SYMBOL_LIBRARY_ADAPTER::ShowConfigurationDialog().
|
inlineoverrideprotectedvirtual |
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 186 of file symbol_library_adapter.h.
References GlobalLibraries, LIBRARY_MANAGER_ADAPTER::m_manager, and m_scopedGlobalLibraries.
|
inlineoverrideprotectedvirtual |
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 181 of file symbol_library_adapter.h.
References GlobalLibraries, LIBRARY_MANAGER_ADAPTER::m_manager, and m_scopedGlobalLibraries.
|
inlineoverrideprotectedvirtual |
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 196 of file symbol_library_adapter.h.
References GlobalLibraryMutex, LIBRARY_MANAGER_ADAPTER::m_manager, and m_scopedGlobalLibraryMutex.
|
inlineoverrideprotectedvirtual |
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 191 of file symbol_library_adapter.h.
References GlobalLibraryMutex, LIBRARY_MANAGER_ADAPTER::m_manager, and m_scopedGlobalLibraryMutex.
|
static |
Definition at line 64 of file symbol_library_adapter.cpp.
References ENV_VAR::GetVersionedEnvVarName().
|
inherited |
|
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().
|
inherited |
Test for the existence of aNickname in the library tables.
| aNickname | is the library nickname. |
| aCheckEnabled | if true will only return true for enabled libraries |
Definition at line 1503 of file library_manager.cpp.
References fetchIfLoaded().
Referenced by SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDIT_FRAME::addLibTableEntry(), BOOST_AUTO_TEST_CASE(), SYMBOL_VIEWER_FRAME::ClickOnLibList(), SYMBOL_EDIT_FRAME::DdAddLibrary(), BOARD_INSPECTION_TOOL::DiffFootprint(), SCH_INSPECTION_TOOL::DiffSymbol(), FOOTPRINT_LIBRARY_ADAPTER::GenerateTimestamp(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), FOOTPRINT_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), SYMBOL_LIBRARY_MANAGER::LibraryExists(), SCH_SYMBOL::LoadAlternateFromLibrary(), SCH_EDIT_FRAME::LoadSheetFromFile(), PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), SYMBOL_EDIT_FRAME::saveLibrary(), SCH_BASE_FRAME::SelectLibrary(), CV::testFootprintLink(), Type(), and SCH_SCREEN::UpdateSymbolLinks().
|
inherited |
Definition at line 1730 of file library_manager.cpp.
References find, globalLibs(), globalLibsMutex(), LOADED, m_libraries, and m_librariesMutex.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CV::getFootprintPadNumbers(), SYMBOL_LIBRARY_MANAGER::IsLibraryLoaded(), loadLibrary(), DRC_TEST_PROVIDER_LIBRARY_PARITY::Run(), and ERC_TESTER::TestLibSymbolIssues().
| bool SYMBOL_LIBRARY_ADAPTER::IsSymbolLibWritable | ( | const wxString & | aNickname | ) |
Return true if the library given by aNickname is writable.
It is possible that some symbols libraries are read only because of where they are installed.
| aNickname | is the library nickname in the symbol library table. |
| IO_ERROR | if no library at aNickname exists. |
Definition at line 378 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), and LIBRARY_MANAGER_ADAPTER::getUri().
Referenced by SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly(), and HEADLESS_SYMBOL_EDITOR_CONTEXT::SaveSymbol().
|
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.
|
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.
|
virtualinherited |
Definition at line 1750 of file library_manager.cpp.
References find, globalLibs(), globalLibsMutex(), m_libraries, and m_librariesMutex.
Referenced by LIB_TABLE_GRID_TRICKS::onGridCellLeftClick().
|
protectedinherited |
Definition at line 2024 of file library_manager.cpp.
References createPlugin(), GLOBAL, LIB_DATA::global_owner, LIB_STATUS::load_status, LOADING, m_manager, LIBRARY_TABLE_ROW::Nickname(), LIB_DATA::plugin, plugin(), result, LIB_DATA::row, LIB_DATA::status, traceLibraries, and Type().
Referenced by enumerateLibrary(), loadIfNeeded(), and ReloadLibraryEntry().
|
protectedinherited |
Fetches a loaded library, triggering a load of that library if it isn't loaded yet.
Definition at line 2078 of file library_manager.cpp.
References _, GLOBAL, globalLibs(), globalLibsMutex(), loadFromScope(), m_libraries, m_librariesMutex, PROJECT, and result.
Referenced by CreateLibrary(), DeleteLibrary(), SYMBOL_LIBRARY_ADAPTER::DeleteSymbol(), enumerateLibrary(), LoadLibraryEntry(), DESIGN_BLOCK_LIBRARY_ADAPTER::LoadOne(), FOOTPRINT_LIBRARY_ADAPTER::LoadOne(), SYMBOL_LIBRARY_ADAPTER::LoadOne(), loadQueuedRow(), and SYMBOL_LIBRARY_ADAPTER::SaveSymbol().
|
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().
|
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().
| std::optional< LIB_STATUS > SYMBOL_LIBRARY_ADAPTER::LoadOne | ( | const wxString & | aNickname | ) |
Loads or reloads the given library, if it exists.
Definition at line 153 of file symbol_library_adapter.cpp.
References LOAD_ERROR, LIBRARY_MANAGER_ADAPTER::loadIfNeeded(), LoadOne(), and result.
|
overridevirtual |
Loads or reloads the given library, if it exists.
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 89 of file symbol_library_adapter.cpp.
References SCH_IO::EnumerateSymbolLib(), LIB_STATUS::error, LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), INVALID, LOAD_ERROR, LIB_STATUS::load_status, LOADED, LOADING, LIBRARY_MANAGER_ADAPTER::m_abortGeneration, LIBRARY_MANAGER_ADAPTER::m_cancelling, LIBRARY_TABLE_ROW::Nickname(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), IO_ERROR::Problem(), LIB_DATA::row, schplugin(), LIB_DATA::status, traceLibraries, IO_ERROR::What(), and IO_ERROR::Where().
Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDIT_FRAME::addLibTableEntry(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_EDIT_FRAME::DdAddLibrary(), SCH_SYMBOL::LoadAlternateFromLibrary(), LoadOne(), SCH_IO_EAGLE::LoadSchematicFile(), RegisterLocalSymbolLibraries(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), and SCH_SCREEN::UpdateSymbolLinks().
|
privateinherited |
Loads one queued library on a worker thread.
Definition at line 2278 of file library_manager.cpp.
References enumerateLibrary(), LIB_STATUS::error, INVALID, LIBRARY_MANAGER_ADAPTER(), LOAD_ERROR, LIB_STATUS::load_status, LOADED, loadIfNeeded(), LOADING, m_cancelling, m_loading, m_loadingMutex, LIBRARY_MANAGER_ADAPTER::LOAD_WORK::nickname, IO_ERROR::Problem(), queuedRowEntry(), result, LIBRARY_MANAGER_ADAPTER::LOAD_WORK::scope, scopeMutex(), LIB_DATA::status, traceLibraries, LIBRARY_MANAGER_ADAPTER::LOAD_WORK::uri, IO_ERROR::What(), and IO_ERROR::Where().
|
inline |
Definition at line 113 of file symbol_library_adapter.h.
References LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), and LoadSymbol().
| LIB_SYMBOL * SYMBOL_LIBRARY_ADAPTER::LoadSymbol | ( | const wxString & | aNickname, |
| const wxString & | aName ) |
Load a LIB_SYMBOL having aName from the library given by aNickname.
| aNickname | is a locator for the "library", it is a "name" in LIBRARY_TABLE_ROW |
| aName | is the name of the LIB_SYMBOL to load. |
| IO_ERROR | if the library cannot be found or read. No exception is thrown in the case where aNickname cannot be found. |
Definition at line 272 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), LIBRARY_MANAGER_ADAPTER::getUri(), SCH_IO::LoadSymbol(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), schplugin(), LIB_ID::SetLibNickname(), and traceLibraries.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SCH_INSPECTION_TOOL::DiffSymbol(), SYMBOL_PREVIEW_WIDGET::DisplaySymbol(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SYMBOL_LIBRARY_MANAGER::GetSymbol(), SCH::IFACE::handleOpenSymbol(), API_HANDLER_SCH::handlePlaceSymbolFromLibrary(), SCH_SYMBOL::LoadAlternateFromLibrary(), HEADLESS_SYMBOL_EDITOR_CONTEXT::LoadSymbol(), SYMBOL_EDIT_FRAME::LoadSymbol(), LoadSymbol(), SYMBOL_EDIT_FRAME::LoadSymbolFromLib(), API_HANDLER_SCH_LIBRARIES::packLibraryItem(), PANEL_SYMBOL_CHOOSER::populateFootprintSelector(), ReconcileLegacyCacheSymbols(), HEADLESS_SYMBOL_EDITOR_CONTEXT::RevertSymbol(), SchGetLibSymbol(), SCH_EDIT_TOOL::SetVariantSymbol(), PANEL_SYMBOL_CHOOSER::showFootprintFor(), SYMBOL_LIBRARY_MANAGER::SymbolExists(), ERC_TESTER::TestLibSymbolIssues(), ERC_TESTER::TestVariantSymbols(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), and SCH_SCREEN::UpdateSymbolLinks().
|
inherited |
Definition at line 1156 of file library_manager.cpp.
References m_manager.
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 205 of file symbol_library_adapter.h.
References schplugin().
Referenced by createPlugin(), SaveSymbol(), ShowConfigurationDialog(), and SupportsConfigurationDialog().
|
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().
|
virtualinherited |
Notify the adapter that the active project has changed.
Definition at line 1162 of file library_manager.cpp.
References resetProjectCache().
|
inherited |
Retrieves the project library table for this adapter type, or nullopt if one doesn't exist.
Definition at line 1462 of file library_manager.cpp.
References m_manager, PROJECT, and Type().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SCH_IO_EAGLE::LoadSchematicFile(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_EDIT_FRAME::OpenProjectFiles(), and Type().
|
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().
|
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().
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().
|
inherited |
Synchronously recreates the plugin for and reloads the given library.
Definition at line 1835 of file library_manager.cpp.
References abortLoad(), BOTH, GLOBAL, globalLibs(), globalLibsMutex(), loadFromScope(), LoadOne(), m_libraries, m_librariesMutex, PROJECT, RestartAsyncLoad(), result, traceLibraries, and UNINITIALIZED.
Referenced by SCH_IO_EAGLE::LoadSchematicFile(), and SYMBOL_LIBRARY_ADAPTER::ShowConfigurationDialog().
|
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().
|
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().
|
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().
|
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().
|
inherited |
Like LIBRARY_MANAGER::Rows but filtered to the LIBRARY_TABLE_TYPE of this adapter.
Definition at line 1548 of file library_manager.cpp.
References m_manager, and Type().
Referenced by CV::getFootprintPadNumbers(), API_HANDLER_LIBRARIES::handleGetLibraryItems(), DESIGN_BLOCK_LIBRARY_ADAPTER::libraryUnavailableMessage(), CVPCB_MAINFRAME::LoadFootprintFiles(), LoadNetlistFootprints(), ReconcileLegacyCacheSymbols(), and Type().
|
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.
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().
| SYMBOL_LIBRARY_ADAPTER::SAVE_T SYMBOL_LIBRARY_ADAPTER::SaveSymbol | ( | const wxString & | aNickname, |
| std::unique_ptr< LIB_SYMBOL > | aSymbol, | ||
| bool | aOverwrite = true ) |
Write aSymbol to an existing library given by aNickname.
If a LIB_SYMBOL by the same name already exists or there are any conflicting alias names, the new LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries cannot have duplicate alias names. It is the responsibility of the caller to check the library for conflicts before saving.
| aNickname | is a locator for the "library", it is a "name" in LIB_TABLE_ROW |
| aSymbol | is what to store in the library. The library owns the symbol after this call. |
| aOverwrite | when true means overwrite any existing symbol by the same name, else if false means skip the write and return SAVE_SKIPPED. |
| IO_ERROR | if there is a problem saving the symbol. |
Definition at line 297 of file symbol_library_adapter.cpp.
References LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_MANAGER_ADAPTER::loadIfNeeded(), plugin(), LIBRARY_MANAGER_ADAPTER::pluginMutex(), LIB_DATA::row, SAVE_OK, SAVE_SKIPPED, schplugin(), traceLibraries, and IO_ERROR::What().
Referenced by SaveRemoteSymbolToLibrary(), and HEADLESS_SYMBOL_EDITOR_CONTEXT::SaveSymbol().
Definition at line 70 of file symbol_library_adapter.cpp.
References LIB_DATA::plugin.
Referenced by CheckLibrary(), DeleteSymbol(), enumerateLibrary(), GetAvailableExtraFields(), GetLibraryModifyHash(), GetModifyHash(), GetSubLibraries(), GetSymbolNames(), GetSymbols(), LoadOne(), LoadSymbol(), plugin(), SaveSymbol(), and SupportsSubLibraries().
|
privateinherited |
Definition at line 2356 of file library_manager.cpp.
References GLOBAL, globalLibsMutex(), and m_librariesMutex.
Referenced by loadQueuedRow().
|
overridevirtual |
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 from LIBRARY_MANAGER_ADAPTER.
Definition at line 473 of file symbol_library_adapter.cpp.
References SCH_IO_MGR::EnumFromStr(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_MANAGER_ADAPTER::m_manager, LIBRARY_TABLE_ROW::Nickname(), path, plugin(), LIBRARY_MANAGER_ADAPTER::ReloadLibraryEntry(), LIBRARY_TABLE_ROW::Type(), Type(), and LIBRARY_TABLE_ROW::URI().
|
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().
|
overridevirtual |
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 from LIBRARY_MANAGER_ADAPTER.
Definition at line 455 of file symbol_library_adapter.cpp.
References SCH_IO_MGR::EnumFromStr(), plugin(), and LIBRARY_TABLE_ROW::Type().
| bool SYMBOL_LIBRARY_ADAPTER::SupportsSubLibraries | ( | const wxString & | aNickname | ) | const |
Definition at line 412 of file symbol_library_adapter.cpp.
References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), result, schplugin(), and SCH_IO::SupportsSubLibraries().
Referenced by SYMBOL_VIEWER_FRAME::ReCreateLibList(), and SYMBOL_VIEWER_FRAME::ReCreateSymbolList().
|
inlineoverridevirtual |
The type of library table this adapter works with.
Implements LIBRARY_MANAGER_ADAPTER.
Definition at line 63 of file symbol_library_adapter.h.
References SYMBOL.
Referenced by GetModifyHash(), and ShowConfigurationDialog().
|
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().
|
staticprivate |
Definition at line 214 of file symbol_library_adapter.h.
Referenced by globalLibs(), and globalLibs().
|
staticprivate |
Definition at line 218 of file symbol_library_adapter.h.
Referenced by globalLibsMutex(), and globalLibsMutex().
|
protectedinherited |
Definition at line 347 of file library_manager.h.
Referenced by abortLoad().
|
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().
|
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().
|
protectedinherited |
Definition at line 355 of file library_manager.h.
Referenced by abortLoad(), asyncLoadLocked(), and BlockUntilLoaded().
|
protectedinherited |
Definition at line 339 of file library_manager.h.
Referenced by asyncLoadLocked(), fetchIfLoaded(), fetchIfLoaded(), GetLibraryStatus(), IsLibraryLoaded(), LeakCachesAtExit(), LibraryError(), loadIfNeeded(), ProjectTablesReloaded(), queuedRowEntry(), ReloadLibraryEntry(), resetProjectCache(), retireAllLibraries(), and withPlugin().
|
mutableprotectedinherited |
Definition at line 341 of file library_manager.h.
Referenced by asyncLoadLocked(), fetchIfLoaded(), fetchIfLoaded(), GetLibraryStatus(), IsLibraryLoaded(), LeakCachesAtExit(), LibraryError(), loadIfNeeded(), ProjectTablesReloaded(), ReloadLibraryEntry(), resetProjectCache(), retireAllLibraries(), scopeMutex(), and withPlugin().
|
protectedinherited |
Definition at line 362 of file library_manager.h.
Referenced by abortLoad(), asyncLoadLocked(), AsyncLoadProgress(), and BlockUntilLoaded().
|
protectedinherited |
Definition at line 345 of file library_manager.h.
Referenced by loadingSnapshot(), and loadQueuedRow().
|
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().
|
protectedinherited |
Definition at line 364 of file library_manager.h.
Referenced by abortLoad(), AsyncLoad(), BlockUntilLoaded(), and RestartAsyncLoad().
|
protectedinherited |
Definition at line 363 of file library_manager.h.
Referenced by abortLoad(), asyncLoadLocked(), AsyncLoadProgress(), and BlockUntilLoaded().
|
protectedinherited |
Definition at line 336 of file library_manager.h.
Referenced by asyncLoadLocked(), DESIGN_BLOCK_LIBRARY_ADAPTER::createPlugin(), FOOTPRINT_LIBRARY_ADAPTER::createPlugin(), SYMBOL_LIBRARY_ADAPTER::createPlugin(), fetchIfLoaded(), fetchIfLoaded(), FindLibraryByURI(), FindRowByURI(), GetLibraryNames(), GetLibraryStatuses(), SYMBOL_LIBRARY_ADAPTER::GetModifyHash(), GetRow(), getUri(), SYMBOL_LIBRARY_ADAPTER::globalLibs(), SYMBOL_LIBRARY_ADAPTER::globalLibs(), SYMBOL_LIBRARY_ADAPTER::globalLibsMutex(), SYMBOL_LIBRARY_ADAPTER::globalLibsMutex(), GlobalTable(), LIBRARY_MANAGER_ADAPTER(), loadFromScope(), Manager(), ProjectTable(), ProjectTablesReloaded(), Rows(), and SYMBOL_LIBRARY_ADAPTER::ShowConfigurationDialog().
|
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().
|
mutableprivate |
Definition at line 211 of file symbol_library_adapter.h.
Referenced by globalLibs(), and globalLibs().
|
mutableprivate |
Definition at line 212 of file symbol_library_adapter.h.
Referenced by globalLibsMutex(), and globalLibsMutex().
|
static |
Definition at line 56 of file symbol_library_adapter.h.
|
static |
Definition at line 55 of file symbol_library_adapter.h.
Referenced by SCH_IO_ALTIUM::doEnumerateSymbolLib(), SCH_IO_DATABASE::EnumerateSymbolLib(), SCH_IO_HTTP_LIB::EnumerateSymbolLib(), SCH_IO_HTTP_LIB::EnumerateSymbolLib(), SCH_IO_KICAD_LEGACY::EnumerateSymbolLib(), SCH_IO_KICAD_LEGACY::EnumerateSymbolLib(), SCH_IO_KICAD_SEXPR::EnumerateSymbolLib(), SCH_IO_KICAD_SEXPR::EnumerateSymbolLib(), SCH_IO_PADS::EnumerateSymbolLib(), SCH_IO_PADS::EnumerateSymbolLib(), GetSymbolNames(), and GetSymbols().