30#include <unordered_map>
47constexpr uint32_t
INVALID_ID = std::numeric_limits<uint32_t>::max();
136using NODE_KEY = std::variant<RECORD_NODE, NAME_KEY, SLOT_KEY>;
155 std::optional<NAME_ID>
FindName(
const wxString& aText )
const
157 return m_names.Find( { {}, aText.utf8_string() } );
168 return m_names.Value( aLeft ).utf8 <
m_names.Value( aRight ).utf8;
179 template <
typename VALUE,
typename MAP = std::map<VALUE, u
int32_t>>
190 auto [it, inserted] =
m_ids.try_emplace( aValue,
static_cast<uint32_t
>(
m_values.size() ) );
198 throw std::overflow_error(
"Connectivity intern IDs exhausted" );
211 std::optional<uint32_t>
Find(
const VALUE& aValue )
const
213 const auto found =
m_ids.find( aValue );
214 return found ==
m_ids.end() ? std::nullopt : std::optional<uint32_t>( found->second );
258 template <
typename KEY>
261 return keys.Less( aLeft, aRight );
std::vector< const VALUE * > m_values
uint32_t Intern(const VALUE &aValue)
INTERN_TABLE(const INTERN_TABLE &)=delete
const VALUE & Value(uint32_t aId) const
INTERN_TABLE & operator=(const INTERN_TABLE &)=delete
std::optional< uint32_t > Find(const VALUE &aValue) const
Session IDs are dense handles, never a canonical ordering.
std::optional< NAME_ID > FindName(const wxString &aText) const
const NODE_KEY & Node(NODE_ID aId) const
SESSION_KEYS & operator=(const SESSION_KEYS &)=delete
const wxString & Name(NAME_ID aId) const
SESSION_KEYS(const SESSION_KEYS &)=delete
INTERN_TABLE< KIID_PATH > m_instances
const KIID_PATH & Instance(INST_ID aId) const
INST_ID InternInstance(const KIID_PATH &aPath)
INTERN_TABLE< NODE_KEY, std::unordered_map< NODE_KEY, uint32_t, NODE_HASH > > m_nodes
NAME_ID InternName(const wxString &aText)
std::optional< INST_ID > FindInstance(const KIID_PATH &aPath) const
bool Less(const ITEM_KEY &aLeft, const ITEM_KEY &aRight) const
INTERN_TABLE< INTERNED_NAME > m_names
bool NameLess(NAME_ID aLeft, NAME_ID aRight) const
NODE_ID InternNode(NODE_KEY aKey)
Value keys and the key session of the schematic connectivity engine.
std::variant< RECORD_NODE, NAME_KEY, SLOT_KEY > NODE_KEY
Any node of the union-find graph.
SCOPE
The namespace in which a NAME_KEY joins records.
@ SHEET
Joins names in one instance only.
uint32_t INST_ID
Session handle of a sheet instance KIID_PATH.
uint32_t NAME_ID
Session handle of a name, ordered by UTF-8 value through NAME_LESS.
uint64_t SCREEN_ID
Process-local SCH_SCREEN::ConnectivityId(), never a file UUID.
uint32_t NODE_ID
Session handle of a NODE_KEY graph node.
KIND
The electrical type of a record or component.
constexpr uint32_t INVALID_ID
Marks an unset handle.
One item or pin in one sheet instance.
KIID item
The item or pin KIID.
INST_ID inst
The sheet instance that shows the item.
bool operator==(const ITEM_KEY &) const =default
Orders keys by value through SESSION_KEYS::Less().
bool operator()(const KEY &aLeft, const KEY &aRight) const
const SESSION_KEYS & keys
The graph node of one name in one scope.
KIND kind
The record kind. Only PORT compares it.
INST_ID inst
The sheet instance, or the child instance of a sheet pin for PORT.
NAME_ID text
The resolved name.
bool operator==(const NAME_KEY &aOther) const
Orders name handles by UTF-8 value.
const SESSION_KEYS * keys
bool operator()(NAME_ID aLeft, NAME_ID aRight) const
One island in one sheet instance.
INST_ID inst
The sheet instance of the record.
bool operator==(const RECORD_KEY &) const =default
KIID anchor
ISLAND::anchor, the smallest item KIID in the island.
The graph node of one island record.
KIND kind
The kind of the record, which selects its stratum.
bool operator==(const RECORD_NODE &) const =default
bool operator<(const INTERNED_NAME &aOther) const
size_t operator()(const NODE_KEY &aKey) const
One member position of a bus.
bool operator==(const SLOT_KEY &) const =default
ITEM_KEY bundleDriver
The source item of the claim that defines the leaf order.
uint32_t leaf
The index into BUS_SCHEMA::leaves of that claim.
@ VALUE
Field Value of part, i.e. "3.3K".