29 void SortNames( std::vector<NAME_ID>& aNames,
const SESSION_KEYS& aKeys )
31 std::ranges::sort( aNames,
NAME_LESS{ &aKeys } );
32 aNames.erase( std::ranges::unique( aNames ).begin(), aNames.end() );
60 const auto rank = [](
const CLAIM& aClaim )
62 return std::tuple( aClaim.priority, -
static_cast<int>( aClaim.depth ), aClaim.globalPowerParent,
63 aClaim.localPowerParent, aClaim.outputShape, !aClaim.hasPad );
66 if(
const auto leftRank = rank( aLeft ), rightRank = rank( aRight ); leftRank != rightRank )
67 return leftRank < rightRank;
80 std::map<KIID, const ITEM_TEXT_FACT*>
text;
83 text.emplace( item.
id, &item );
87 const auto found =
text.find(
id );
89 if(
pin && found ==
text.end() )
104 && !
pin->globalPowerParent && !
pin->localPowerParent;
115 if( found ==
text.end() )
129 const bool unscoped =
139 claim.
hasPad = item.
name.Contains( wxS(
"-Pad" ) );
145 input.
claim = std::move( claim );
153 prepare( fact, &
pin,
pin.id );
157 prepare( fact,
nullptr, fact.
id );
163 std::vector<NAME_ID> classes;
170 if(
auto found =
result.items.find(
id ); found !=
result.items.end() )
171 found->second.netclasses.insert( found->second.netclasses.end(), classes.begin(), classes.end() );
175 for(
auto& [
id, input] :
result.items )
176 SortNames( input.netclasses, aKeys );
186 std::set<KIID> pinGroups;
187 std::vector<KIID> witnesses;
188 bool hasVector =
false;
189 bool hasGroup =
false;
190 bool hasSignalLabel =
false;
191 bool hasBusLabel =
false;
202 hasBusLabel |= bool( input.
claim->schema );
203 hasSignalLabel |= !input.
claim->schema;
208 if( input.
claim->Strong() )
209 result.atoms.strongNames.push_back( input.
claim->name );
211 if( input.
claim->schema )
220 result.atoms.hasSymbolPin =
true;
226 witnesses.push_back(
id );
231 if( !
result.atoms.noConnect ||
id < *
result.atoms.noConnect )
232 result.atoms.noConnect = id;
244 || ( ( aIsland.
hasWire || hasSignalLabel ) && hasBusLabel )
246 result.atoms.mixedBusShapes = hasVector && hasGroup;
248 result.atoms.pinCount =
static_cast<uint32_t
>( pinGroups.size() );
249 std::ranges::sort( witnesses, std::less<KIID>() );
250 std::copy_n( witnesses.begin(), std::min( witnesses.size(),
result.atoms.pinWitnesses.size() ),
251 result.atoms.pinWitnesses.begin() );
260 result.edges.push_back( { SCOPE::GLOBAL, 0, claim.
name } );
270 if(
const auto& instance = aInputs.
items.at( claim.
source.
item ).portInstance )
271 result.edges.push_back( { SCOPE::PORT, *instance, claim.
name,
result.kind } );
280 SortNames(
result.atoms.strongNames, aKeys );
282 if(
result.claims.empty() )
283 result.netclasses.clear();
285 SortNames(
result.netclasses, aKeys );
Parse results for each bus text, with invalidation by alias dependency.
const ENTRY & Parse(const wxString &aText)
Return the cached entry, and parse again if the entry is missing or dirty.
Session IDs are dense handles, never a canonical ordering.
const wxString & Name(NAME_ID aId) const
NAME_ID InternName(const wxString &aText)
Value keys and the key session of the schematic connectivity engine.
ISLAND_RECORD BuildIslandRecord(const RECORD_GEOMETRY &aIsland, const INSTANCE_CLAIMS &aInputs, const SESSION_KEYS &aKeys)
INSTANCE_CLAIMS PrepareInstanceClaims(const SCREEN_FACTS &aFacts, const INSTANCE_FACTS &aText, const INSTANCE_SCOPE &aScope, SESSION_KEYS &aKeys, BUS_PARSE_CACHE &aParses)
Main-thread interning and parse preparation, followed by a pure per-island fold.
PRIORITY
Driver priority of a claim, from low to high.
@ SHEET_PIN
Sheet pin. The name belongs to the child instance.
@ GLOBAL_POWER_PIN
Power input pin of a global power symbol, or a hidden power input pin.
@ LOCAL_POWER_PIN
Power input pin of a local power symbol.
@ LOCAL_LABEL
Local label.
@ HIER_LABEL
Hierarchical label. The first strong priority.
@ NONE
The item makes no claim.
@ PIN
Symbol pin that is not a power input. The name is "Net-(...)".
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ GROUP
A list such as I2C{SDA SCL}. Members align by name with another group.
@ VECTOR
A range such as D[0..3]. Members align by ordinal.
Strict weak order on claims by value.
const SESSION_KEYS & keys
bool operator()(const CLAIM &aLeft, const CLAIM &aRight) const
The claim of one item for the name of its island.
bool globalPowerParent
Pin of a global power symbol.
bool localPowerParent
Pin of a local power symbol.
bool operator==(const CLAIM &aOther) const
ITEM_KEY source
The claiming item, the last tie-break.
bool hasPad
The name contains "-Pad".
uint16_t depth
Sheet path size, or zero if unscoped.
std::optional< INST_ID > portInstance
Sheet pin child. Members bind there, not in the parent.
NAME_ID ncName
Name of an unconnected pin net.
NAME_ID name
Item text without the sheet prefix.
bool outputShape
Sheet pin with output shape.
std::shared_ptr< const BUS_SCHEMA > schema
Parsed bus, or null for a signal.
NAME_ID path
Sheet prefix, or the empty name if unscoped.
NAME_ID fullName
path followed by name.
std::map< KIID, SOURCE_CLAIMS > items
The text and unit data that one sheet instance resolves for the items of its screen.
std::vector< INSTANCE_RULE_AREA_FACT > ruleAreas
std::vector< ITEM_TEXT_FACT > items
std::vector< KIID > containedItems
std::vector< wxString > netclasses
The hierarchy position of one sheet instance.
std::map< KIID, INST_ID > children
The child instance of each SCH_SHEET KIID on this screen.
wxString path
The human-readable sheet path, which prefixes scoped names.
INST_ID instance
The session handle of the instance KIID_PATH.
uint16_t depth
The number of sheets in the path, with the root sheet as one.
A value copy of one connectable item, or of one group of pins that share a number and a position.
KIID id
The item KIID, or the smallest member KIID of a pin group.
std::vector< PIN_FACT > pins
KIID owner
The parent symbol or sheet, or niluuid.
KIID item
The item or pin KIID.
std::vector< wxString > netclasses
Orders keys by value through SESSION_KEYS::Less().
Orders name handles by UTF-8 value.
Physical inputs to the island record fold.
std::span< const KIID > items
The value copy of one screen.
std::vector< ITEM_FACT > items
std::optional< CLAIM > claim
std::optional< INST_ID > portInstance
bool pinWitness
Pin whose symbol is not a power symbol.
std::vector< NAME_ID > netclasses
wxString result
Test unit parsing edge cases and error handling.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.