KiCad PCB EDA Suite
Loading...
Searching...
No Matches
conn_components.cpp
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#include "conn_components.h"
21
22#include <wx/thread.h>
23
24namespace SCH_CONNECTIVITY
25{
26std::vector<NODE_INPUT> RecordNodes( const RECORD_STORE::RECORD_CACHE& aRecords, KIND aKind, SESSION_KEYS& aKeys )
27{
28 wxASSERT( wxThread::IsMain() );
29 std::vector<NODE_INPUT> result;
30 result.reserve( aRecords.Entries().size() );
31
32 for( const auto& [key, entry] : aRecords.Entries() )
33 {
34 if( entry->value.kind != aKind )
35 continue;
36
37 NODE_INPUT input{ aKeys.InternNode( RECORD_NODE{ key, aKind } ), entry->version, {} };
38 input.edges.reserve( entry->value.edges.size() );
39
40 for( const NAME_KEY& edge : entry->value.edges )
41 input.edges.push_back( aKeys.InternNode( edge ) );
42
43 result.push_back( std::move( input ) );
44 }
45
46 return result;
47}
48} // namespace SCH_CONNECTIVITY
const auto & Entries() const
Definition conn_cache.h:105
CACHE_TABLE< RECORD_KEY, ISLAND_RECORD, KEY_LESS > RECORD_CACHE
Session IDs are dense handles, never a canonical ordering.
Definition conn_keys.h:146
NODE_ID InternNode(NODE_KEY aKey)
Definition conn_keys.cpp:28
Value keys and the key session of the schematic connectivity engine.
KIND
The electrical type of a record or component.
Definition conn_keys.h:55
std::vector< NODE_INPUT > RecordNodes(const RECORD_STORE::RECORD_CACHE &aRecords, KIND aKind, SESSION_KEYS &aKeys)
Main-thread node interning for one record stratum.
The graph node of one name in one scope.
Definition conn_keys.h:110
The graph node of one island record.
Definition conn_keys.h:97
wxString result
Test unit parsing edge cases and error handling.