KiCad PCB EDA Suite
CONNECTION_SUBGRAPH Class Reference

A subgraph is a set of items that are electrically connected on a single sheet. More...

#include <connection_graph.h>

Public Types

enum class  PRIORITY {
  INVALID = -1 , NONE = 0 , PIN , SHEET_PIN ,
  HIER_LABEL , LOCAL_LABEL , POWER_PIN , GLOBAL
}
 

Public Member Functions

 CONNECTION_SUBGRAPH (CONNECTION_GRAPH *aGraph)
 
 ~CONNECTION_SUBGRAPH ()=default
 
bool ResolveDrivers (bool aCheckMultipleDrivers=false)
 Determines which potential driver should drive the subgraph. More...
 
wxString GetNetName () const
 Returns the fully-qualified net name for this subgraph (if one exists) More...
 
std::vector< SCH_ITEM * > GetBusLabels () const
 Returns all the bus labels attached to this subgraph (if any) More...
 
const wxString & GetNameForDriver (SCH_ITEM *aItem)
 Returns the candidate net name for a driver. More...
 
const wxString GetNameForDriver (SCH_ITEM *aItem) const
 
const wxString GetNetclassForDriver (SCH_ITEM *aItem) const
 
void Absorb (CONNECTION_SUBGRAPH *aOther)
 Combines another subgraph on the same sheet into this one. More...
 
void AddItem (SCH_ITEM *aItem)
 Adds a new item to the subgraph. More...
 
void UpdateItemConnections ()
 Updates all items to match the driver connection. More...
 
PRIORITY GetDriverPriority ()
 

Static Public Member Functions

static PRIORITY GetDriverPriority (SCH_ITEM *aDriver)
 Return the priority (higher is more important) of a candidate driver. More...
 

Public Attributes

CONNECTION_GRAPHm_graph
 
bool m_dirty
 
bool m_absorbed
 True if this subgraph has been absorbed into another. No pointers here are safe if so! More...
 
CONNECTION_SUBGRAPHm_absorbed_by
 If this subgraph is absorbed, points to the absorbing (and valid) subgraph. More...
 
long m_code
 
bool m_multiple_drivers
 True if this subgraph contains more than one driver that should be shorted together in the netlist. More...
 
bool m_strong_driver
 True if the driver is "strong": a label or power object. More...
 
bool m_local_driver
 True if the driver is a local (i.e. non-global) type. More...
 
SCH_ITEMm_no_connect
 No-connect item in graph, if any. More...
 
SCH_ITEMm_bus_entry
 Bus entry in graph, if any. More...
 
std::vector< SCH_ITEM * > m_items
 
std::vector< SCH_ITEM * > m_drivers
 
SCH_ITEMm_driver
 
SCH_SHEET_PATH m_sheet
 
SCH_CONNECTIONm_driver_connection
 Cache for driver connection. More...
 
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 with the same connection name. More...
 
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. More...
 
std::vector< SCH_SHEET_PIN * > m_hier_pins
 
std::vector< SCH_HIERLABEL * > m_hier_ports
 
CONNECTION_SUBGRAPHm_hier_parent
 
std::unordered_map< SCH_ITEM *, wxString > m_driver_name_cache
 A cache of escaped netnames from schematic items. More...
 
SCH_ITEMm_first_driver
 Stores the primary driver for the multiple drivers ERC check. More...
 
SCH_ITEMm_second_driver
 Used for multiple drivers ERC message; stores the second possible driver (or nullptr) More...
 

Private Member Functions

wxString driverName (SCH_ITEM *aItem) const
 

Detailed Description

A subgraph is a set of items that are electrically connected on a single sheet.

For example, a label connected to a wire and so on. A net is composed of one or more subgraphs.

A set of items that appears to be physically connected may actually be more than one subgraph, because some items don't connect electrically.

For example, multiple bus wires can come together at a junction but have different labels on each branch. Each label+wire branch is its own subgraph.

Definition at line 60 of file connection_graph.h.

Member Enumeration Documentation

◆ PRIORITY

