KiCad PCB EDA Suite
Loading...
Searching...
No Matches
conn_claims.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "conn_bus.h"
23#include "conn_islands.h"
24#include "conn_keys.h"
25#include "conn_frame.h"
26
27#include <array>
28#include <memory>
29#include <span>
30
31namespace SCH_CONNECTIVITY
32{
48
52struct CLAIM
53{
55 uint16_t depth = 0;
61 bool globalPowerParent = false;
62 bool localPowerParent = false;
63 bool outputShape = false;
64 bool hasPad = false;
65 std::shared_ptr<const BUS_SCHEMA> schema;
66 std::optional<INST_ID> portInstance;
67
69 bool Strong() const { return priority >= PRIORITY::HIER_LABEL; }
70 bool operator==( const CLAIM& aOther ) const;
71};
72
77{
79 bool operator()( const CLAIM& aLeft, const CLAIM& aRight ) const;
80};
81
83{
86 bool pinWitness = false;
87 bool invisiblePower = false;
88 std::optional<INST_ID> portInstance;
89 std::optional<CLAIM> claim;
90 std::vector<NAME_ID> netclasses;
91 bool operator==( const SOURCE_CLAIMS& ) const = default;
92};
93
95{
97 std::map<KIID, SOURCE_CLAIMS> items;
98};
99
101{
102 std::vector<NAME_ID> strongNames;
103 std::array<std::optional<KIID>, 2> pinWitnesses;
104 std::optional<KIID> noConnect;
105 uint32_t pinCount = 0;
106 bool hasSymbolPin = false;
107 bool kindConflict = false;
108 bool mixedBusShapes = false;
110 bool busNoConnect = false;
111 bool operator==( const ERC_ATOMS& ) const = default;
112};
113
115{
117 std::vector<KIID> items;
118 std::vector<CLAIM> claims;
119 std::vector<NAME_KEY> edges;
120 std::vector<NAME_ID> netclasses;
122 bool operator==( const ISLAND_RECORD& ) const = default;
123};
124
127{
128 std::span<const KIID> items;
131};
132
139 const INSTANCE_SCOPE& aScope, SESSION_KEYS& aKeys, BUS_PARSE_CACHE& aParses );
140ISLAND_RECORD BuildIslandRecord( const RECORD_GEOMETRY& aIsland, const INSTANCE_CLAIMS& aInputs,
141 const SESSION_KEYS& aKeys );
142} // namespace SCH_CONNECTIVITY
Definition kiid.h:46
Parse results for each bus text, with invalidation by alias dependency.
Definition conn_bus.h:130
Session IDs are dense handles, never a canonical ordering.
Definition conn_keys.h:146
KIID niluuid(0)
Value keys and the key session of the schematic connectivity engine.
uint32_t INST_ID
Session handle of a sheet instance KIID_PATH.
Definition conn_keys.h:41
ISLAND_RECORD BuildIslandRecord(const RECORD_GEOMETRY &aIsland, const INSTANCE_CLAIMS &aInputs, const SESSION_KEYS &aKeys)
uint32_t NAME_ID
Session handle of a name, ordered by UTF-8 value through NAME_LESS.
Definition conn_keys.h:42
KIND
The electrical type of a record or component.
Definition conn_keys.h:55
constexpr uint32_t INVALID_ID
Marks an unset handle.
Definition conn_keys.h:47
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.
Definition conn_claims.h:37
@ SHEET_PIN
Sheet pin. The name belongs to the child instance.
Definition conn_claims.h:40
@ GLOBAL_POWER_PIN
Power input pin of a global power symbol, or a hidden power input pin.
Definition conn_claims.h:45
@ LOCAL_POWER_PIN
Power input pin of a local power symbol.
Definition conn_claims.h:43
@ BUS_MEMBER
Synthetic claim of a bus member slot, set by BindBundle().
Definition conn_claims.h:44
@ HIER_LABEL
Hierarchical label. The first strong priority.
Definition conn_claims.h:41
@ NONE
The item makes no claim.
Definition conn_claims.h:38
@ PIN
Symbol pin that is not a power input. The name is "Net-(...)".
Definition conn_claims.h:39
Strict weak order on claims by value.
Definition conn_claims.h:77
const SESSION_KEYS & keys
Definition conn_claims.h:78
bool operator()(const CLAIM &aLeft, const CLAIM &aRight) const
The claim of one item for the name of its island.
Definition conn_claims.h:53
bool globalPowerParent
Pin of a global power symbol.
Definition conn_claims.h:61
bool localPowerParent
Pin of a local power symbol.
Definition conn_claims.h:62
bool operator==(const CLAIM &aOther) const
ITEM_KEY source
The claiming item, the last tie-break.
Definition conn_claims.h:60
bool Strong() const
True for a name that the user placed.
Definition conn_claims.h:69
bool hasPad
The name contains "-Pad".
Definition conn_claims.h:64
uint16_t depth
Sheet path size, or zero if unscoped.
Definition conn_claims.h:55
std::optional< INST_ID > portInstance
Sheet pin child. Members bind there, not in the parent.
Definition conn_claims.h:66
NAME_ID ncName
Name of an unconnected pin net.
Definition conn_claims.h:58
NAME_ID name
Item text without the sheet prefix.
Definition conn_claims.h:57
bool outputShape
Sheet pin with output shape.
Definition conn_claims.h:63
std::shared_ptr< const BUS_SCHEMA > schema
Parsed bus, or null for a signal.
Definition conn_claims.h:65
NAME_ID path
Sheet prefix, or the empty name if unscoped.
Definition conn_claims.h:56
NAME_ID fullName
path followed by name.
Definition conn_claims.h:59
std::array< std::optional< KIID >, 2 > pinWitnesses
The two smallest witness pin ids.
std::optional< KIID > noConnect
The smallest no-connect marker id.
bool operator==(const ERC_ATOMS &) const =default
std::vector< NAME_ID > strongNames
Sorted names of the strong claims.
std::map< KIID, SOURCE_CLAIMS > items
Definition conn_claims.h:97
The text and unit data that one sheet instance resolves for the items of its screen.
Definition conn_facts.h:348
The hierarchy position of one sheet instance.
Definition conn_frame.h:35
std::vector< NAME_ID > netclasses
std::vector< NAME_KEY > edges
bool operator==(const ISLAND_RECORD &) const =default
std::vector< CLAIM > claims
Descending by CLAIM_LESS, so front() is the island driver.
One item or pin in one sheet instance.
Definition conn_keys.h:77
Physical inputs to the island record fold.
std::span< const KIID > items
The value copy of one screen.
Definition conn_facts.h:251
std::optional< CLAIM > claim
Definition conn_claims.h:89
bool operator==(const SOURCE_CLAIMS &) const =default
std::optional< INST_ID > portInstance
Definition conn_claims.h:88
bool pinWitness
Pin whose symbol is not a power symbol.
Definition conn_claims.h:86
std::vector< NAME_ID > netclasses
Definition conn_claims.h:90
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70
@ TYPE_NOT_INIT
Definition typeinfo.h:73