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

A KiCad database library provides both symbol and footprint metadata, so there are "shim" plugins on both the symbol and footprint side of things that expose the database contents to the schematic and board editors. More...

#include <sch_io_database.h>

Inheritance diagram for SCH_IO_DATABASE:
SCH_IO IO_BASE

Classes

struct  PREVIEW_ISSUE
 A problem found while previewing, tagged with the setting that caused it. More...
 

Public Types

using PREVIEW_ISSUES = std::vector<PREVIEW_ISSUE>
 

Public Member Functions

 SCH_IO_DATABASE ()
 
virtual ~SCH_IO_DATABASE ()
 
const IO_BASE::IO_FILE_DESC GetLibraryDesc () const override
 Get the descriptor for the library container that this IO plugin operates on.
 
int GetModifyHash () const override
 Return the modification hash from the library cache.
 
void EnumerateSymbolLib (wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
 
void EnumerateSymbolLib (std::vector< LIB_SYMBOL * > &aSymbolList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.
 
void CheckLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Validate that the library at aLibraryPath is reachable and well-formed, without necessarily loading symbol data.
 
LIB_SYMBOL * LoadSymbol (const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.
 
bool SupportsSubLibraries () const override
 
void GetSubLibraryNames (std::vector< wxString > &aNames) override
 Retrieves a list of sub-libraries in this library.
 
void GetAvailableSymbolFields (std::vector< wxString > &aNames) override
 Retrieves a list of (custom) field names that are present on symbols in this library.
 
void GetDefaultSymbolFields (std::vector< wxString > &aNames) override
 Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
void SetLibraryManagerAdapter (SYMBOL_LIBRARY_ADAPTER *aAdapter) override
 Some library plugins need to interface with other loaded libraries.
 
bool SupportsConfigurationDialog () const override
 
DIALOG_SHIM * CreateConfigurationDialog (wxWindow *aParent, const wxString &aLibraryPath) override
 
DATABASE_LIB_SETTINGS * Settings () const
 
virtual const IO_BASE::IO_FILE_DESC GetSchematicFileDesc () const
 Returns schematic file description for the SCH_IO.
 
virtual bool CanReadSchematicFile (const wxString &aFileName) const
 Checks if this SCH_IO can read the specified schematic file.
 
virtual void SaveLibrary (const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
virtual SCH_SHEET * LoadSchematicFile (const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Load information from some input file format that this SCH_IO implementation knows about, into either a new SCH_SHEET or an existing one.
 
virtual std::vector< LIB_SYMBOL * > GetImportedCachedLibrarySymbols ()
 Return the canonical symbol definitions produced by the last LoadSchematicFile().
 
virtual void SaveSchematicFile (const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.
 
virtual void SaveSymbol (const wxString &aLibraryPath, std::unique_ptr< LIB_SYMBOL > aSymbol, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Write aSymbol to an existing library located at aLibraryPath.
 
virtual void DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
 
virtual void GetLibraryOptions (std::map< std::string, UTF8 > *aListToAppendTo) const override
 Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.
 
virtual wxString GetSubLibraryDescription (const wxString &aName)
 Gets a description of a sublibrary.
 
virtual const wxString & GetError () const
 Return an error string to the caller.
 
const wxString & GetName () const
 Return a brief hard coded name for this IO interface.
 
virtual bool IsPCB_IO () const
 Work-around for lack of dynamic_cast across compile units on Mac.
 
virtual void SetReporter (REPORTER *aReporter)
 Set an optional reporter for warnings/errors.
 
virtual void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 Set an optional progress reporter.
 
virtual const IO_FILE_DESC GetLibraryFileDesc () const
 Get the descriptor for the individual library elements that this IO plugin operates on.
 
virtual bool CanReadLibrary (const wxString &aFileName) const
 Checks if this IO object can read the specified library file/directory.
 
virtual void CreateLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Create a new empty library at aLibraryPath empty.
 
virtual bool DeleteLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
 
virtual void Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) const
 
virtual void AdvanceProgressPhase ()
 

Static Public Member Functions

static wxString SymbolNameForRow (const DATABASE_LIB_TABLE &aTable, bool aGloballyUniqueKeys, const DATABASE_CONNECTION::ROW &aRow, std::string *aRawKey=nullptr)
 
static std::unique_ptr< DATABASE_CONNECTION > CreateConnection (const DATABASE_LIB_SETTINGS &aSettings, bool aConnectNow=true, const wxString &aBaseDir=wxEmptyString)
 Opens a connection described by aSettings, expanding ${CWD} in a connection string to the directory holding the settings file.
 
static std::vector< std::unique_ptr< LIB_SYMBOL > > BuildPreviewSymbols (SYMBOL_LIBRARY_ADAPTER *aLibs, const DATABASE_LIB_TABLE &aTable, bool aGloballyUniqueKeys, const std::vector< DATABASE_CONNECTION::ROW > &aRows, PREVIEW_ISSUES *aIssues)
 Builds symbols from already-fetched rows exactly as the library would name and load them, without opening a connection.
 

Protected Attributes

wxString m_name
 Name of the IO loader.
 
REPORTER * m_reporter
 Reporter to log errors/warnings to, may be nullptr.
 
PROGRESS_REPORTER * m_progressReporter
 Progress reporter to track the progress of the operation, may be nullptr.
 

Private Types

typedef std::vector< std::pair< const DATABASE_LIB_TABLE *, std::vector< DATABASE_CONNECTION::ROW > > > TABLE_RESULT_LIST
 

Private Member Functions

void cacheLib ()
 
size_t computeSignature (const TABLE_RESULT_LIST &aTableResults) const
 
bool materializeCache (const TABLE_RESULT_LIST &aTableResults, std::map< wxString, std::unique_ptr< LIB_SYMBOL > > &aSymbolCache, std::map< wxString, std::pair< std::string, std::string > > &aSanitizedNameMap)
 
void ensureSettings (const wxString &aSettingsPath)
 
void ensureConnection ()
 
void connect ()
 
std::unique_ptr< LIB_SYMBOL > loadSymbolFromRow (const wxString &aSymbolName, const DATABASE_LIB_TABLE &aTable, const DATABASE_CONNECTION::ROW &aRow)
 
LIB_SYMBOL * resolveSourceSymbol (const LIB_ID &aId)
 Resolves one entry of a row's symbols column through the library adapter.
 
void reportIssue (PREVIEW_ISSUE::FIELD aField, const wxString &aMessage, SEVERITY aSeverity) const
 Reports to the preview's issue list when there is one, otherwise to the reporter.
 
void startBackgroundRefresh ()
 
void stopBackgroundRefresh ()
 
void backgroundRefreshWorker ()
 

Static Private Member Functions

static std::optional< bool > boolFromAny (const std::any &aVal)
 

Private Attributes

bool m_previewMode = false
 Set on the throwaway instance behind BuildPreviewSymbols()
 
PREVIEW_ISSUES * m_previewIssues = nullptr
 Collects the problems found while building a preview; null outside BuildPreviewSymbols()
 
SYMBOL_LIBRARY_ADAPTER * m_adapter
 
std::unique_ptr< DATABASE_LIB_SETTINGS > m_settings
 
std::unique_ptr< DATABASE_CONNECTION > m_conn
 Generally will be null if no valid connection is established.
 
std::set< wxString > m_customFields
 
std::set< wxString > m_defaultShownFields
 
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_nameToSymbolcache
 
std::map< wxString, std::pair< std::string, std::string > > m_sanitizedNameMap
 
long long m_cacheTimestamp
 
std::atomic< bool > m_cachePopulated { false }
 True once the LIB_SYMBOL cache has been materialized at least once.
 
int m_modifyHash = 0
 
size_t m_cacheSignature
 Signature of the raw database rows at last materialization; used to skip rebuilding the LIB_SYMBOL cache when a re-query returns identical data.
 
bool m_inCacheLib = false
 Re-entrancy guard for cacheLib(), tripped when a self-referential load routes back through the adapter into LoadSymbol mid-build.
 
std::thread m_refreshThread
 
std::atomic< bool > m_refreshRunning { false }
 
std::condition_variable m_refreshCV
 
std::mutex m_refreshMutex
 
std::shared_mutex m_cacheMutex
 
std::mutex m_symbolLoadMutex
 
wxString m_lastError
 

Static Private Attributes

static thread_local std::unordered_set< wxString > s_inProgressLoads
 LIB_IDs whose resolution is in flight on the calling thread, used to break self-referential cycles where a row's Symbols column points back into the same database library (issue #24249).
 

Friends

class SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE
 

Detailed Description

A KiCad database library provides both symbol and footprint metadata, so there are "shim" plugins on both the symbol and footprint side of things that expose the database contents to the schematic and board editors.

The architecture of these is slightly different from the other plugins because the backing file is just a configuration file rather than something that contains symbol or footprint data.

Definition at line 50 of file sch_io_database.h.

Member Typedef Documentation

◆ PREVIEW_ISSUES

Definition at line 133 of file sch_io_database.h.

◆ TABLE_RESULT_LIST

typedef std::vector<std::pair<const DATABASE_LIB_TABLE*, std::vector<DATABASE_CONNECTION::ROW> > > SCH_IO_DATABASE::TABLE_RESULT_LIST
private

Definition at line 148 of file sch_io_database.h.

Constructor & Destructor Documentation

◆ SCH_IO_DATABASE()

SCH_IO_DATABASE::SCH_IO_DATABASE ( )

◆ ~SCH_IO_DATABASE()

SCH_IO_DATABASE::~SCH_IO_DATABASE ( )
virtual

Definition at line 62 of file sch_io_database.cpp.

References stopBackgroundRefresh().

Member Function Documentation

◆ AdvanceProgressPhase()

void IO_BASE::AdvanceProgressPhase ( )
virtualinherited

Definition at line 133 of file io_base.cpp.

References m_progressReporter, and THROW_IO_CANCELLED.

◆ backgroundRefreshWorker()

◆ boolFromAny()

std::optional< bool > SCH_IO_DATABASE::boolFromAny ( const std::any & aVal)
staticprivate

Definition at line 782 of file sch_io_database.cpp.

Referenced by loadSymbolFromRow().

◆ BuildPreviewSymbols()

std::vector< std::unique_ptr< LIB_SYMBOL > > SCH_IO_DATABASE::BuildPreviewSymbols ( SYMBOL_LIBRARY_ADAPTER * aLibs,
const DATABASE_LIB_TABLE & aTable,
bool aGloballyUniqueKeys,
const std::vector< DATABASE_CONNECTION::ROW > & aRows,
PREVIEW_ISSUES * aIssues )
static

Builds symbols from already-fetched rows exactly as the library would name and load them, without opening a connection.

References into database libraries are not resolved, so a preview never issues queries beyond the rows it was given.

Parameters
aLibsresolves the symbols column; may be null for metadata-only symbols
aIssuesreceives per-row problems such as malformed pin maps; may be null

Definition at line 362 of file sch_io_database.cpp.

References _, loadSymbolFromRow(), m_adapter, m_previewIssues, m_previewMode, name, reportIssue(), RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, SCH_IO_DATABASE(), SymbolNameForRow(), and IO_ERROR::What().

Referenced by BOOST_AUTO_TEST_CASE(), and DIALOG_DATABASE_LIB_SETTINGS::updatePreview().

◆ cacheLib()

◆ CanReadLibrary()

◆ CanReadSchematicFile()

◆ CheckLibrary()

void SCH_IO_DATABASE::CheckLibrary ( const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
overridevirtual

Validate that the library at aLibraryPath is reachable and well-formed, without necessarily loading symbol data.

This is used for editing library tables, where a full EnumerateSymbolLib can be expensive for some libraries (e.g. HTTP or Database) and should not be done just to check if the library is OK to use.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found or is not well-formed.

Reimplemented from SCH_IO.

Definition at line 109 of file sch_io_database.cpp.

References ensureConnection(), and ensureSettings().

◆ computeSignature()

size_t SCH_IO_DATABASE::computeSignature ( const TABLE_RESULT_LIST & aTableResults) const
private

◆ connect()

◆ CreateConfigurationDialog()

DIALOG_SHIM * SCH_IO_DATABASE::CreateConfigurationDialog ( wxWindow * aParent,
const wxString & aLibraryPath )
overridevirtual
Parameters
aLibraryPathis the fully expanded path of the library to configure
Returns
a new instance of dialog that configures this plugin, or nullptr if this plugin does not support a configuration dialog. Caller takes ownership.

Reimplemented from IO_BASE.

Definition at line 1320 of file sch_io_database.cpp.

References m_adapter.

◆ CreateConnection()

std::unique_ptr< DATABASE_CONNECTION > SCH_IO_DATABASE::CreateConnection ( const DATABASE_LIB_SETTINGS & aSettings,
bool aConnectNow = true,
const wxString & aBaseDir = wxEmptyString )
static

Opens a connection described by aSettings, expanding ${CWD} in a connection string to the directory holding the settings file.

The result may be disconnected; check IsConnected().

Parameters
aConnectNowfalse defers connecting to the caller's Connect(), e.g. on a worker thread
aBaseDirreplaces the settings file's directory for ${CWD}; used while the file has no path yet

Definition at line 319 of file sch_io_database.cpp.

References JSON_SETTINGS::GetFilename(), DATABASE_LIB_SETTINGS::m_Source, and source.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DIALOG_DATABASE_LIB_SETTINGS::connect(), and connect().

◆ CreateLibrary()

void IO_BASE::CreateLibrary ( const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Create a new empty library at aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt to create on a "read only" location.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several elements.
aPropertiesis an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the IO is known to support. The caller continues to own this object (IO may not delete it), and IOs should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the library, or creating it.

Reimplemented in DESIGN_BLOCK_IO, PCB_IO_KICAD_SEXPR, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 46 of file io_base.cpp.

References NOT_IMPLEMENTED.

Referenced by LIBRARY_MANAGER_ADAPTER::CreateLibrary().

◆ DeleteLibrary()

bool IO_BASE::DeleteLibrary ( const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Delete an existing library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.

Parameters
aLibraryPathis a locator for the "library", usually a directory or file which will contain several elements.
aPropertiesis an associative array that can be used to tell the library delete implementation function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
true if library deleted, false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented in DESIGN_BLOCK_IO, PCB_IO_GEDA, PCB_IO_KICAD_LEGACY, PCB_IO_KICAD_SEXPR, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 53 of file io_base.cpp.

References NOT_IMPLEMENTED.

Referenced by LIBRARY_MANAGER_ADAPTER::DeleteLibrary().

◆ DeleteSymbol()

void SCH_IO::DeleteSymbol ( const wxString & aLibraryPath,
const wxString & aSymbolName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolNameis the name of a LIB_SYMBOL associated with it's root LIB_SYMBOL object to delete from the specified library.
aPropertiesis an associative array that can be used to tell the library delete function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the alias or the library or deleting it.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 132 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by SYMBOL_LIBRARY_ADAPTER::DeleteSymbol(), and LIB_BUFFER::SaveBuffer().

◆ ensureConnection()

void SCH_IO_DATABASE::ensureConnection ( )
private

Definition at line 715 of file sch_io_database.cpp.

References _, connect(), m_conn, m_lastError, m_settings, and THROW_IO_ERRORF.

Referenced by CheckLibrary(), EnumerateSymbolLib(), and LoadSymbol().

◆ ensureSettings()

void SCH_IO_DATABASE::ensureSettings ( const wxString & aSettingsPath)
private

◆ EnumerateSymbolLib() [1/2]

void SCH_IO_DATABASE::EnumerateSymbolLib ( std::vector< LIB_SYMBOL * > & aSymbolList,
const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
overridevirtual

Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.

Note
The returned LIB_SYMBOL objects are owned by the plugin's library cache; callers must copy them if they need a symbol that outlives the plugin.
Parameters
aSymbolListis an array to populate with the LIB_SYMBOL pointers associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented from SCH_IO.

Definition at line 83 of file sch_io_database.cpp.

References cacheLib(), LIB_SYMBOL::Duplicate(), ensureConnection(), ensureSettings(), LIB_SYMBOL::IsPower(), m_adapter, m_cacheMutex, m_conn, m_lastError, m_nameToSymbolcache, SYMBOL_LIBRARY_ADAPTER::PropPowerSymsOnly, and THROW_IO_ERROR.

◆ EnumerateSymbolLib() [2/2]

void SCH_IO_DATABASE::EnumerateSymbolLib ( wxArrayString & aSymbolNameList,
const wxString & aLibraryPath,
const std::map< std::string, UTF8 > * aProperties = nullptr )
overridevirtual

Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.

Parameters
aSymbolNameListis an array to populate with the LIB_SYMBOL names associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented from SCH_IO.

Definition at line 68 of file sch_io_database.cpp.

References EnumerateSymbolLib().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EnumerateSymbolLib().

◆ GetAvailableSymbolFields()

void SCH_IO_DATABASE::GetAvailableSymbolFields ( std::vector< wxString > & aNames)
overridevirtual

Retrieves a list of (custom) field names that are present on symbols in this library.

The plugin is responsible for guaranteeing that this list contains the set of unique custom field names present on any symbols contained in the library.

The required KiCad fields are not included in this list.

Parameters
aNameswill be filled with any custom fields present in this library.

Reimplemented from SCH_IO.

Definition at line 225 of file sch_io_database.cpp.

References m_customFields, and m_symbolLoadMutex.

◆ GetDefaultSymbolFields()

void SCH_IO_DATABASE::GetDefaultSymbolFields ( std::vector< wxString > & aNames)
overridevirtual

Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.

This list should be a subset of the result returned by GetAvailableSymbolFields().

The preference for which fields to hide and show for a given library is stored on a per-library basis in a user's preferences (or in the project local settings for a project- local library). The set of fields returned by GetDefaultSymbolFields() will be used if this preference is missing.

Parameters
aNameswill be filled with the custom field names that should be shown by default

Reimplemented from SCH_IO.

Definition at line 233 of file sch_io_database.cpp.

References m_defaultShownFields, and m_symbolLoadMutex.

◆ GetError()

const wxString & SCH_IO::GetError ( ) const
virtualinherited

Return an error string to the caller.

This is useful for schematic loaders that can load partial schematics where throwing an exception would be problematic such as the KiCad legacy plugin.

Returns
an unformatted string containing errors if any.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 155 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ GetImportedCachedLibrarySymbols()

std::vector< LIB_SYMBOL * > SCH_IO::GetImportedCachedLibrarySymbols ( )
virtualinherited

Return the canonical symbol definitions produced by the last LoadSchematicFile().

An importer implements this so a caller can materialize a project symbol library through SYMBOL_IMPORT_RECONCILER instead of the importer writing one itself. Ownership of the returned symbols passes to the caller.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE, SCH_IO_EASYEDAPRO, and SCH_IO_EASYEDAPRO_V3.

Definition at line 76 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by ReconcileImportedSymbols().

◆ GetLibraryDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_DATABASE::GetLibraryDesc ( ) const
inlineoverridevirtual

Get the descriptor for the library container that this IO plugin operates on.

Returns
File descriptor for the container of the library elements

Implements IO_BASE.

Definition at line 59 of file sch_io_database.h.

References _HKI, and FILEEXT::DatabaseLibraryFileExtension.

◆ GetLibraryFileDesc()

virtual const IO_FILE_DESC IO_BASE::GetLibraryFileDesc ( ) const
inlinevirtualinherited

Get the descriptor for the individual library elements that this IO plugin operates on.

For libraries where all the elements are in a single container (e.g. all elements in a single file), then this will return the descriptor from IO_BASE::GetLibraryDesc().

Returns
File descriptor for the library elements

Reimplemented in PCB_IO_EASYEDA, PCB_IO_EASYEDAPRO, PCB_IO_GEDA, PCB_IO_KICAD_SEXPR, and PCB_IO_SPRINT_LAYOUT.

Definition at line 117 of file io_base.h.

References GetLibraryDesc().

Referenced by PCB_IO::CanReadFootprint().

◆ GetLibraryOptions()

void SCH_IO::GetLibraryOptions ( std::map< std::string, UTF8 > * aListToAppendTo) const
overridevirtualinherited

Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived SCH_IO can call its base class function by the same name first, thus inheriting options declared there. (Some base class options could pertain to all Symbol*() functions in all derived SCH_IOs.) Note that since aListToAppendTo is a PROPERTIES object, all options will be unique and last guy wins.

Parameters
aListToAppendToholds a tuple of
option
This eventually is what shows up into the fp-lib-table "options" field, possibly combined with others.
internationalized description
The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS. It may be multi-line and be quite explanatory of the option.

In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to SCH_IO, which has been avoided to date.

Reimplemented from IO_BASE.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 140 of file sch_io.cpp.

References IO_BASE::GetLibraryOptions().

◆ GetModifyHash()

int SCH_IO_DATABASE::GetModifyHash ( ) const
inlineoverridevirtual

Return the modification hash from the library cache.

Note
This is temporary until the new s-expr file format is implement. The new file format will embed symbols instead of referencing them from the library. This function can be removed when the new file format is implemented.
Returns
the modification hash of the library cache.

Implements SCH_IO.

Definition at line 65 of file sch_io_database.h.

References m_modifyHash.

◆ GetName()

const wxString & IO_BASE::GetName ( ) const
inlineinherited

◆ GetSchematicFileDesc()

const IO_BASE::IO_FILE_DESC SCH_IO::GetSchematicFileDesc ( ) const
virtualinherited

◆ GetSubLibraryDescription()

virtual wxString SCH_IO::GetSubLibraryDescription ( const wxString & aName)
inlinevirtualinherited

Gets a description of a sublibrary.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNamecontains the name of the sublibrary for which the description is retrieved
Returns
the description of the sublibrary

Reimplemented in SCH_IO_HTTP_LIB.

Definition at line 346 of file sch_io.h.

Referenced by SYMBOL_LIBRARY_ADAPTER::GetSubLibraries().

◆ GetSubLibraryNames()

void SCH_IO_DATABASE::GetSubLibraryNames ( std::vector< wxString > & aNames)
overridevirtual

Retrieves a list of sub-libraries in this library.

Some types of symbol library support sub-libraries, which are a single-level organizational hierarchy that is implementation-defined per plugin. Most of KiCad ignores sub-libraries and treats the hierarchy between library and symbol as flat, but the sub-libraries are used for sorting and grouping symbols in the symbol chooser.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNameswill be filled with a list of sub-libraries within this symbol library

Reimplemented from SCH_IO.

Definition at line 206 of file sch_io_database.cpp.

References ensureSettings(), m_settings, and DATABASE_LIB_TABLE::name.

◆ IsLibraryWritable()

bool SCH_IO_DATABASE::IsLibraryWritable ( const wxString & aLibraryPath)
inlineoverridevirtual

Return true if the library at aLibraryPath is writable.

The system libraries are typically read only because of where they are installed..

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
Exceptions
IO_ERRORif no library at aLibraryPath exists.

Reimplemented from IO_BASE.

Definition at line 90 of file sch_io_database.h.

◆ IsPCB_IO()

virtual bool IO_BASE::IsPCB_IO ( ) const
inlinevirtualinherited

Work-around for lack of dynamic_cast across compile units on Mac.

Reimplemented in PCB_IO.

Definition at line 84 of file io_base.h.

Referenced by FOOTPRINT_LIBRARY_ADAPTER::pcbplugin().

◆ LoadSchematicFile()

SCH_SHEET * SCH_IO::LoadSchematicFile ( const wxString & aFileName,
SCHEMATIC * aSchematic,
SCH_SHEET * aAppendToMe = nullptr,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Load information from some input file format that this SCH_IO implementation knows about, into either a new SCH_SHEET or an existing one.

This may be used to load an entire new SCH_SHEET, or to augment an existing one if aAppendToMe is not NULL.

Parameters
aFileNameis the name of the file to use as input and may be foreign in nature or native in nature.
aSchematicis the SCHEMATIC object to load the schematic into.
aAppendToMeis an existing SCH_SHEET to append to, but if NULL then this means "do not append, rather load anew".
aPropertiesis an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the successfully loaded schematic, or the same one as aAppendToMe if aAppendToMe was not NULL, and the caller owns it.
Exceptions
IO_ERRORif there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DIPTRACE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_EASYEDAPRO, SCH_IO_EASYEDAPRO_V3, SCH_IO_EASYPC, SCH_IO_GEDA, SCH_IO_KICAD_LEGACY, SCH_IO_KICAD_SEXPR, SCH_IO_LTSPICE, SCH_IO_ORCAD, SCH_IO_PADS, SCH_IO_PCAD, and SCH_IO_TARGET3001.

Definition at line 69 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ LoadSymbol()

LIB_SYMBOL * SCH_IO_DATABASE::LoadSymbol ( const wxString & aLibraryPath,
const wxString & aPartName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
overridevirtual

Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aPartNameis the name of the LIB_SYMBOL to load.
aPropertiesis an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the part created on the heap if found caller shares it or NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aAliasName cannot be found.

Reimplemented from SCH_IO.

Definition at line 117 of file sch_io_database.cpp.

References cacheLib(), LIB_SYMBOL::Duplicate(), ensureConnection(), ensureSettings(), loadSymbolFromRow(), m_adapter, m_cacheMutex, m_conn, m_lastError, m_nameToSymbolcache, m_sanitizedNameMap, m_settings, DATABASE_LIB_TABLE::name, result, table, THROW_IO_ERROR, and traceDatabase.

Referenced by BOOST_AUTO_TEST_CASE().

◆ loadSymbolFromRow()

std::unique_ptr< LIB_SYMBOL > SCH_IO_DATABASE::loadSymbolFromRow ( const wxString & aSymbolName,
const DATABASE_LIB_TABLE & aTable,
const DATABASE_CONNECTION::ROW & aRow )
private

Definition at line 831 of file sch_io_database.cpp.

References _, ALL_BODY_STYLES, boolFromAny(), DATABASE_FIELD_MAPPING::column, MAPPABLE_SYMBOL_PROPERTIES::description, SCH_ITEM::Duplicate(), MAPPABLE_SYMBOL_PROPERTIES::exclude_from_board, MAPPABLE_SYMBOL_PROPERTIES::exclude_from_bom, MAPPABLE_SYMBOL_PROPERTIES::exclude_from_sim, DATABASE_LIB_TABLE::fields, MAPPABLE_SYMBOL_PROPERTIES::footprint_filters, DATABASE_LIB_TABLE::footprints_col, SCH_FIELD::GetId(), LIB_SYMBOL::GetName(), SCH_FIELD::GetName(), IGNORE_PARENT_GROUP, DATABASE_FIELD_MAPPING::inherit_properties, SCH_FIELD::IsMandatory(), MAPPABLE_SYMBOL_PROPERTIES::keywords, m_customFields, m_defaultShownFields, m_symbolLoadMutex, MakeLegacyPinMap(), MANDATORY_FIELDS, DATABASE_LIB_TABLE::name, DATABASE_FIELD_MAPPING::name_wx, LIB_ID::Parse(), ParseAssociatedFootprints(), ParseLegacyPinAssignments(), ParsePinMapSet(), DATABASE_LIB_TABLE::pins_col, DATABASE_LIB_TABLE::properties, reportIssue(), resolveSourceSymbol(), RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, s_inProgressLoads, SCH_FIELD_T, SCH_FIELD::SetAutoAdded(), SCH_ITEM::SetBodyStyle(), SCH_FIELD::SetName(), SCH_FIELD::SetNameShown(), SCH_FIELD::SetOrdinal(), EDA_ITEM::SetParent(), LIB_ID::SetSubLibraryName(), SCH_FIELD::SetText(), EDA_TEXT::SetVisible(), DATABASE_FIELD_MAPPING::show_name, strValue(), DATABASE_LIB_TABLE::symbols_col, traceDatabase, USER, DATABASE_FIELD_MAPPING::visible_in_chooser, and DATABASE_FIELD_MAPPING::visible_on_add.

Referenced by BuildPreviewSymbols(), SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::Invoke(), SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::InvokeWithCycle(), LoadSymbol(), and materializeCache().

◆ materializeCache()

bool SCH_IO_DATABASE::materializeCache ( const TABLE_RESULT_LIST & aTableResults,
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > & aSymbolCache,
std::map< wxString, std::pair< std::string, std::string > > & aSanitizedNameMap )
private

Definition at line 437 of file sch_io_database.cpp.

References loadSymbolFromRow(), m_settings, name, result, SymbolNameForRow(), and table.

Referenced by backgroundRefreshWorker(), and cacheLib().

◆ Report()

◆ reportIssue()

void SCH_IO_DATABASE::reportIssue ( PREVIEW_ISSUE::FIELD aField,
const wxString & aMessage,
SEVERITY aSeverity ) const
private

Reports to the preview's issue list when there is one, otherwise to the reporter.

Definition at line 428 of file sch_io_database.cpp.

References m_previewIssues, and IO_BASE::Report().

Referenced by BuildPreviewSymbols(), loadSymbolFromRow(), and resolveSourceSymbol().

◆ resolveSourceSymbol()

LIB_SYMBOL * SCH_IO_DATABASE::resolveSourceSymbol ( const LIB_ID & aId)
private

Resolves one entry of a row's symbols column through the library adapter.

Definition at line 285 of file sch_io_database.cpp.

References _, SCH_IO_MGR::EnumFromStr(), LIB_ID::Format(), LIB_ID::GetLibNickname(), m_adapter, m_previewMode, reportIssue(), RPT_SEVERITY_WARNING, and UTF8::wx_str().

Referenced by loadSymbolFromRow().

◆ SaveLibrary()

void SCH_IO::SaveLibrary ( const wxString & aFileName,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 63 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSchematicFile()

void SCH_IO::SaveSchematicFile ( const wxString & aFileName,
SCH_SHEET * aSheet,
SCHEMATIC * aSchematic,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.

Parameters
aFileNameis the name of a file to save to on disk.
aSheetis the class SCH_SHEET in memory document tree from which to extract information when writing to aFileName. The caller continues to own the SCHEMATIC, and the plugin should refrain from modifying the SCHEMATIC if possible.
aSchematicis the SCHEMATIC object used to access any schematic-wide or project information needed to save the document.
aPropertiesis an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. Set the "PropSaveCurrentSheetOnly" property to only save the current sheet. Otherwise, all hierarchical sheets are saved.
Exceptions
IO_ERRORif there is a problem saving or exporting.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 82 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSymbol()

void SCH_IO::SaveSymbol ( const wxString & aLibraryPath,
std::unique_ptr< LIB_SYMBOL > aSymbol,
const std::map< std::string, UTF8 > * aProperties = nullptr )
virtualinherited

Write aSymbol to an existing library located at aLibraryPath.

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
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolis what to store in the library. Ownership is transferred to the plugin, which may retain or destroy the symbol: the caller must not use it after this call.
aPropertiesis an associative array that can be used to tell the saver how to save the symbol, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 124 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by LIB_BUFFER::SaveBuffer().

◆ SetLibraryManagerAdapter()

void SCH_IO_DATABASE::SetLibraryManagerAdapter ( SYMBOL_LIBRARY_ADAPTER * aAdapter)
inlineoverridevirtual

Some library plugins need to interface with other loaded libraries.

To do this, they receive a reference to the project-specific manager adapter.

Reimplemented from SCH_IO.

Definition at line 92 of file sch_io_database.h.

References m_adapter.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetProgressReporter()

virtual void IO_BASE::SetProgressReporter ( PROGRESS_REPORTER * aReporter)
inlinevirtualinherited

Set an optional progress reporter.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 94 of file io_base.h.

References m_progressReporter.

Referenced by PCB_CONTROL::AppendBoard(), GenerateIpc2581File(), and generateOneODBPackage().

◆ SetReporter()

◆ Settings()

DATABASE_LIB_SETTINGS * SCH_IO_DATABASE::Settings ( ) const
inline

Definition at line 101 of file sch_io_database.h.

References m_settings.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ startBackgroundRefresh()

void SCH_IO_DATABASE::startBackgroundRefresh ( )
private

Definition at line 544 of file sch_io_database.cpp.

References backgroundRefreshWorker(), m_refreshRunning, m_refreshThread, and traceDatabase.

Referenced by cacheLib().

◆ stopBackgroundRefresh()

void SCH_IO_DATABASE::stopBackgroundRefresh ( )
private

Definition at line 554 of file sch_io_database.cpp.

References m_refreshCV, m_refreshRunning, and m_refreshThread.

Referenced by ~SCH_IO_DATABASE().

◆ SupportsConfigurationDialog()

bool SCH_IO_DATABASE::SupportsConfigurationDialog ( ) const
inlineoverridevirtual
Returns
true if this plugin supports a GUI for configuration that can be launched from the library table configuration dialog or other UI contexts

Reimplemented from IO_BASE.

Definition at line 97 of file sch_io_database.h.

◆ SupportsSubLibraries()

bool SCH_IO_DATABASE::SupportsSubLibraries ( ) const
inlineoverridevirtual
Returns
true if this plugin supports libraries that contain sub-libraries.

Reimplemented from SCH_IO.

Definition at line 81 of file sch_io_database.h.

◆ SymbolNameForRow()

wxString SCH_IO_DATABASE::SymbolNameForRow ( const DATABASE_LIB_TABLE & aTable,
bool aGloballyUniqueKeys,
const DATABASE_CONNECTION::ROW & aRow,
std::string * aRawKey = nullptr )
static

Friends And Related Symbol Documentation

◆ SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE

Member Data Documentation

◆ m_adapter

◆ m_cacheMutex

std::shared_mutex SCH_IO_DATABASE::m_cacheMutex
private

◆ m_cachePopulated

std::atomic<bool> SCH_IO_DATABASE::m_cachePopulated { false }
private

True once the LIB_SYMBOL cache has been materialized at least once.

Definition at line 199 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), and cacheLib().

◆ m_cacheSignature

size_t SCH_IO_DATABASE::m_cacheSignature
private

Signature of the raw database rows at last materialization; used to skip rebuilding the LIB_SYMBOL cache when a re-query returns identical data.

Definition at line 205 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), cacheLib(), and SCH_IO_DATABASE().

◆ m_cacheTimestamp

long long SCH_IO_DATABASE::m_cacheTimestamp
private

Definition at line 196 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), cacheLib(), and SCH_IO_DATABASE().

◆ m_conn

std::unique_ptr<DATABASE_CONNECTION> SCH_IO_DATABASE::m_conn
private

Generally will be null if no valid connection is established.

Definition at line 187 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), cacheLib(), connect(), ensureConnection(), ensureSettings(), EnumerateSymbolLib(), LoadSymbol(), and SCH_IO_DATABASE().

◆ m_customFields

std::set<wxString> SCH_IO_DATABASE::m_customFields
private

Definition at line 189 of file sch_io_database.h.

Referenced by GetAvailableSymbolFields(), and loadSymbolFromRow().

◆ m_defaultShownFields

std::set<wxString> SCH_IO_DATABASE::m_defaultShownFields
private

Definition at line 191 of file sch_io_database.h.

Referenced by GetDefaultSymbolFields(), and loadSymbolFromRow().

◆ m_inCacheLib

bool SCH_IO_DATABASE::m_inCacheLib = false
private

Re-entrancy guard for cacheLib(), tripped when a self-referential load routes back through the adapter into LoadSymbol mid-build.

Definition at line 215 of file sch_io_database.h.

Referenced by cacheLib().

◆ m_lastError

wxString SCH_IO_DATABASE::m_lastError
private

Definition at line 228 of file sch_io_database.h.

Referenced by connect(), ensureConnection(), EnumerateSymbolLib(), and LoadSymbol().

◆ m_modifyHash

int SCH_IO_DATABASE::m_modifyHash = 0
private

Definition at line 201 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), cacheLib(), and GetModifyHash().

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 239 of file io_base.h.

Referenced by PCB_IO_IPC2581::generateBOMSection(), GetName(), IO_BASE(), and PCB_IO_IPC2581::pinName().

◆ m_nameToSymbolcache

std::map<wxString, std::unique_ptr<LIB_SYMBOL> > SCH_IO_DATABASE::m_nameToSymbolcache
private

◆ m_previewIssues

PREVIEW_ISSUES* SCH_IO_DATABASE::m_previewIssues = nullptr
private

Collects the problems found while building a preview; null outside BuildPreviewSymbols()

Definition at line 180 of file sch_io_database.h.

Referenced by BuildPreviewSymbols(), and reportIssue().

◆ m_previewMode

bool SCH_IO_DATABASE::m_previewMode = false
private

Set on the throwaway instance behind BuildPreviewSymbols()

Definition at line 177 of file sch_io_database.h.

Referenced by BuildPreviewSymbols(), and resolveSourceSymbol().

◆ m_progressReporter

PROGRESS_REPORTER* IO_BASE::m_progressReporter
protectedinherited

Progress reporter to track the progress of the operation, may be nullptr.

Definition at line 245 of file io_base.h.

Referenced by AdvanceProgressPhase(), SCH_IO_KICAD_LEGACY::checkpoint(), SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), SCH_IO_EAGLE::ensureLoadedLibrary(), PCB_IO_ODBPP::ExportODB(), PCB_IO_IPC2581::generateComponents(), PCB_IO_IPC2581::generateLayerFeatures(), PCB_IO_IPC2581::generatePhyNetGroup(), IO_BASE(), PCB_IO_ALTIUM_CIRCUIT_MAKER::loadBoard(), PCB_IO_ALTIUM_CIRCUIT_STUDIO::loadBoard(), PCB_IO_ALTIUM_DESIGNER::loadBoard(), PCB_IO_CADSTAR_ARCHIVE::loadBoard(), PCB_IO_DIPTRACE::loadBoard(), PCB_IO_EASYEDA::loadBoard(), PCB_IO_EASYEDAPRO::loadBoard(), PCB_IO_EASYEDAPRO_V3::loadBoard(), PCB_IO_EASYPC::loadBoard(), PCB_IO_FABMASTER::loadBoard(), PCB_IO_KICAD_SEXPR::loadBoard(), PCB_IO_PADS::loadBoard(), PCB_IO_PADS_BINARY::loadBoard(), PCB_IO_SOLIDWORKS::loadBoard(), PCB_IO_TARGET3001::loadBoard(), PCB_IO_ALLEGRO::LoadBoardFromData(), SCH_IO_KICAD_LEGACY::loadFile(), SCH_IO_KICAD_SEXPR::loadFile(), SCH_IO_ORCAD::loadOlbSymbols(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_DIPTRACE::LoadSchematicFile(), SCH_IO_EAGLE::LoadSchematicFile(), SCH_IO_EASYPC::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), SCH_IO_ORCAD::LoadSchematicFile(), SCH_IO_PADS::LoadSchematicFile(), SCH_IO_TARGET3001::LoadSchematicFile(), SCH_IO_ALTIUM::ParseAltiumSch(), PCB_IO_IPC2581::reportPhase(), PCB_IO_IPC2581::SaveBoard(), SetProgressReporter(), SCH_IO_CADSTAR_ARCHIVE::SetProgressReporter(), and PCB_IO_IPC2581::tickProgress().

◆ m_refreshCV

std::condition_variable SCH_IO_DATABASE::m_refreshCV
private

Definition at line 223 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), and stopBackgroundRefresh().

◆ m_refreshMutex

std::mutex SCH_IO_DATABASE::m_refreshMutex
private

Definition at line 224 of file sch_io_database.h.

Referenced by backgroundRefreshWorker().

◆ m_refreshRunning

std::atomic<bool> SCH_IO_DATABASE::m_refreshRunning { false }
private

◆ m_refreshThread

std::thread SCH_IO_DATABASE::m_refreshThread
private

Definition at line 221 of file sch_io_database.h.

Referenced by startBackgroundRefresh(), and stopBackgroundRefresh().

◆ m_reporter

REPORTER* IO_BASE::m_reporter
protectedinherited

Reporter to log errors/warnings to, may be nullptr.

Definition at line 242 of file io_base.h.

Referenced by SCH_IO_EASYPC::convertComponent(), PCB_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), SCH_IO_GEDA::flushPendingComponent(), PCB_IO_ALTIUM_DESIGNER::FootprintLoad(), SCH_IO_GEDA::getOrLoadSymbol(), SCH_IO_GEDA::importHierarchicalSheet(), IO_BASE(), PCB_IO_EASYPC::library(), SCH_IO_EASYPC::library(), SCH_IO_PADS::loadBinarySchematicFile(), PCB_IO_ALTIUM_CIRCUIT_MAKER::loadBoard(), PCB_IO_ALTIUM_CIRCUIT_STUDIO::loadBoard(), PCB_IO_ALTIUM_DESIGNER::loadBoard(), PCB_IO_CADSTAR_ARCHIVE::loadBoard(), PCB_IO_EASYPC::loadBoard(), PCB_IO_FABMASTER::loadBoard(), PCB_IO_PADS::loadBoard(), PCB_IO_PADS_BINARY::loadBoard(), PCB_IO_PCAD::loadBoard(), PCB_IO_SOLIDWORKS::loadBoard(), PCB_IO_TARGET3001::loadBoard(), PCB_IO_ALLEGRO::LoadBoardFromData(), PCB_IO_PADS::loadCopperShapes(), PCB_IO_PADS_BINARY::loadCopperShapes(), SCH_IO_GEDA::loadDeferredSheets(), PCB_IO_PADS::loadFootprints(), PCB_IO_PADS_BINARY::loadFootprints(), SCH_IO_ORCAD::loadOlbSymbols(), SCH_IO_ALTIUM::LoadSchematicFile(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_DIPTRACE::LoadSchematicFile(), SCH_IO_EASYPC::LoadSchematicFile(), SCH_IO_GEDA::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), SCH_IO_ORCAD::LoadSchematicFile(), SCH_IO_PADS::LoadSchematicFile(), SCH_IO_TARGET3001::LoadSchematicFile(), PCB_IO_PADS::loadTracksAndVias(), PCB_IO_PADS_BINARY::loadTracksAndVias(), PCB_IO_PADS::loadZones(), PCB_IO_PADS_BINARY::loadZones(), SCH_IO_ALTIUM::NameNetsAfterNetLabels(), SCH_IO_ALTIUM::ParseLibFile(), SCH_IO_ALTIUM::ParsePowerPort(), SCH_IO_PCAD::populateScreen(), Report(), PCB_IO_AUTOTRAX::reporter(), SCH_IO_ALTIUM::SCH_IO_ALTIUM(), SCH_IO_CADSTAR_ARCHIVE::SCH_IO_CADSTAR_ARCHIVE(), SCH_IO_DIPTRACE::SCH_IO_DIPTRACE(), SCH_IO_EASYEDA::SCH_IO_EASYEDA(), SCH_IO_EASYPC::SCH_IO_EASYPC(), SCH_IO_LTSPICE::SCH_IO_LTSPICE(), SCH_IO_ORCAD::SCH_IO_ORCAD(), SCH_IO_TARGET3001::SCH_IO_TARGET3001(), SetReporter(), and SCH_IO_CADSTAR_ARCHIVE::SetReporter().

◆ m_sanitizedNameMap

std::map<wxString, std::pair<std::string, std::string> > SCH_IO_DATABASE::m_sanitizedNameMap
private

Definition at line 194 of file sch_io_database.h.

Referenced by backgroundRefreshWorker(), cacheLib(), and LoadSymbol().

◆ m_settings

◆ m_symbolLoadMutex

std::mutex SCH_IO_DATABASE::m_symbolLoadMutex
private

◆ s_inProgressLoads

thread_local std::unordered_set< wxString > SCH_IO_DATABASE::s_inProgressLoads
staticprivate

LIB_IDs whose resolution is in flight on the calling thread, used to break self-referential cycles where a row's Symbols column points back into the same database library (issue #24249).

The recursion is synchronous, so the chain is per thread; sharing the set would let concurrent loads of the same symbol report a false cycle and would race on the container itself.

Definition at line 211 of file sch_io_database.h.

Referenced by SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::InProgressSize(), SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::InvokeWithCycle(), SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::IsInProgressEmpty(), loadSymbolFromRow(), SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE(), and SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE::~SCH_IO_DATABASE_CYCLE_DETECTION_FIXTURE().


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