enum class CONNECTION_SUBGRAPH::PRIORITY
strong
Enumerator
INVALID 
NONE 
PIN 
SHEET_PIN 
HIER_LABEL 
LOCAL_LABEL 
POWER_PIN 
GLOBAL 

Definition at line 63 of file connection_graph.h.

64 {
65 INVALID = -1,
66 NONE = 0,
67 PIN,
68 SHEET_PIN,
69 HIER_LABEL,
70 LOCAL_LABEL,
71 POWER_PIN,
72 GLOBAL
73 };
@ NONE
Definition: kibis.h:53
@ INVALID
Definition: kiface_ids.h:32

Constructor & Destructor Documentation

◆ CONNECTION_SUBGRAPH()

CONNECTION_SUBGRAPH::CONNECTION_SUBGRAPH ( CONNECTION_GRAPH aGraph)
inlineexplicit

Definition at line 75 of file connection_graph.h.

75 :
76 m_graph( aGraph ),
77 m_dirty( false ),
78 m_absorbed( false ),
79 m_absorbed_by( nullptr ),
80 m_code( -1 ),
81 m_multiple_drivers( false ),
82 m_strong_driver( false ),
83 m_local_driver( false ),
84 m_no_connect( nullptr ),
85 m_bus_entry( nullptr ),
86 m_driver( nullptr ),
87 m_driver_connection( nullptr ),
88 m_hier_parent( nullptr ),
89 m_first_driver( nullptr ),
90 m_second_driver( nullptr )
91 {}
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.
SCH_ITEM * m_bus_entry
Bus entry in graph, if any.
CONNECTION_GRAPH * m_graph
bool m_multiple_drivers
True if this subgraph contains more than one driver that should be shorted together in the netlist.
SCH_ITEM * m_first_driver
Stores the primary driver for the multiple drivers ERC check.
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.
CONNECTION_SUBGRAPH * m_hier_parent
SCH_ITEM * m_second_driver
Used for multiple drivers ERC message; stores the second possible driver (or nullptr)
bool m_local_driver
True if the driver is a local (i.e. non-global) type.

◆ ~CONNECTION_SUBGRAPH()

CONNECTION_SUBGRAPH::~CONNECTION_SUBGRAPH ( )
default

Member Function Documentation

◆ Absorb()

void CONNECTION_SUBGRAPH::Absorb ( CONNECTION_SUBGRAPH aOther)

Combines another subgraph on the same sheet into this one.

Definition at line 357 of file connection_graph.cpp.

358{
359 wxASSERT( m_sheet == aOther->m_sheet );
360
361 for( SCH_ITEM* item : aOther->m_items )
362 {
364 AddItem( item );
365 }
366
367 m_bus_neighbors.insert( aOther->m_bus_neighbors.begin(), aOther->m_bus_neighbors.end() );
368 m_bus_parents.insert( aOther->m_bus_parents.begin(), aOther->m_bus_parents.end() );
369
371
372 aOther->m_absorbed = true;
373 aOther->m_dirty = false;
374 aOther->m_driver = nullptr;
375 aOther->m_driver_connection = nullptr;
376 aOther->m_absorbed_by = this;
377}
std::vector< SCH_ITEM * > m_items
SCH_SHEET_PATH m_sheet
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...
void AddItem(SCH_ITEM *aItem)
Adds a new item to 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.
void SetSubgraphCode(int aCode)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:146

References AddItem(), SCH_ITEM::Connection(), m_absorbed, m_absorbed_by, m_bus_neighbors, m_bus_parents, m_code, m_dirty, m_driver, m_driver_connection, m_items, m_multiple_drivers, m_sheet, and SCH_CONNECTION::SetSubgraphCode().

◆ AddItem()

void CONNECTION_SUBGRAPH::AddItem ( SCH_ITEM aItem)

Adds a new item to the subgraph.

Definition at line 380 of file connection_graph.cpp.

