KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_info_impl.h
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <atomic>
23
#include <functional>
24
#include <memory>
25
#include <mutex>
26
#include <thread>
27
#include <vector>
28
29
#include <
footprint_info.h
>
30
#include <
core/sync_queue.h
>
31
32
class
LOCALE_IO
;
33
34
class
FOOTPRINT_INFO_IMPL
:
public
FOOTPRINT_INFO
35
{
36
public
:
37
FOOTPRINT_INFO_IMPL
(
FOOTPRINT_LIST
* aOwner,
const
wxString& aNickname,
const
wxString& aFootprintName )
38
{
39
m_nickname
= aNickname;
40
m_fpname
= aFootprintName;
41
m_num
= 0;
42
m_numbered_pad_count
= 0;
43
44
m_owner
= aOwner;
45
m_loaded
=
false
;
46
load
();
47
}
48
49
// A dummy constructor for use as a target in a binary search
50
FOOTPRINT_INFO_IMPL
(
const
wxString& aNickname,
const
wxString& aFootprintName )
51
{
52
m_nickname
= aNickname;
53
m_fpname
= aFootprintName;
54
55
m_owner
=
nullptr
;
56
m_loaded
=
true
;
57
}
58
59
protected
:
60
virtual
void
load
()
override
;
61
};
62
63
64
class
FOOTPRINT_LIST_IMPL
:
public
FOOTPRINT_LIST
65
{
66
public
:
67
FOOTPRINT_LIST_IMPL
();
68
virtual
~FOOTPRINT_LIST_IMPL
() {};
69
70
bool
ReadFootprintFiles
(
FOOTPRINT_LIBRARY_ADAPTER
* aAdapter,
const
wxString* aNickname =
nullptr
,
71
PROGRESS_REPORTER
* aProgressReporter =
nullptr
)
override
;
72
73
void
Clear
()
override
;
74
85
void
WithFootprintsForLibrary
(
const
wxString& aLibName,
86
const
std::function<
void
(
const
std::vector<LIB_TREE_ITEM*>& )>& aCallback );
87
88
protected
:
89
void
loadFootprints
();
90
91
private
:
97
bool
CatchErrors
(
const
std::function<
void
()>& aFunc );
98
99
SYNC_QUEUE<wxString>
m_queue
;
100
long
long
m_list_timestamp
;
101
PROGRESS_REPORTER
*
m_progress_reporter
;
102
std::atomic_bool
m_cancelled
;
103
std::mutex
m_join
;
104
std::mutex
m_loadInProgress
;
105
};
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL
FOOTPRINT_INFO_IMPL(const wxString &aNickname, const wxString &aFootprintName)
Definition
footprint_info_impl.h:50
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL
FOOTPRINT_INFO_IMPL(FOOTPRINT_LIST *aOwner, const wxString &aNickname, const wxString &aFootprintName)
Definition
footprint_info_impl.h:37
FOOTPRINT_INFO_IMPL::load
virtual void load() override
lazily load stuff not filled in by constructor. This may throw IO_ERRORS.
Definition
footprint_info_impl.cpp:36
FOOTPRINT_INFO
Definition
footprint_info.h:50
FOOTPRINT_INFO::m_num
int m_num
Order number in the display list.
Definition
footprint_info.h:137
FOOTPRINT_INFO::m_fpname
wxString m_fpname
Module name.
Definition
footprint_info.h:136
FOOTPRINT_INFO::m_loaded
bool m_loaded
Definition
footprint_info.h:133
FOOTPRINT_INFO::m_numbered_pad_count
unsigned m_numbered_pad_count
Number of unique electrical pads (numeric or BGA-style numbers)
Definition
footprint_info.h:138
FOOTPRINT_INFO::m_owner
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
Definition
footprint_info.h:131
FOOTPRINT_INFO::m_nickname
wxString m_nickname
library as known in FP_LIB_TABLE
Definition
footprint_info.h:135
FOOTPRINT_LIBRARY_ADAPTER
An interface to the global shared library manager that is schematic-specific and linked to one projec...
Definition
footprint_library_adapter.h:43
FOOTPRINT_LIST_IMPL::ReadFootprintFiles
bool ReadFootprintFiles(FOOTPRINT_LIBRARY_ADAPTER *aAdapter, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Read all the footprints provided by the combination of aTable and aNickname.
Definition
footprint_info_impl.cpp:142
FOOTPRINT_LIST_IMPL::WithFootprintsForLibrary
void WithFootprintsForLibrary(const wxString &aLibName, const std::function< void(const std::vector< LIB_TREE_ITEM * > &)> &aCallback)
Execute a callback with thread-safe access to the footprints for a library.
Definition
footprint_info_impl.cpp:78
FOOTPRINT_LIST_IMPL::m_loadInProgress
std::mutex m_loadInProgress
Definition
footprint_info_impl.h:104
FOOTPRINT_LIST_IMPL::FOOTPRINT_LIST_IMPL
FOOTPRINT_LIST_IMPL()
Definition
footprint_info_impl.cpp:291
FOOTPRINT_LIST_IMPL::m_list_timestamp
long long m_list_timestamp
Definition
footprint_info_impl.h:100
FOOTPRINT_LIST_IMPL::m_cancelled
std::atomic_bool m_cancelled
Definition
footprint_info_impl.h:102
FOOTPRINT_LIST_IMPL::loadFootprints
void loadFootprints()
Definition
footprint_info_impl.cpp:210
FOOTPRINT_LIST_IMPL::m_join
std::mutex m_join
Definition
footprint_info_impl.h:103
FOOTPRINT_LIST_IMPL::m_queue
SYNC_QUEUE< wxString > m_queue
Definition
footprint_info_impl.h:99
FOOTPRINT_LIST_IMPL::CatchErrors
bool CatchErrors(const std::function< void()> &aFunc)
Call aFunc, pushing any IO_ERRORs and std::exceptions it throws onto m_errors.
Definition
footprint_info_impl.cpp:111
FOOTPRINT_LIST_IMPL::~FOOTPRINT_LIST_IMPL
virtual ~FOOTPRINT_LIST_IMPL()
Definition
footprint_info_impl.h:68
FOOTPRINT_LIST_IMPL::Clear
void Clear() override
Definition
footprint_info_impl.cpp:69
FOOTPRINT_LIST_IMPL::m_progress_reporter
PROGRESS_REPORTER * m_progress_reporter
Definition
footprint_info_impl.h:101
FOOTPRINT_LIST
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
Definition
footprint_info.h:154
FOOTPRINT_LIST::FOOTPRINT_LIST
FOOTPRINT_LIST()
Definition
footprint_info.h:156
LOCALE_IO
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition
locale_io.h:37
PROGRESS_REPORTER
A progress reporter interface for use in multi-threaded environments.
Definition
progress_reporter.h:36
SYNC_QUEUE
Synchronized, locking queue.
Definition
sync_queue.h:32
footprint_info.h
sync_queue.h
src
pcbnew
footprint_info_impl.h
Generated on Thu Sep 17 2026 00:06:20 for KiCad PCB EDA Suite by
1.13.2