KiCad PCB EDA Suite
Loading...
Searching...
No Matches
connection_graph.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) 2018 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Jon Evans <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef _CONNECTION_GRAPH_H
23#define _CONNECTION_GRAPH_H
24
25#include <mutex>
26#include <utility>
27#include <vector>
28
29#include <erc/erc_settings.h>
30#include <sch_connection.h>
31#include <sch_item.h>
32#include <wx/treectrl.h>
33#include <advanced_config.h>
34#include <progress_reporter.h>
35
36
37#ifdef DEBUG
38// Uncomment this line to enable connectivity debugging features
39// #define CONNECTIVITY_DEBUG
40#endif
41
42
44class SCHEMATIC;
45class SCH_EDIT_FRAME;
46class SCH_HIERLABEL;
47class SCH_PIN;
48class SCH_SHEET_PIN;
49
50
64{
65public:
66 enum class PRIORITY
67 {
68 INVALID = -1,
69 NONE = 0,
70 PIN,
76 GLOBAL
77 };
78
80 m_graph( aGraph ),
81 m_dirty( false ),
82 m_absorbed( false ),
83 m_is_bus_member( false ),
84 m_absorbed_by( nullptr ),
85 m_code( -1 ),
86 m_multiple_drivers( false ),
87 m_strong_driver( false ),
88 m_local_driver( false ),
89 m_bus_entry( nullptr ),
90 m_hier_parent( nullptr ),
91 m_driver( nullptr ),
92 m_no_connect( nullptr ),
93 m_driver_connection( nullptr )
94 {}
95
97 {
98 for( SCH_CONNECTION* connection : m_bus_element_connections )
99 delete connection;
100 }
101
102 friend class CONNECTION_GRAPH;
103
113 bool ResolveDrivers( bool aCheckMultipleDrivers = false );
114
118 wxString GetNetName() const;
119
121 std::vector<SCH_ITEM*> GetVectorBusLabels() const;
122
124 std::vector<SCH_ITEM*> GetAllBusLabels() const;
125
127 const wxString& GetNameForDriver( SCH_ITEM* aItem ) const;
128
131 const std::vector<std::pair<wxString, SCH_ITEM*>>
132 GetNetclassesForDriver( SCH_ITEM* aItem ) const;
133
135 void Absorb( CONNECTION_SUBGRAPH* aOther );
136
138 void AddItem( SCH_ITEM* aItem );
139
142
144 const std::set<SCH_ITEM*>& GetItems() const
145 {
146 return m_items;
147 }
148
150 void getAllConnectedItems( std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>>& aItems,
151 std::set<CONNECTION_SUBGRAPH*>& aSubgraphs );
152
167 static PRIORITY GetDriverPriority( SCH_ITEM* aDriver );
168
170 {
171 if( m_driver )
172 return GetDriverPriority( m_driver );
173 else
174 return PRIORITY::NONE;
175 }
176
181 const SCH_ITEM* GetDriver() const
182 {
183 return m_driver;
184 }
185
190 {
191 return m_driver_connection;
192 }
193
197 const SCH_ITEM* GetNoConnect() const
198 {
199 return m_no_connect;
200 }
201
203 {
204 return m_sheet;
205 }
206
207 const std::unordered_map< std::shared_ptr<SCH_CONNECTION>,
208 std::unordered_set<CONNECTION_SUBGRAPH*> >& GetBusParents() const
209 {
210 return m_bus_parents;
211 }
212
213 void RemoveItem( SCH_ITEM* aItem );
214
218 void ExchangeItem( SCH_ITEM* aOldItem, SCH_ITEM* aNewItem );
219
220 // Use this to keep a connection pointer that is not owned by any item
221 // This will be destroyed with the subgraph
223 {
224 m_bus_element_connections.insert( aConnection );
225 }
226
227private:
228 wxString driverName( SCH_ITEM* aItem ) const;
229
231
233
236
242
245
247 std::set<CONNECTION_SUBGRAPH*> m_absorbed_subgraphs;
248
249 long m_code;
250
257
260
263
266
267 std::set<SCH_ITEM*> m_drivers;
268
277 std::unordered_map< std::shared_ptr<SCH_CONNECTION>,
278 std::unordered_set<CONNECTION_SUBGRAPH*> > m_bus_neighbors;
279
285 std::unordered_map< std::shared_ptr<SCH_CONNECTION>,
286 std::unordered_set<CONNECTION_SUBGRAPH*> > m_bus_parents;
287
289 std::set<SCH_SHEET_PIN*> m_hier_pins;
290
292 std::set<SCH_HIERLABEL*> m_hier_ports;
293
296
299 std::unordered_set<CONNECTION_SUBGRAPH*> m_hier_children;
300
302 mutable std::mutex m_driver_name_cache_mutex;
303 mutable std::unordered_map<SCH_ITEM*, wxString> m_driver_name_cache;
304
307
309 std::set<SCH_ITEM*> m_items;
310
313
316
319
322 std::set<SCH_CONNECTION*> m_bus_element_connections;
323
324 std::mutex m_driver_mutex;
325};
326
328{
329 wxString Name;
331
332 bool operator==(const NET_NAME_CODE_CACHE_KEY& other) const
333 {
334 return Name == other.Name && Netcode == other.Netcode;
335 }
336};
337
338namespace std
339{
340 template <>
342 {
343 std::size_t operator()( const NET_NAME_CODE_CACHE_KEY& k ) const
344 {
345 const std::size_t prime = 19937;
346
347 return hash<wxString>()( k.Name ) ^ ( hash<int>()( k.Netcode ) * prime );
348 }
349 };
350}
351
353typedef std::unordered_map<NET_NAME_CODE_CACHE_KEY, std::vector<CONNECTION_SUBGRAPH*>> NET_MAP;
354
359{
360public:
361 CONNECTION_GRAPH( SCHEMATIC* aSchematic = nullptr ) :
362 m_last_net_code( 1 ),
363 m_last_bus_code( 1 ),
365 m_schematic( aSchematic )
366 {}
367
369 {
370 Reset();
371 }
372
373 // We own at least one list of raw pointers. Don't let the compiler fill in copy c'tors that
374 // will only land us in trouble.
377
378 // Define QA friend functions to allow testing of private methods
381
382 void Reset();
383
384 void SetSchematic( SCHEMATIC* aSchematic )
385 {
386 m_schematic = aSchematic;
387 }
388
389 void SetLastCodes( const CONNECTION_GRAPH* aOther )
390 {
394 }
395
403 void Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnconditional = false,
404 std::function<void( SCH_ITEM* )>* aChangedItemHandler = nullptr,
405 PROGRESS_REPORTER* aProgressReporter = nullptr );
406
413 std::shared_ptr<BUS_ALIAS> GetBusAlias( const wxString& aName );
414
422 std::vector<const CONNECTION_SUBGRAPH*> GetBusesNeedingMigration();
423
431 int RunERC();
432
434
442 CONNECTION_SUBGRAPH* FindSubgraphByName( const wxString& aNetName,
443 const SCH_SHEET_PATH& aPath );
444
453 CONNECTION_SUBGRAPH* FindFirstSubgraphByName( const wxString& aNetName );
454
456
457 const std::vector<CONNECTION_SUBGRAPH*>& GetAllSubgraphs( const wxString& aNetName ) const;
458
465 wxString GetResolvedSubgraphName( const CONNECTION_SUBGRAPH* aSubGraph ) const;
466
474 std::set<std::pair<SCH_SHEET_PATH, SCH_ITEM*>> ExtractAffectedItems(
475 const std::set<SCH_ITEM*> &aItems );
476
484 void Merge( CONNECTION_GRAPH& aGraph );
485
486 void RemoveItem( SCH_ITEM* aItem );
487
491 void ExchangeItem( SCH_ITEM* aOldItem, SCH_ITEM* aNewItem );
492
500 bool IsMinor() const
501 {
502 return static_cast<ssize_t>( m_items.size() )
504 }
505
506private:
507
513 void updateSymbolConnectivity( const SCH_SHEET_PATH& aSheet,
514 SCH_SYMBOL* aSymbol,
515 std::map<VECTOR2I, std::vector<SCH_ITEM*>>& aConnectionMap );
516
522 void updatePinConnectivity( const SCH_SHEET_PATH& aSheet,
523 SCH_PIN* aPin,
524 SCH_CONNECTION* aConnection );
525
532 SCH_ITEM* aItem,
533 std::map<VECTOR2I, std::vector<SCH_ITEM*>>& aConnectionMap );
534
562 void updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
563 const std::vector<SCH_ITEM*>& aItemList );
564
582 void buildConnectionGraph( std::function<void( SCH_ITEM* )>* aChangedItemHandler,
583 bool aUnconditional );
584
588 void buildItemSubGraphs();
589
593 void resolveAllDrivers();
594
599
604
609
613 void processSubGraphs();
614
620 int assignNewNetCode( SCH_CONNECTION& aConnection );
621
627 int getOrCreateNetCode( const wxString& aNetName );
628
634 void assignNetCodesToBus( SCH_CONNECTION* aConnection );
635
645 void propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, bool aForce );
646
652 void removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgraphs );
653
664 static SCH_CONNECTION* matchBusMember( SCH_CONNECTION* aBusConnection,
665 SCH_CONNECTION* aSearch );
666
676 std::shared_ptr<SCH_CONNECTION> getDefaultConnection( SCH_ITEM* aItem,
677 CONNECTION_SUBGRAPH* aSubgraph );
678
679 void recacheSubgraphName( CONNECTION_SUBGRAPH* aSubgraph, const wxString& aOldName );
680
689 bool ercCheckMultipleDrivers( const CONNECTION_SUBGRAPH* aSubgraph );
690
699 bool ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSubgraph );
700
711 bool ercCheckBusToBusConflicts( const CONNECTION_SUBGRAPH* aSubgraph );
712
726
736 bool ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph );
737
746 bool ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgraph );
747
756 bool ercCheckDanglingWireEndpoints( const CONNECTION_SUBGRAPH* aSubgraph );
757
767 bool ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph );
768
775
783 int ercCheckHierSheets();
784
789
796 size_t hasPins( const CONNECTION_SUBGRAPH* aLocSubgraph );
797
798
799private:
802
804 std::vector<SCH_ITEM*> m_items;
805
807 std::vector<CONNECTION_SUBGRAPH*> m_subgraphs;
808
810 std::vector<CONNECTION_SUBGRAPH*> m_driver_subgraphs;
811
813 std::unordered_map<SCH_SHEET_PATH, std::vector<CONNECTION_SUBGRAPH*>> m_sheet_to_subgraphs_map;
814
815 std::vector<std::pair<SCH_SHEET_PATH, SCH_PIN*>> m_global_power_pins;
816
817 std::unordered_map<wxString, std::shared_ptr<BUS_ALIAS>> m_bus_alias_cache;
818
819 std::unordered_map<wxString, int> m_net_name_to_code_map;
820
821 std::unordered_map<wxString, int> m_bus_name_to_code_map;
822
823 std::unordered_map<wxString, std::vector<const CONNECTION_SUBGRAPH*>> m_global_label_cache;
824
825 std::map< std::pair<SCH_SHEET_PATH, wxString>,
826 std::vector<const CONNECTION_SUBGRAPH*> > m_local_label_cache;
827
828 std::unordered_map<wxString, std::vector<CONNECTION_SUBGRAPH*>> m_net_name_to_subgraphs_map;
829
830 std::unordered_map<SCH_ITEM*, CONNECTION_SUBGRAPH*> m_item_to_subgraph_map;
831
833
835
837
839
841};
842
843#endif
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Calculate the connectivity of a schematic and generates netlists.
int RunERC()
Run electrical rule checks on the connectivity graph.
void SetSchematic(SCHEMATIC *aSchematic)
bool ercCheckBusToBusConflicts(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for conflicting connections between two bus items.
void processSubGraphs()
Process all subgraphs to assign netcodes and merge subgraphs based on labels.
bool ercCheckLabels(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for proper connection of labels.
void RemoveItem(SCH_ITEM *aItem)
void collectAllDriverValues()
Map the driver values for each subgraph.
friend void boost_test_update_generic_connectivity()
CONNECTION_SUBGRAPH * FindSubgraphByName(const wxString &aNetName, const SCH_SHEET_PATH &aPath)
Return the subgraph for a given net name on a given sheet.
int ercCheckDirectiveLabels()
Check directive labels should be connected to something.
void recacheSubgraphName(CONNECTION_SUBGRAPH *aSubgraph, const wxString &aOldName)
const NET_MAP & GetNetMap() const
static SCH_CONNECTION * matchBusMember(SCH_CONNECTION *aBusConnection, SCH_CONNECTION *aSearch)
Search for a matching bus member inside a bus connection.
CONNECTION_GRAPH & operator=(const CONNECTION_GRAPH &)=delete
std::unordered_map< wxString, std::shared_ptr< BUS_ALIAS > > m_bus_alias_cache
SCHEMATIC * m_schematic
The schematic this graph represents.
void updateGenericItemConnectivity(const SCH_SHEET_PATH &aSheet, SCH_ITEM *aItem, std::map< VECTOR2I, std::vector< SCH_ITEM * > > &aConnectionMap)
Update the connectivity of items that are not pins or symbols.
friend void boost_test_update_symbol_connectivity()
std::unordered_map< SCH_SHEET_PATH, std::vector< CONNECTION_SUBGRAPH * > > m_sheet_to_subgraphs_map
Cache to lookup subgraphs in m_driver_subgraphs by sheet path.
void updateSymbolConnectivity(const SCH_SHEET_PATH &aSheet, SCH_SYMBOL *aSymbol, std::map< VECTOR2I, std::vector< SCH_ITEM * > > &aConnectionMap)
Update the connectivity of a symbol and its pins.
CONNECTION_SUBGRAPH * FindFirstSubgraphByName(const wxString &aNetName)
Retrieve a subgraph for the given net name, if one exists.
void propagateToNeighbors(CONNECTION_SUBGRAPH *aSubgraph, bool aForce)
Update all neighbors of a subgraph with this one's connectivity info.
void buildItemSubGraphs()
Generate individual item subgraphs on a per-sheet basis.
const std::vector< CONNECTION_SUBGRAPH * > & GetAllSubgraphs(const wxString &aNetName) const
bool ercCheckMultipleDrivers(const CONNECTION_SUBGRAPH *aSubgraph)
If the subgraph has multiple drivers of equal priority that are graphically connected,...
SCH_SHEET_LIST m_sheetList
All the sheets in the schematic (as long as we don't have partial updates).
void generateGlobalPowerPinSubGraphs()
Iterate through the global power pins to collect the global labels as drivers.
std::unordered_map< wxString, int > m_net_name_to_code_map
int ercCheckSingleGlobalLabel()
Check that a global label is instantiated more that once across the schematic hierarchy.
int ercCheckHierSheets()
Check that a hierarchical sheet has at least one matching label inside the sheet for each port on the...
bool ercCheckBusToNetConflicts(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for conflicting connections between net and bus labels.
std::shared_ptr< SCH_CONNECTION > getDefaultConnection(SCH_ITEM *aItem, CONNECTION_SUBGRAPH *aSubgraph)
Build a new default connection for the given item based on its properties.
std::vector< const CONNECTION_SUBGRAPH * > GetBusesNeedingMigration()
Determine which subgraphs have more than one conflicting bus label.
void Recalculate(const SCH_SHEET_LIST &aSheetList, bool aUnconditional=false, std::function< void(SCH_ITEM *)> *aChangedItemHandler=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Update the connection graph for the given list of sheets.
int assignNewNetCode(SCH_CONNECTION &aConnection)
Helper to assign a new net code to a connection.
std::map< std::pair< SCH_SHEET_PATH, wxString >, std::vector< const CONNECTION_SUBGRAPH * > > m_local_label_cache
int getOrCreateNetCode(const wxString &aNetName)
bool ercCheckDanglingWireEndpoints(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for dangling wire endpoints.
void assignNetCodesToBus(SCH_CONNECTION *aConnection)
Ensure all members of the bus connection have a valid net code assigned.
std::unordered_map< wxString, int > m_bus_name_to_code_map
bool IsMinor() const
We modify how we handle the connectivity graph for small graphs vs large graphs.
std::unordered_map< wxString, std::vector< const CONNECTION_SUBGRAPH * > > m_global_label_cache
std::vector< CONNECTION_SUBGRAPH * > m_subgraphs
The owner of all CONNECTION_SUBGRAPH objects.
std::vector< std::pair< SCH_SHEET_PATH, SCH_PIN * > > m_global_power_pins
CONNECTION_GRAPH(SCHEMATIC *aSchematic=nullptr)
bool ercCheckNoConnects(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for proper presence or absence of no-connect symbols.
size_t hasPins(const CONNECTION_SUBGRAPH *aLocSubgraph)
Get the number of pins in a given subgraph.
std::vector< SCH_ITEM * > m_items
All connectable items in the schematic.
std::unordered_map< wxString, std::vector< CONNECTION_SUBGRAPH * > > m_net_name_to_subgraphs_map
std::shared_ptr< BUS_ALIAS > GetBusAlias(const wxString &aName)
Return a bus alias pointer for the given name if it exists (from cache)
void removeSubgraphs(std::set< CONNECTION_SUBGRAPH * > &aSubgraphs)
Remove references to the given subgraphs from all structures in the connection graph.
std::unordered_map< SCH_ITEM *, CONNECTION_SUBGRAPH * > m_item_to_subgraph_map
std::set< std::pair< SCH_SHEET_PATH, SCH_ITEM * > > ExtractAffectedItems(const std::set< SCH_ITEM * > &aItems)
For a set of items, this will remove the connected items and their associated data including subgraph...
wxString GetResolvedSubgraphName(const CONNECTION_SUBGRAPH *aSubGraph) const
Return the fully-resolved netname for a given subgraph.
bool ercCheckBusToBusEntryConflicts(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for conflicting bus entry to bus connections.
std::vector< CONNECTION_SUBGRAPH * > m_driver_subgraphs
Cache of a subset of m_subgraphs.
CONNECTION_GRAPH(const CONNECTION_GRAPH &)=delete
void ExchangeItem(SCH_ITEM *aOldItem, SCH_ITEM *aNewItem)
Replace all references to #aOldItem with #aNewItem in the graph.
NET_MAP m_net_code_to_subgraphs_map
bool ercCheckFloatingWires(const CONNECTION_SUBGRAPH *aSubgraph)
Check one subgraph for floating wires.
void SetLastCodes(const CONNECTION_GRAPH *aOther)
void buildConnectionGraph(std::function< void(SCH_ITEM *)> *aChangedItemHandler, bool aUnconditional)
Generate the connection graph (after all item connectivity has been updated).
void Merge(CONNECTION_GRAPH &aGraph)
Combine the input graph contents into the current graph.
void updatePinConnectivity(const SCH_SHEET_PATH &aSheet, SCH_PIN *aPin, SCH_CONNECTION *aConnection)
Update the connectivity of a pin and its connections.
void resolveAllDrivers()
Find all subgraphs in the connection graph and calls ResolveDrivers() in parallel.
void updateItemConnectivity(const SCH_SHEET_PATH &aSheet, const std::vector< SCH_ITEM * > &aItemList)
Update the graphical connectivity between items (i.e.
CONNECTION_SUBGRAPH * GetSubgraphForItem(SCH_ITEM *aItem) const
void generateBusAliasMembers()
Iterate through labels to create placeholders for bus elements.
A subgraph is a set of items that are electrically connected on a single sheet.
wxString driverName(SCH_ITEM *aItem) const
PRIORITY GetDriverPriority()
const std::set< SCH_ITEM * > & GetItems() const
Provide a read-only reference to the items in the subgraph.
const SCH_ITEM * GetNoConnect() const
void StoreImplicitConnection(SCH_CONNECTION *aConnection)
bool m_strong_driver
True if the driver is "strong": a label or power object.
SCH_ITEM * m_no_connect
No-connect item in graph, if any.
std::set< CONNECTION_SUBGRAPH * > m_absorbed_subgraphs
Set of subgraphs that have been absorbed by this subgraph.
const SCH_ITEM * GetDriver() const
SCH_ITEM * m_bus_entry
Bus entry in graph, if any.
std::mutex m_driver_name_cache_mutex
A cache of escaped netnames from schematic items.
SCH_SHEET_PATH m_sheet
On which logical sheet is the subgraph contained.
void UpdateItemConnections()
Update all items to match the driver connection.
std::set< SCH_SHEET_PIN * > m_hier_pins
Cache for lookup of any hierarchical (sheet) pins on this subgraph (for referring down).
std::unordered_map< std::shared_ptr< SCH_CONNECTION >, std::unordered_set< CONNECTION_SUBGRAPH * > > m_bus_neighbors
If a subgraph is a bus, this map contains links between the bus members and any local sheet neighbors...
CONNECTION_GRAPH * m_graph
std::vector< SCH_ITEM * > GetAllBusLabels() const
Return all the all bus labels attached to this subgraph (if any).
std::unordered_map< SCH_ITEM *, wxString > m_driver_name_cache
const wxString & GetNameForDriver(SCH_ITEM *aItem) const
Return the candidate net name for a driver.
wxString GetNetName() const
Return the fully-qualified net name for this subgraph (if one exists)
std::vector< SCH_ITEM * > GetVectorBusLabels() const
Return all the vector-based bus labels attached to this subgraph (if any).
const std::unordered_map< std::shared_ptr< SCH_CONNECTION >, std::unordered_set< CONNECTION_SUBGRAPH * > > & GetBusParents() const
const SCH_SHEET_PATH & GetSheet() const
bool m_multiple_drivers
True if this subgraph contains more than one driver that should be shorted together in the netlist.
bool ResolveDrivers(bool aCheckMultipleDrivers=false)
Determine which potential driver should drive the subgraph.
std::set< SCH_ITEM * > m_drivers
const SCH_CONNECTION * GetDriverConnection() const
bool m_absorbed
True if this subgraph has been absorbed into another. No pointers here are safe if so!
SCH_CONNECTION * m_driver_connection
Cache for driver connection.
CONNECTION_SUBGRAPH * m_absorbed_by
If this subgraph is absorbed, points to the absorbing (and valid) subgraph.
std::unordered_set< CONNECTION_SUBGRAPH * > m_hier_children
If not null, this indicates the subgraph(s) on a lower level sheet that are linked to this one.
void AddItem(SCH_ITEM *aItem)
Add a new item to the subgraph.
std::set< SCH_CONNECTION * > m_bus_element_connections
A cache of connections that are part of this subgraph but that don't have an owning element (i....
const std::vector< std::pair< wxString, SCH_ITEM * > > GetNetclassesForDriver(SCH_ITEM *aItem) const
Return the resolved netclasses for the item, and the source item providing the netclass.
void Absorb(CONNECTION_SUBGRAPH *aOther)
Combine another subgraph on the same sheet into this one.
std::set< SCH_ITEM * > m_items
Contents of the subgraph.
std::unordered_map< std::shared_ptr< SCH_CONNECTION >, std::unordered_set< CONNECTION_SUBGRAPH * > > m_bus_parents
If this is a net, this vector contains links to any same-sheet buses that contain it.
SCH_ITEM * m_driver
Fully-resolved driver for the subgraph (might not exist in this subgraph).
CONNECTION_SUBGRAPH(CONNECTION_GRAPH *aGraph)
bool m_is_bus_member
True if the subgraph is not actually part of a net.
void ExchangeItem(SCH_ITEM *aOldItem, SCH_ITEM *aNewItem)
Replaces all references to #aOldItem with #aNewItem in the subgraph.
CONNECTION_SUBGRAPH * m_hier_parent
If not null, this indicates the subgraph on a higher level sheet that is linked to this one.
void RemoveItem(SCH_ITEM *aItem)
bool m_local_driver
True if the driver is a local (i.e. non-global) type.
std::set< SCH_HIERLABEL * > m_hier_ports
Cache for lookup of any hierarchical ports on this subgraph (for referring up).
void getAllConnectedItems(std::set< std::pair< SCH_SHEET_PATH, SCH_ITEM * > > &aItems, std::set< CONNECTION_SUBGRAPH * > &aSubgraphs)
Find all items in the subgraph as well as child subgraphs recursively.
A progress reporter interface for use in multi-threaded environments.
Holds all the data relating to one schematic.
Definition: schematic.h:88
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Schematic symbol object.
Definition: sch_symbol.h:75
std::unordered_map< NET_NAME_CODE_CACHE_KEY, std::vector< CONNECTION_SUBGRAPH * > > NET_MAP
Associate a #NET_CODE_NAME with all the subgraphs in that net.
int m_MinorSchematicGraphSize
Set the number of items in a schematic graph for it to be considered "minor".
STL namespace.
bool operator==(const NET_NAME_CODE_CACHE_KEY &other) const
std::size_t operator()(const NET_NAME_CODE_CACHE_KEY &k) const