381{
382 m_items.push_back( aItem );
383
384 if( aItem->Connection( &m_sheet )->IsDriver() )
385 m_drivers.push_back( aItem );
386
387 if( aItem->Type() == SCH_SHEET_PIN_T )
388 m_hier_pins.push_back( static_cast<SCH_SHEET_PIN*>( aItem ) );
389 else if( aItem->Type() == SCH_HIER_LABEL_T )
390 m_hier_ports.push_back( static_cast<SCH_HIERLABEL*>( aItem ) );
391}
std::vector< SCH_ITEM * > m_drivers
std::vector< SCH_HIERLABEL * > m_hier_ports
std::vector< SCH_SHEET_PIN * > m_hier_pins
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
bool IsDriver() const
Checks if the SCH_ITEM this connection is attached to can drive connections Drivers can be labels,...
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157

References SCH_ITEM::Connection(), SCH_CONNECTION::IsDriver(), m_drivers, m_hier_pins, m_hier_ports, m_items, m_sheet, SCH_HIER_LABEL_T, SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by Absorb(), CONNECTION_GRAPH::buildItemSubGraphs(), and CONNECTION_GRAPH::generateInvisiblePinSubGraphs().

◆ driverName()

wxString CONNECTION_SUBGRAPH::driverName ( SCH_ITEM aItem) const
private

Definition at line 278 of file connection_graph.cpp.

279{
280 switch( aItem->Type() )
281 {
282 case SCH_PIN_T:
283 {
284 bool forceNoConnect = m_no_connect != nullptr;
285 SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
286 return pin->GetDefaultNetName( m_sheet, forceNoConnect );
287 break;
288 }
289
290 case SCH_LABEL_T:
292 case SCH_HIER_LABEL_T:
293 case SCH_SHEET_PIN_T:
294 {
295 return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText(), CTX_NETNAME );
296 break;
297 }
298
299 default:
300 wxFAIL_MSG( "Unhandled item type in GetNameForDriver" );
301 break;
302 }
303
304 return wxEmptyString;
305}
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_NETNAME
Definition: string_utils.h:54
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_PIN_T
Definition: typeinfo.h:159

References CTX_NETNAME, EscapeString(), m_no_connect, m_sheet, pin, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by GetNameForDriver().

◆ GetBusLabels()

std::vector< SCH_ITEM * > CONNECTION_SUBGRAPH::GetBusLabels ( ) const

Returns all the bus labels attached to this subgraph (if any)

Definition at line 249 of file connection_graph.cpp.

250{
251 std::vector<SCH_ITEM*> labels;
252
253 for( SCH_ITEM* item : m_drivers )
254 {
255 switch( item->Type() )
256 {
257 case SCH_LABEL_T:
259 {
260 SCH_CONNECTION* label_conn = item->Connection( &m_sheet );
261
262 // Only consider bus vectors
263 if( label_conn->Type() == CONNECTION_TYPE::BUS )
264 labels.push_back( item );
265
266 break;
267 }
268
269 default:
270 break;
271 }
272 }
273
274 return labels;
275}
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
CONNECTION_TYPE Type() const
@ BUS
This item represents a bus vector.

References BUS, m_drivers, m_sheet, SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and SCH_CONNECTION::Type().

◆ GetDriverPriority() [1/2]

◆ GetDriverPriority() [2/2]

CONNECTION_SUBGRAPH::PRIORITY CONNECTION_SUBGRAPH::GetDriverPriority ( SCH_ITEM aDriver)
static

Return the priority (higher is more important) of a candidate driver.

0: Invalid driver 1: Symbol pin 2: Hierarchical sheet pin 3: Hierarchical label 4: Local label 5: Power pin 6: Global label

Parameters
aDriveris the item to inspect
Returns
a PRIORITY

Definition at line 421 of file connection_graph.cpp.

422{
423 if( !aDriver )
424 return PRIORITY::NONE;
425
426 switch( aDriver->Type() )
427 {
432 case SCH_PIN_T:
433 {
434 SCH_PIN* sch_pin = static_cast<SCH_PIN*>( aDriver );
435
436 if( sch_pin->IsPowerConnection() )
437 return PRIORITY::POWER_PIN;
438 else
439 return PRIORITY::PIN;
440 }
441
442 default: return PRIORITY::NONE;
443 }
444}
bool IsPowerConnection() const
Definition: sch_pin.h:158

