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 
32 class BOARD;
33 class REPORTER;
34 class NETLIST;
35 class COMPONENT;
36 class FOOTPRINT;
37 class PCB_EDIT_FRAME;
38 
39 #include <board_commit.h>
40 
66 {
67 public:
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 
94 private:
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
wxString getNetname(PAD *aPad)
Update the BOARD with a new netlist.
void SetReporter(REPORTER *aReporter)
Enable dry run mode (just report, no changes to PCB).
std::map< wxString, wxString > m_oldToNewNets
bool updateCopperZoneNets(NETLIST &aNetlist)
void cachePinFunction(PAD *aPad, const wxString &aPinFunction)
void SetLookupByTimestamp(bool aEnabled)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:70
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
std::map< wxString, NETINFO_ITEM * > m_addedNets
bool updateComponentPadConnections(FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
wxString getPinFunction(PAD *aPad)
std::vector< FOOTPRINT * > m_addedFootprints
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:206
std::map< ZONE *, std::vector< PAD * > > m_zoneConnectionsCache
void SetReplaceFootprints(bool aEnabled)
FOOTPRINT * replaceFootprint(NETLIST &aNetlist, FOOTPRINT *aFootprint, COMPONENT *aNewComponent)
std::vector< FOOTPRINT * > GetAddedFootprints() const
void SetIsDryRun(bool aEnabled)
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
bool updateFootprintParameters(FOOTPRINT *aPcbFootprint, COMPONENT *aNetlistComponent)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
FOOTPRINT * addNewFootprint(COMPONENT *aComponent)
The main frame for Pcbnew.
std::map< PAD *, wxString > m_padNets
Definition: pad.h:57
bool testConnectivity(NETLIST &aNetlist, std::map< COMPONENT *, FOOTPRINT * > &aFootprintMap)
BOARD_NETLIST_UPDATER(PCB_EDIT_FRAME *aFrame, BOARD *aBoard)
void cacheNetname(PAD *aPad, const wxString &aNetname)
std::map< PAD *, wxString > m_padPinFunctions
void SetDeleteUnusedFootprints(bool aEnabled)