Move bus aliases to std::set.
This is mostly to output the aliases sorted (for ease of VCS integration), but also because a btree will be faster than hashing on a small dataset. Fixes https://gitlab.com/kicad/code/kicad/issues/11890
This commit is contained in:
parent
0df1786456
commit
536561f7b3
|
@ -784,7 +784,7 @@ void CONNECTION_GRAPH::buildItemSubGraphs()
|
|||
|
||||
for( unsigned i = 0; i < all_sheets.size(); i++ )
|
||||
{
|
||||
for( const auto& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
}
|
||||
|
||||
|
@ -1410,7 +1410,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
|
|||
|
||||
for( unsigned i = 0; i < all_sheets.size(); i++ )
|
||||
{
|
||||
for( const auto& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : all_sheets[i].LastScreen()->GetBusAliases() )
|
||||
m_bus_alias_cache[ alias->GetName() ] = alias;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
|||
existingLabels.insert( UnescapeString( label->GetText() ) );
|
||||
}
|
||||
|
||||
std::unordered_set<std::shared_ptr<BUS_ALIAS>> sheetAliases = screen->GetBusAliases();
|
||||
std::set<std::shared_ptr<BUS_ALIAS>> sheetAliases = screen->GetBusAliases();
|
||||
busAliases.insert( busAliases.end(), sheetAliases.begin(), sheetAliases.end() );
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ int ERC_TESTER::TestConflictingBusAliases()
|
|||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||
{
|
||||
std::unordered_set< std::shared_ptr<BUS_ALIAS> > screen_aliases = screen->GetBusAliases();
|
||||
const std::set< std::shared_ptr<BUS_ALIAS> > screen_aliases = screen->GetBusAliases();
|
||||
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen_aliases )
|
||||
{
|
||||
|
|
|
@ -368,10 +368,8 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
|
||||
m_out->Print( 1, ")\n\n" );
|
||||
|
||||
for( const auto& alias : screen->GetBusAliases() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
|
||||
saveBusAlias( alias, 1 );
|
||||
}
|
||||
|
||||
// Enforce item ordering
|
||||
auto cmp =
|
||||
|
|
|
@ -1454,10 +1454,8 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
m_out->Print( 0, "Comment9 %s\n", EscapedUTF8( tb.GetComment( 8 ) ).c_str() );
|
||||
m_out->Print( 0, "$EndDescr\n" );
|
||||
|
||||
for( const auto& alias : screen->GetBusAliases() )
|
||||
{
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen->GetBusAliases() )
|
||||
saveBusAlias( alias );
|
||||
}
|
||||
|
||||
// Enforce item ordering
|
||||
auto cmp = []( const SCH_ITEM* a, const SCH_ITEM* b ) { return *a < *b; };
|
||||
|
|
|
@ -480,7 +480,7 @@ public:
|
|||
/**
|
||||
* Return a list of bus aliases defined in this screen
|
||||
*/
|
||||
std::unordered_set< std::shared_ptr<BUS_ALIAS> > GetBusAliases() const
|
||||
std::set< std::shared_ptr<BUS_ALIAS> > GetBusAliases() const
|
||||
{
|
||||
return m_aliases;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ private:
|
|||
bool m_fileExists;
|
||||
|
||||
/// List of bus aliases stored in this screen.
|
||||
std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
||||
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
||||
|
||||
/// Library symbols required for this schematic.
|
||||
std::map<wxString, LIB_SYMBOL*> m_libSymbols;
|
||||
|
|
|
@ -224,9 +224,9 @@ std::vector<SCH_MARKER*> SCHEMATIC::ResolveERCExclusions()
|
|||
|
||||
std::shared_ptr<BUS_ALIAS> SCHEMATIC::GetBusAlias( const wxString& aLabel ) const
|
||||
{
|
||||
for( const auto& sheet : GetSheets() )
|
||||
for( const SCH_SHEET_PATH& sheet : GetSheets() )
|
||||
{
|
||||
for( const auto& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : sheet.LastScreen()->GetBusAliases() )
|
||||
{
|
||||
if( alias->GetName() == aLabel )
|
||||
return alias;
|
||||
|
|
Loading…
Reference in New Issue