References GLOBAL, HIER_LABEL, SCH_PIN::IsPowerConnection(), LOCAL_LABEL, NONE, PIN, POWER_PIN, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_PIN_T, SCH_SHEET_PIN_T, SHEET_PIN, and EDA_ITEM::Type().

Referenced by CONNECTION_GRAPH::ercCheckNoConnects(), and SCHEMATIC::GetNetClassAssignmentCandidates().

◆ GetNameForDriver() [1/2]

const wxString & CONNECTION_SUBGRAPH::GetNameForDriver ( SCH_ITEM aItem)

Returns the candidate net name for a driver.

Definition at line 308 of file connection_graph.cpp.

309{
310 auto it = m_driver_name_cache.find( aItem );
311
312 if( it != m_driver_name_cache.end() )
313 return it->second;
314
315 m_driver_name_cache.emplace( aItem, driverName( aItem ) );
316
317 return m_driver_name_cache.at( aItem );
318}
wxString driverName(SCH_ITEM *aItem) const
std::unordered_map< SCH_ITEM *, wxString > m_driver_name_cache
A cache of escaped netnames from schematic items.

References driverName(), and m_driver_name_cache.

Referenced by CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::getDefaultConnection(), CONNECTION_GRAPH::propagateToNeighbors(), and ResolveDrivers().

◆ GetNameForDriver() [2/2]

const wxString CONNECTION_SUBGRAPH::GetNameForDriver ( SCH_ITEM aItem) const

Definition at line 321 of file connection_graph.cpp.

322{
323 auto it = m_driver_name_cache.find( aItem );
324
325 if( it != m_driver_name_cache.end() )
326 return it->second;
327
328 return driverName( aItem );
329}

References driverName(), and m_driver_name_cache.

◆ GetNetclassForDriver()

const wxString CONNECTION_SUBGRAPH::GetNetclassForDriver ( SCH_ITEM aItem) const

Definition at line 332 of file connection_graph.cpp.

333{
334 wxString netclass;
335
336 aItem->RunOnChildren(
337 [&]( SCH_ITEM* aChild )
338 {
339 if( aChild->Type() == SCH_FIELD_T )
340 {
341 SCH_FIELD* field = static_cast<SCH_FIELD*>( aChild );
342
343 if( field->GetCanonicalName() == wxT( "Netclass" ) )
344 {
345 netclass = field->GetText();
346 return false;
347 }
348 }
349
350 return true;
351 } );
352
353 return netclass;
354}
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444
@ SCH_FIELD_T
Definition: typeinfo.h:155

References SCH_ITEM::RunOnChildren(), SCH_FIELD_T, and EDA_ITEM::Type().

Referenced by CONNECTION_GRAPH::buildConnectionGraph().

◆ GetNetName()

wxString CONNECTION_SUBGRAPH::GetNetName ( ) const

Returns the fully-qualified net name for this subgraph (if one exists)

Definition at line 231 of file connection_graph.cpp.

232{
233 if( !m_driver || m_dirty )
234 return "";
235
236 if( !m_driver->Connection( &m_sheet ) )
237 {
238#ifdef CONNECTIVITY_DEBUG
239 wxASSERT_MSG( false, "Tried to get the net name of an item with no connection" );
240#endif
241
242 return "";
243 }
244
245 return m_driver->Connection( &m_sheet )->Name();
246}
wxString Name(bool aIgnoreSheet=false) const

References SCH_ITEM::Connection(), m_dirty, m_driver, m_sheet, and SCH_CONNECTION::Name().

Referenced by CONNECTION_GRAPH::buildConnectionGraph(), CONNECTION_GRAPH::ercCheckLabels(), and CONNECTION_GRAPH::generateInvisiblePinSubGraphs().

◆ ResolveDrivers()

bool CONNECTION_SUBGRAPH::ResolveDrivers ( bool  aCheckMultipleDrivers = false)

Determines which potential driver should drive the subgraph.

If multiple possible drivers exist, picks one according to the priority. If multiple "winners" exist, returns false and sets m_driver to nullptr.

