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

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>

Inheritance diagram for SYMBOL_LIBRARY_ADAPTER:
LIBRARY_MANAGER_ADAPTER

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)
 
LIBRARY_TABLE_TYPE Type () const override
 The type of library table this adapter works with.
 
std::optional< LIB_STATUSLoadOne (LIB_DATA *aLib) override
 Loads or reloads the given library, if it exists.
 
std::optional< LIB_STATUSLoadOne (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_LIBRARYGetSubLibraries (const wxString &aNickname) const
 
bool SupportsConfigurationDialog (const wxString &aNickname) const override
 
void ShowConfigurationDialog (const wxString &aNickname, wxWindow *aParent) const override
 
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_SYMBOLLoadSymbol (const wxString &aNickname, const wxString &aName)
 Load a LIB_SYMBOL having aName from the library given by aNickname.
 
LIB_SYMBOLLoadSymbol (const LIB_ID &aLibId)
 
SAVE_T SaveSymbol (const wxString &aNickname, const 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
 
LIBRARY_MANAGERManager () const
 
LIBRARY_TABLEGlobalTable () 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 CheckTableRow (LIBRARY_TABLE_ROW &aRow)
 
void AsyncLoad ()
 Loads all available libraries for this adapter type in the background.
 
std::optional< float > AsyncLoadProgress () const
 Returns async load progress between 0.0 and 1.0, or nullopt if load is not in progress.
 
void BlockUntilLoaded ()
 
void AbortAsyncLoad ()
 Aborts any async load in progress; blocks until fully done aborting.
 
bool IsLibraryLoaded (const wxString &aNickname)
 
std::optional< LIB_STATUSGetLibraryStatus (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)
 
wxString 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)
 
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_ERRORLibraryError (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 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) 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_BASEplugin (const LIB_DATA *aRow) override
 
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 abortLoad ()
 Aborts any async load in progress; blocks until fully done aborting.
 

Static Protected Member Functions

static wxString getUri (const LIBRARY_TABLE_ROW *aRow)
 

Protected Attributes

LIBRARY_MANAGERm_manager
 
std::map< wxString, LIB_DATAm_libraries
 
std::shared_mutex m_librariesMutex
 
std::atomic_bool m_abort
 
std::vector< std::future< void > > m_futures
 
std::atomic< size_t > m_loadCount { 0 }
 
std::atomic< size_t > m_loadTotal { 0 }
 
std::mutex m_loadMutex
 

Static Private Member Functions

static SCH_IOschplugin (const LIB_DATA *aRow)
 

Static Private Attributes

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

Detailed Description

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 50 of file symbol_library_adapter.h.

Member Enumeration Documentation

◆ SAVE_T

The set of return values from SaveSymbol() below.

Enumerator
SAVE_OK 
SAVE_SKIPPED 

Definition at line 110 of file symbol_library_adapter.h.

◆ SYMBOL_TYPE

Enumerator
ALL_SYMBOLS 
POWER_ONLY 

Definition at line 80 of file symbol_library_adapter.h.

Constructor & Destructor Documentation

◆ SYMBOL_LIBRARY_ADAPTER()

SYMBOL_LIBRARY_ADAPTER::SYMBOL_LIBRARY_ADAPTER ( LIBRARY_MANAGER & aManager)

Member Function Documentation

◆ AbortAsyncLoad()

void LIBRARY_MANAGER_ADAPTER::AbortAsyncLoad ( )
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.

Definition at line 814 of file library_manager.cpp.

References abortLoad().

Referenced by LoadOne().

◆ abortLoad()

void LIBRARY_MANAGER_ADAPTER::abortLoad ( )
protectedinherited

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

Definition at line 989 of file library_manager.cpp.

References BlockUntilLoaded(), m_abort, m_futures, m_loadCount, m_loadMutex, m_loadTotal, and traceLibraries.

Referenced by AbortAsyncLoad(), CheckTableRow(), enumerateLibrary(), GlobalTablesChanged(), and ProjectChanged().

◆ AsyncLoad()

◆ AsyncLoadProgress()

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

Returns async load progress between 0.0 and 1.0, or nullopt if load is not in progress.

Definition at line 1014 of file library_manager.cpp.

References m_loadCount, and m_loadTotal.

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

◆ BlockUntilLoaded()

◆ CheckTableRow()

void LIBRARY_MANAGER_ADAPTER::CheckTableRow ( LIBRARY_TABLE_ROW & aRow)
inherited

◆ CreateLibrary()

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

Creates the library (i.e. saves to disk) for the given row if it exists.

Definition at line 1190 of file library_manager.cpp.

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

Referenced by SYMBOL_LIBRARY_MANAGER::addLibrary(), and LoadOne().

◆ createPlugin()

LIBRARY_RESULT< IO_BASE * > SYMBOL_LIBRARY_ADAPTER::createPlugin ( const LIBRARY_TABLE_ROW * row)
overrideprotectedvirtual

◆ 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 937 of file library_manager.cpp.

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

Referenced by Type().

◆ DeleteSymbol()

void SYMBOL_LIBRARY_ADAPTER::DeleteSymbol ( const wxString & aNickname,
const wxString & aSymbolName )

Deletes the aSymbolName from the library given by aNickname.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW.
aSymbolNameis the name of a symbol to delete from the specified library.
Exceptions
IO_ERRORif there is a problem finding the footprint or the library, or deleting it.

Definition at line 288 of file symbol_library_adapter.cpp.

◆ enumerateLibrary()

void SYMBOL_LIBRARY_ADAPTER::enumerateLibrary ( LIB_DATA * aLib)
overrideprotectedvirtual

Override in derived class to perform library-specific enumeration.

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 71 of file symbol_library_adapter.cpp.

References SCH_IO::EnumerateSymbolLib(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIB_DATA::row, and schplugin().

◆ fetchIfLoaded() [1/2]

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

◆ fetchIfLoaded() [2/2]

◆ FindLibraryByURI()

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

Definition at line 894 of file library_manager.cpp.

References m_manager, Type(), and LIBRARY_MANAGER::UrisAreEquivalent().

Referenced by Type().

◆ 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 981 of file library_manager.cpp.

References m_manager, and Type().

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

◆ GetAvailableExtraFields()

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 314 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().

◆ GetLibraryDescription()

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

◆ GetLibraryLoadErrors()

wxString LIBRARY_MANAGER_ADAPTER::GetLibraryLoadErrors ( ) const
inherited

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

Definition at line 1105 of file library_manager.cpp.

References _, GetLibraryStatuses(), and LOAD_ERROR.

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

◆ GetLibraryNames()

◆ GetLibraryStatus()

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

Returns the status of a loaded library, or nullopt if the library hasn't been loaded (yet)

Definition at line 1340 of file library_manager.cpp.

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

Referenced by GetLibraryStatuses(), CV::kiface(), LoadOne(), and SCH_EDIT_FRAME::OpenProjectFiles().

◆ 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 1081 of file library_manager.cpp.

References _, GetLibraryStatus(), LOAD_ERROR, m_manager, result, and Type().

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

◆ GetModifyHash()

◆ GetRow()

◆ GetSubLibraries()

std::vector< SUB_LIBRARY > SYMBOL_LIBRARY_ADAPTER::GetSubLibraries ( const wxString & aNickname) const

◆ GetSymbolNames()

◆ GetSymbols()

◆ getUri()

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

◆ globalLibs() [1/2]

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

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 159 of file symbol_library_adapter.h.

References GlobalLibraries.

◆ globalLibs() [2/2]

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

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 158 of file symbol_library_adapter.h.

References GlobalLibraries.

◆ globalLibsMutex() [1/2]

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

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 161 of file symbol_library_adapter.h.

References GlobalLibraryMutex.

◆ globalLibsMutex() [2/2]

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

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 160 of file symbol_library_adapter.h.

References GlobalLibraryMutex.

◆ GlobalPathEnvVariableName()

wxString SYMBOL_LIBRARY_ADAPTER::GlobalPathEnvVariableName ( )
static

Definition at line 57 of file symbol_library_adapter.cpp.

References ENV_VAR::GetVersionedEnvVarName().

◆ GlobalTable()

LIBRARY_TABLE * LIBRARY_MANAGER_ADAPTER::GlobalTable ( ) const
inherited

Retrieves the global library table for this adapter type.

Definition at line 881 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 820 of file library_manager.cpp.

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

Referenced by Type().

◆ HasLibrary()

◆ IsLibraryLoaded()

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

◆ IsSymbolLibWritable()

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.

Parameters
aNicknameis the library nickname in the symbol library table.
Exceptions
IO_ERRORif no library at aNickname exists.

Definition at line 294 of file symbol_library_adapter.cpp.

References LIBRARY_MANAGER_ADAPTER::getUri(), GlobalLibraries, GlobalLibraryMutex, LIBRARY_MANAGER_ADAPTER::m_libraries, and LIBRARY_MANAGER_ADAPTER::m_librariesMutex.

Referenced by SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly().

◆ 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 1178 of file library_manager.cpp.

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

Referenced by LoadOne().

◆ LibraryError()

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

◆ 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

◆ LoadOne() [1/2]

std::optional< LIB_STATUS > SYMBOL_LIBRARY_ADAPTER::LoadOne ( const wxString & aNickname)

Loads or reloads the given library, if it exists.

Definition at line 103 of file symbol_library_adapter.cpp.

References LOAD_ERROR, LIBRARY_MANAGER_ADAPTER::loadIfNeeded(), LoadOne(), and result.

◆ LoadOne() [2/2]

◆ LoadSymbol() [1/2]

LIB_SYMBOL * SYMBOL_LIBRARY_ADAPTER::LoadSymbol ( const LIB_ID & aLibId)
inline

◆ LoadSymbol() [2/2]

LIB_SYMBOL * SYMBOL_LIBRARY_ADAPTER::LoadSymbol ( const wxString & aNickname,
const wxString & aName )

◆ Manager()

LIBRARY_MANAGER & LIBRARY_MANAGER_ADAPTER::Manager ( ) const
inherited

Definition at line 797 of file library_manager.cpp.

References m_manager.

◆ plugin()

IO_BASE * SYMBOL_LIBRARY_ADAPTER::plugin ( const LIB_DATA * aRow)
inlineoverrideprotectedvirtual

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 167 of file symbol_library_adapter.h.

References schplugin().

Referenced by createPlugin(), and SaveSymbol().

◆ ProjectChanged()

void LIBRARY_MANAGER_ADAPTER::ProjectChanged ( )
virtualinherited

Notify the adapter that the active project has changed.

Definition at line 803 of file library_manager.cpp.

References abortLoad(), m_libraries, and m_librariesMutex.

◆ ProjectTable()

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

Retrieves the project library table for this adapter type, or nullopt if one doesn't exist.

Definition at line 888 of file library_manager.cpp.

References m_manager, PROJECT, and Type().

Referenced by SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_EAGLE::LoadSchematicFile(), SCH_IO_EASYEDAPRO::LoadSchematicFile(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_EDIT_FRAME::OpenProjectFiles(), and Type().

◆ ReloadLibraryEntry()

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

◆ Rows()

std::vector< LIBRARY_TABLE_ROW * > LIBRARY_MANAGER_ADAPTER::Rows ( LIBRARY_TABLE_SCOPE aScope = LIBRARY_TABLE_SCOPE::BOTH,
bool aIncludeInvalid = false ) const
inherited

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

Definition at line 967 of file library_manager.cpp.

References m_manager, and Type().

Referenced by CVPCB_MAINFRAME::LoadFootprintFiles(), and Type().

◆ SaveSymbol()

SYMBOL_LIBRARY_ADAPTER::SAVE_T SYMBOL_LIBRARY_ADAPTER::SaveSymbol ( const wxString & aNickname,
const 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.

Parameters
aNicknameis a locator for the "library", it is a "name" in LIB_TABLE_ROW
aSymbolis what to store in the library. The library owns the symbol after this call.
aOverwritewhen true means overwrite any existing symbol by the same name, else if false means skip the write and return SAVE_SKIPPED.
Returns
SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
Exceptions
IO_ERRORif there is a problem saving the symbol.

Definition at line 229 of file symbol_library_adapter.cpp.

References LIB_SYMBOL::GetName(), LIBRARY_TABLE_ROW::GetOptionsMap(), LIBRARY_MANAGER_ADAPTER::getUri(), LIBRARY_MANAGER_ADAPTER::loadIfNeeded(), plugin(), LIB_DATA::row, SAVE_OK, SAVE_SKIPPED, schplugin(), traceLibraries, and IO_ERROR::What().

Referenced by PANEL_REMOTE_SYMBOL::receiveSymbol().

◆ schplugin()

SCH_IO * SYMBOL_LIBRARY_ADAPTER::schplugin ( const LIB_DATA * aRow)
staticprivate

◆ ShowConfigurationDialog()

void SYMBOL_LIBRARY_ADAPTER::ShowConfigurationDialog ( const wxString & aNickname,
wxWindow * aParent ) const
overridevirtual

◆ SupportsConfigurationDialog()

bool SYMBOL_LIBRARY_ADAPTER::SupportsConfigurationDialog ( const wxString & aNickname) const
overridevirtual

Reimplemented from LIBRARY_MANAGER_ADAPTER.

Definition at line 371 of file symbol_library_adapter.cpp.

References LIBRARY_MANAGER_ADAPTER::fetchIfLoaded(), and result.

◆ SupportsSubLibraries()

bool SYMBOL_LIBRARY_ADAPTER::SupportsSubLibraries ( const wxString & aNickname) const

◆ Type()

LIBRARY_TABLE_TYPE SYMBOL_LIBRARY_ADAPTER::Type ( ) const
inlineoverridevirtual

The type of library table this adapter works with.

Implements LIBRARY_MANAGER_ADAPTER.

Definition at line 59 of file symbol_library_adapter.h.

References SYMBOL.

Referenced by GetModifyHash().

Member Data Documentation

◆ GlobalLibraries

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

Definition at line 172 of file symbol_library_adapter.h.

Referenced by globalLibs(), globalLibs(), and IsSymbolLibWritable().

◆ GlobalLibraryMutex

std::shared_mutex SYMBOL_LIBRARY_ADAPTER::GlobalLibraryMutex
staticprivate

Definition at line 173 of file symbol_library_adapter.h.

Referenced by globalLibsMutex(), globalLibsMutex(), and IsSymbolLibWritable().

◆ m_abort

std::atomic_bool LIBRARY_MANAGER_ADAPTER::m_abort
protectedinherited

Definition at line 211 of file library_manager.h.

Referenced by abortLoad().

◆ m_futures

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

Definition at line 212 of file library_manager.h.

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

◆ m_libraries

◆ m_librariesMutex

◆ m_loadCount

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

Definition at line 214 of file library_manager.h.

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

◆ m_loadMutex

std::mutex LIBRARY_MANAGER_ADAPTER::m_loadMutex
protectedinherited

Definition at line 216 of file library_manager.h.

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

◆ m_loadTotal

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

Definition at line 215 of file library_manager.h.

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

◆ m_manager

◆ PropNonPowerSymsOnly

const char * SYMBOL_LIBRARY_ADAPTER::PropNonPowerSymsOnly = "non_pwr_sym_only"
static

Definition at line 54 of file symbol_library_adapter.h.

◆ PropPowerSymsOnly


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