KiCad PCB EDA Suite
board_netlist_updater.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 (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 CERN
6 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
7 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
8 *
9 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, you may find one here:
23 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24 * or you may search the http://www.gnu.org website for the version 2 license,
25 * or you may write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 */
28
29#ifndef BOARD_NETLIST_UPDATER_H
30#define BOARD_NETLIST_UPDATER_H
31
32class BOARD;
33class REPORTER;
34class NETLIST;
35class COMPONENT;
36class FOOTPRINT;
37class PCB_EDIT_FRAME;
38
39#include <board_commit.h>
40
66{
67public:
68 BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBoard );
70
79 bool UpdateNetlist( NETLIST& aNetlist );
80
81 void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; }
82
84 void SetIsDryRun( bool aEnabled ) { m_isDryRun = aEnabled; }
85
86 void SetReplaceFootprints( bool aEnabled ) { m_replaceFootprints = aEnabled; }
87
88 void SetDeleteUnusedFootprints( bool aEnabled ) { m_deleteUnusedFootprints = aEnabled; }
89
90 void SetLookupByTimestamp( bool aEnabled ) { m_lookupByTimestamp = aEnabled; }
91
92 std::vector<FOOTPRINT*> GetAddedFootprints() const { return m_addedFootprints; }
93
94private:
95 void cacheNetname( PAD* aPad, const wxString& aNetname );
96 wxString getNetname( PAD* aPad );
97
98 void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
99 wxString getPinFunction( PAD* aPad );
100
102
103 FOOTPRINT* addNewFootprint( COMPONENT* aComponent );
104
105 FOOTPRINT* replaceFootprint( NETLIST& aNetlist, FOOTPRINT* aFootprint,
106 COMPONENT* aNewComponent );
107
108 bool updateFootprintParameters( FOOTPRINT* aPcbFootprint, COMPONENT* aNetlistComponent );
109
110 bool updateComponentPadConnections( FOOTPRINT* aFootprint, COMPONENT* aNewComponent );
111
113
114 bool updateCopperZoneNets( NETLIST& aNetlist );
115
116 bool testConnectivity( NETLIST& aNetlist, std::map<COMPONENT*, FOOTPRINT*>& aFootprintMap );
117
122
123 std::map<ZONE*, std::vector<PAD*>> m_zoneConnectionsCache;
124 std::map<wxString, wxString> m_oldToNewNets;
125 std::map<PAD*, wxString> m_padNets;
126 std::map<PAD*, wxString> m_padPinFunctions;
127 std::vector<FOOTPRINT*> m_addedFootprints;
128 std::map<wxString, NETINFO_ITEM*> m_addedNets;
129
134
137 int m_newFootprintsCount; // the count of new footprints
138 // either really new or replaced by new fp.
139};
140
141#endif
Update the BOARD with a new netlist.
std::map< PAD *, wxString > m_padNets
void cacheNetname(PAD *aPad, const wxString &aNetname)
void SetReporter(REPORTER *aReporter)
Enable dry run mode (just report, no changes to PCB).
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
wxString getNetname(PAD *aPad)
wxString getPinFunction(PAD *aPad)
std::vector< FOOTPRINT * > m_addedFootprints
void SetIsDryRun(bool aEnabled)
void SetDeleteUnusedFootprints(bool aEnabled)
std::map< wxString, wxString > m_oldToNewNets
bool updateFootprintParameters(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
std::map< wxString, NETINFO_ITEM * > m_addedNets
bool testConnectivity(NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
void SetReplaceFootprints(bool aEnabled)
bool updateCopperZoneNets(NETLIST &aNetlist)
void cachePinFunction(PAD *aPad, const wxString &aPinFunction)
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
std::map< PAD *, wxString > m_padPinFunctions
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
void SetLookupByTimestamp(bool aEnabled)
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
std::vector< FOOTPRINT * > GetAddedFootprints() const
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:240
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:213
Definition: pad.h:59
The main frame for Pcbnew.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71