Parameters
aCheckMultipleDriverscontrols whether the second driver should be captured for ERC
Returns
true if m_driver was set, or false if a conflict occurred

Definition at line 67 of file connection_graph.cpp.

68{
69 PRIORITY highest_priority = PRIORITY::INVALID;
70 std::vector<SCH_ITEM*> candidates;
71 std::vector<SCH_ITEM*> strong_drivers;
72
73 m_driver = nullptr;
74
75 // Hierarchical labels are lower priority than local labels here,
76 // because on the first pass we want local labels to drive subgraphs
77 // so that we can identify same-sheet neighbors and link them together.
78 // Hierarchical labels will end up overriding the final net name if
79 // a higher-level sheet has a different name during the hierarchical
80 // pass.
81
82 for( SCH_ITEM* item : m_drivers )
83 {
84 PRIORITY item_priority = GetDriverPriority( item );
85
86 if( item_priority == PRIORITY::PIN
87 && !static_cast<SCH_PIN*>( item )->GetParentSymbol()->IsInNetlist() )
88 continue;
89
90 if( item_priority >= PRIORITY::HIER_LABEL )
91 strong_drivers.push_back( item );
92
93 if( item_priority > highest_priority )
94 {
95 candidates.clear();
96 candidates.push_back( item );
97 highest_priority = item_priority;
98 }
99 else if( !candidates.empty() && ( item_priority == highest_priority ) )
100 {
101 candidates.push_back( item );
102 }
103 }
104
105 if( highest_priority >= PRIORITY::HIER_LABEL )
106 m_strong_driver = true;
107
108 // Power pins are 5, global labels are 6
109 m_local_driver = ( highest_priority < PRIORITY::POWER_PIN );
110
111 if( !candidates.empty() )
112 {
113 if( candidates.size() > 1 )
114 {
115 if( highest_priority == PRIORITY::SHEET_PIN )
116 {
117 // We have multiple options, and they are all hierarchical
118 // sheet pins. Let's prefer outputs over inputs.
119
120 for( SCH_ITEM* c : candidates )
121 {
122 SCH_SHEET_PIN* p = static_cast<SCH_SHEET_PIN*>( c );
123
125 {
126 m_driver = c;
127 break;
128 }
129 }
130 }
131 else
132 {
133 // For all other driver types, sort by quality of name
134 std::sort( candidates.begin(), candidates.end(),
135 [&]( SCH_ITEM* a, SCH_ITEM* b ) -> bool
136 {
137 // meet irreflexive requirements of std::sort
138 if( a == b )
139 return false;
140
141 SCH_CONNECTION* ac = a->Connection( &m_sheet );
142 SCH_CONNECTION* bc = b->Connection( &m_sheet );
143
144 // Ensure we don't pick the subset over the superset
145 if( ac->IsBus() && bc->IsBus() )
146 return bc->IsSubsetOf( ac );
147
148 // Ensure we don't pick a hidden power pin on a regular symbol over
149 // one on a power symbol
150 if( a->Type() == SCH_PIN_T && b->Type() == SCH_PIN_T )
151 {
152 SCH_PIN* pa = static_cast<SCH_PIN*>( a );
153 SCH_PIN* pb = static_cast<SCH_PIN*>( b );
154
155 bool aPower = pa->GetLibPin()->GetParent()->IsPower();
156 bool bPower = pb->GetLibPin()->GetParent()->IsPower();
157
158 if( aPower && !bPower )
159 return true;
160 else if( bPower && !aPower )
161 return false;
162 }
163
164 wxString a_name = GetNameForDriver( a );
165 wxString b_name = GetNameForDriver( b );
166 bool a_lowQualityName = a_name.Contains( "-Pad" );
167 bool b_lowQualityName = b_name.Contains( "-Pad" );
168
169 if( a_lowQualityName && !b_lowQualityName )
170 return false;
171 else if( b_lowQualityName && !a_lowQualityName )
172 return true;
173 else
174 return a_name < b_name;
175 } );
176 }
177 }
178
179 if( !m_driver )
180 m_driver = candidates[0];
181 }
182
183 if( strong_drivers.size() > 1 )
184 m_multiple_drivers = true;
185
186 // Drop weak drivers
187 if( m_strong_driver )
188 m_drivers = strong_drivers;
189
190 // Cache driver connection
191 if( m_driver )
192 {
197 }
198 else
199 {
200 m_driver_connection = nullptr;
201 }
202
203 if( aCheckMultipleDrivers && m_multiple_drivers )
204 {
205 // First check if all the candidates are actually the same
206 bool same = true;
207 wxString first = GetNameForDriver( candidates[0] );
208 SCH_ITEM* second_item = nullptr;
209
210 for( unsigned i = 1; i < candidates.size(); i++ )
211 {
212 if( GetNameForDriver( candidates[i] ) != first )
213 {
214 second_item = candidates[i];
215 same = false;
216 break;
217 }
218 }
219
220 if( !same )
221 {
223 m_second_driver = second_item;
224 }
225 }
226
227 return ( m_driver != nullptr );
228}
const wxString & GetNameForDriver(SCH_ITEM *aItem)
Returns the candidate net name for a driver.
void ConfigureFromLabel(const wxString &aLabel)
Configures the connection given a label.
void SetDriver(SCH_ITEM *aItem)
LABEL_FLAG_SHAPE GetShape() const override
Definition: sch_label.h:73
@ L_OUTPUT
Definition: sch_text.h:98

