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 along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef FOOTPRINT_INFO_IMPL_H
21
#define FOOTPRINT_INFO_IMPL_H
22
23
#include <atomic>
24
#include <functional>
25
#include <memory>
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_pad_count
= 0;
43
m_unique_pad_count
= 0;
44
45
m_owner
= aOwner;
46
m_loaded
=
false
;
47
load
();
48
}
49
50
// A constructor for cached items
51
FOOTPRINT_INFO_IMPL
(
const
wxString& aNickname,
const
wxString& aFootprintName,
52
const
wxString& aDescription,
const
wxString& aKeywords,
53
int
aOrderNum,
unsigned
int
aPadCount,
unsigned
int
aUniquePadCount )
54
{
55
m_nickname
= aNickname;
56
m_fpname
= aFootprintName;
57
m_num
= aOrderNum;
58
m_pad_count
= aPadCount;
59
m_unique_pad_count
= aUniquePadCount;
60
m_doc
= aDescription;
61
m_keywords
= aKeywords;
62
63
m_owner
=
nullptr
;
64
m_loaded
=
true
;
65
}
66
67
68
// A dummy constructor for use as a target in a binary search
69
FOOTPRINT_INFO_IMPL
(
const
wxString& aNickname,
const
wxString& aFootprintName )
70
{
71
m_nickname
= aNickname;
72
m_fpname
= aFootprintName;
73
74
m_owner
=
nullptr
;
75
m_loaded
=
true
;
76
}
77
78
protected
:
79
virtual
void
load
()
override
;
80
};
81
82
83
class
FOOTPRINT_LIST_IMPL
:
public
FOOTPRINT_LIST
84
{
85
public
:
86
FOOTPRINT_LIST_IMPL
();
87
virtual
~FOOTPRINT_LIST_IMPL
() {};
88
89
void
WriteCacheToFile
(
const
wxString& aFilePath )
override
;
90
void
ReadCacheFromFile
(
const
wxString& aFilePath )
override
;
91
92
bool
ReadFootprintFiles
(
FP_LIB_TABLE
* aTable,
const
wxString* aNickname =
nullptr
,
93
PROGRESS_REPORTER
* aProgressReporter =
nullptr
)
override
;
94
95
void
Clear
()
override
;
96
97
protected
:
98
void
loadFootprints
();
99
100
private
:
106
bool
CatchErrors
(
const
std::function<
void
()>& aFunc );
107
108
SYNC_QUEUE<wxString>
m_queue
;
109
long
long
m_list_timestamp
;
110
PROGRESS_REPORTER
*
m_progress_reporter
;
111
std::atomic_bool
m_cancelled
;
112
std::mutex
m_join
;
113
};
114
115
extern
FOOTPRINT_LIST_IMPL
GFootprintList
;
// KIFACE scope.
116
117
118
#endif
// FOOTPRINT_INFO_IMPL_H
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL
FOOTPRINT_INFO_IMPL(const wxString &aNickname, const wxString &aFootprintName)
Definition
footprint_info_impl.h:69
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:43
FOOTPRINT_INFO_IMPL::FOOTPRINT_INFO_IMPL
FOOTPRINT_INFO_IMPL(const wxString &aNickname, const wxString &aFootprintName, const wxString &aDescription, const wxString &aKeywords, int aOrderNum, unsigned int aPadCount, unsigned int aUniquePadCount)
Definition
footprint_info_impl.h:51
FOOTPRINT_INFO
Definition
footprint_info.h:60
FOOTPRINT_INFO::m_doc
wxString m_doc
Footprint description.
Definition
footprint_info.h:148
FOOTPRINT_INFO::m_num
int m_num
Order number in the display list.
Definition
footprint_info.h:145
FOOTPRINT_INFO::m_fpname
wxString m_fpname
Module name.
Definition
footprint_info.h:144
FOOTPRINT_INFO::m_loaded
bool m_loaded
Definition
footprint_info.h:141
FOOTPRINT_INFO::m_keywords
wxString m_keywords
Footprint keywords.
Definition
footprint_info.h:149
FOOTPRINT_INFO::m_unique_pad_count
unsigned m_unique_pad_count
Number of unique pads.
Definition
footprint_info.h:147
FOOTPRINT_INFO::m_pad_count
unsigned m_pad_count
Number of pads.
Definition
footprint_info.h:146
FOOTPRINT_INFO::m_owner
FOOTPRINT_LIST * m_owner
provides access to FP_LIB_TABLE
Definition
footprint_info.h:139
FOOTPRINT_INFO::m_nickname
wxString m_nickname
library as known in FP_LIB_TABLE
Definition
footprint_info.h:143
FOOTPRINT_LIST_IMPL
Definition
footprint_info_impl.h:84
FOOTPRINT_LIST_IMPL::ReadFootprintFiles
bool ReadFootprintFiles(FP_LIB_TABLE *aTable, 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:106
FOOTPRINT_LIST_IMPL::FOOTPRINT_LIST_IMPL
FOOTPRINT_LIST_IMPL()
Definition
footprint_info_impl.cpp:239
FOOTPRINT_LIST_IMPL::m_list_timestamp
long long m_list_timestamp
Definition
footprint_info_impl.h:109
FOOTPRINT_LIST_IMPL::m_cancelled
std::atomic_bool m_cancelled
Definition
footprint_info_impl.h:111
FOOTPRINT_LIST_IMPL::loadFootprints
void loadFootprints()
Definition
footprint_info_impl.cpp:165
FOOTPRINT_LIST_IMPL::m_join
std::mutex m_join
Definition
footprint_info_impl.h:112
FOOTPRINT_LIST_IMPL::m_queue
SYNC_QUEUE< wxString > m_queue
Definition
footprint_info_impl.h:108
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:75
FOOTPRINT_LIST_IMPL::WriteCacheToFile
void WriteCacheToFile(const wxString &aFilePath) override
Definition
footprint_info_impl.cpp:247
FOOTPRINT_LIST_IMPL::ReadCacheFromFile
void ReadCacheFromFile(const wxString &aFilePath) override
Definition
footprint_info_impl.cpp:286
FOOTPRINT_LIST_IMPL::~FOOTPRINT_LIST_IMPL
virtual ~FOOTPRINT_LIST_IMPL()
Definition
footprint_info_impl.h:87
FOOTPRINT_LIST_IMPL::Clear
void Clear() override
Definition
footprint_info_impl.cpp:68
FOOTPRINT_LIST_IMPL::m_progress_reporter
PROGRESS_REPORTER * m_progress_reporter
Definition
footprint_info_impl.h:110
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:161
FOOTPRINT_LIST::FOOTPRINT_LIST
FOOTPRINT_LIST()
Definition
footprint_info.h:163
FP_LIB_TABLE
Definition
fp_lib_table.h:101
LOCALE_IO
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition
locale_io.h:41
PROGRESS_REPORTER
A progress reporter interface for use in multi-threaded environments.
Definition
progress_reporter.h:39
SYNC_QUEUE
Synchronized, locking queue.
Definition
sync_queue.h:32
footprint_info.h
GFootprintList
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition
cvpcb.cpp:156
sync_queue.h
src
pcbnew
footprint_info_impl.h
Generated on Sun Sep 21 2025 01:05:29 for KiCad PCB EDA Suite by
1.13.2