References GetDriverPriority(), GetNameForDriver(), SCH_LABEL_BASE::GetShape(), HIER_LABEL, INVALID, L_OUTPUT, m_driver, m_drivers, m_local_driver, m_strong_driver, PIN, POWER_PIN, and SHEET_PIN.

Referenced by CONNECTION_GRAPH::generateInvisiblePinSubGraphs().

◆ UpdateItemConnections()

void CONNECTION_SUBGRAPH::UpdateItemConnections ( )

Updates all items to match the driver connection.

Definition at line 394 of file connection_graph.cpp.

395{
397 return;
398
399 for( SCH_ITEM* item : m_items )
400 {
401 SCH_CONNECTION* item_conn = item->GetOrInitConnection( m_sheet, m_graph );
402
403 if( !item_conn )
404 continue;
405
406 if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) ||
407 ( m_driver_connection->IsNet() && item_conn->IsBus() ) )
408 {
409 continue;
410 }
411
412 if( item != m_driver )
413 {
414 item_conn->Clone( *m_driver_connection );
415 item_conn->ClearDirty();
416 }
417 }
418}
bool IsNet() const
bool IsBus() const
void Clone(const SCH_CONNECTION &aOther)
Copies connectivity information (but not parent) from another connection.

References SCH_CONNECTION::ClearDirty(), SCH_CONNECTION::Clone(), SCH_CONNECTION::IsBus(), SCH_CONNECTION::IsNet(), m_driver, m_driver_connection, m_graph, m_items, and m_sheet.

Member Data Documentation

◆ m_absorbed

bool CONNECTION_SUBGRAPH::m_absorbed

True if this subgraph has been absorbed into another. No pointers here are safe if so!

Definition at line 163 of file connection_graph.h.

Referenced by Absorb(), CONNECTION_GRAPH::buildConnectionGraph(), CONNECTION_GRAPH::FindSubgraphByName(), CONNECTION_GRAPH::GetSubgraphForItem(), CONNECTION_GRAPH::processSubGraphs(), and CONNECTION_GRAPH::propagateToNeighbors().

◆ m_absorbed_by

CONNECTION_SUBGRAPH* CONNECTION_SUBGRAPH::m_absorbed_by

If this subgraph is absorbed, points to the absorbing (and valid) subgraph.

Definition at line 166 of file connection_graph.h.

Referenced by Absorb(), CONNECTION_GRAPH::buildConnectionGraph(), CONNECTION_GRAPH::GetSubgraphForItem(), and CONNECTION_GRAPH::propagateToNeighbors().

◆ m_bus_entry

SCH_ITEM* CONNECTION_SUBGRAPH::m_bus_entry

Bus entry in graph, if any.

Definition at line 187 of file connection_graph.h.

◆ m_bus_neighbors

std::unordered_map< std::shared_ptr<SCH_CONNECTION>, std::unordered_set<CONNECTION_SUBGRAPH*> > CONNECTION_SUBGRAPH::m_bus_neighbors

If a subgraph is a bus, this map contains links between the bus members and any local sheet neighbors with the same connection name.

For example, if this subgraph is a bus D[7..0], and on the same sheet there is a net with label D7, this map will contain an entry for the D7 bus member, and the vector will contain a pointer to the D7 net subgraph.

Definition at line 209 of file connection_graph.h.

Referenced by Absorb().

◆ m_bus_parents

std::unordered_map< std::shared_ptr<SCH_CONNECTION>, std::unordered_set<CONNECTION_SUBGRAPH*> > CONNECTION_SUBGRAPH::m_bus_parents

If this is a net, this vector contains links to any same-sheet buses that contain it.

The string key is the name of the connection that forms the link (which isn't necessarily the same as the name of the connection driving this subgraph)

Definition at line 217 of file connection_graph.h.

Referenced by Absorb(), and CONNECTION_GRAPH::processSubGraphs().

◆ m_code

◆ m_dirty

◆ m_driver

◆ m_driver_connection

◆ m_driver_name_cache

std::unordered_map<SCH_ITEM*, wxString> CONNECTION_SUBGRAPH::m_driver_name_cache

A cache of escaped netnames from schematic items.

Definition at line 229 of file connection_graph.h.

Referenced by GetNameForDriver().

◆ m_drivers

◆ m_first_driver

SCH_ITEM* CONNECTION_SUBGRAPH::m_first_driver

Stores the primary driver for the multiple drivers ERC check.

This is the chosen driver before subgraphs are absorbed (so m_driver may be different)

Definition at line 235 of file connection_graph.h.

Referenced by CONNECTION_GRAPH::ercCheckMultipleDrivers().

◆ m_graph

CONNECTION_GRAPH* CONNECTION_SUBGRAPH::m_graph

Definition at line 158 of file connection_graph.h.

Referenced by UpdateItemConnections().

◆ m_hier_parent

CONNECTION_SUBGRAPH* CONNECTION_SUBGRAPH::m_hier_parent

Definition at line 226 of file connection_graph.h.

Referenced by CONNECTION_GRAPH::propagateToNeighbors().

◆ m_hier_pins

std::vector<SCH_SHEET_PIN*> CONNECTION_SUBGRAPH::m_hier_pins

Definition at line 220 of file connection_graph.h.

Referenced by AddItem(), and CONNECTION_GRAPH::propagateToNeighbors().

◆ m_hier_ports

std::vector<SCH_HIERLABEL*> CONNECTION_SUBGRAPH::m_hier_ports

Definition at line 223 of file connection_graph.h.

Referenced by AddItem(), and CONNECTION_GRAPH::propagateToNeighbors().

◆ m_items

◆ m_local_driver

bool CONNECTION_SUBGRAPH::m_local_driver

True if the driver is a local (i.e. non-global) type.

Definition at line 181 of file connection_graph.h.

Referenced by ResolveDrivers().

◆ m_multiple_drivers

bool CONNECTION_SUBGRAPH::m_multiple_drivers

True if this subgraph contains more than one driver that should be shorted together in the netlist.

For example, two labels or two power ports.

Definition at line 175 of file connection_graph.h.

Referenced by Absorb(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::processSubGraphs(), and CONNECTION_GRAPH::propagateToNeighbors().

◆ m_no_connect

◆ m_second_driver

SCH_ITEM* CONNECTION_SUBGRAPH::m_second_driver

Used for multiple drivers ERC message; stores the second possible driver (or nullptr)

Definition at line 238 of file connection_graph.h.

Referenced by CONNECTION_GRAPH::ercCheckMultipleDrivers().

◆ m_sheet

◆ m_strong_driver

bool CONNECTION_SUBGRAPH::m_strong_driver

True if the driver is "strong": a label or power object.

Definition at line 178 of file connection_graph.h.

Referenced by CONNECTION_GRAPH::propagateToNeighbors(), and ResolveDrivers().


The documentation for this class was generated from the following files: