Remove a bunch of 'auto'.

This commit is contained in:
Jeff Young 2022-12-05 23:21:18 +00:00
parent d435ba6485
commit f8e0a272c0
2 changed files with 33 additions and 35 deletions

View File

@ -73,11 +73,11 @@ bool DIALOG_SIGNAL_LIST::TransferDataToWindow()
if( simType == ST_TRANSIENT || simType == ST_DC ) if( simType == ST_TRANSIENT || simType == ST_DC )
{ {
for( const auto& item : m_circuitModel->GetItems() ) for( const SPICE_ITEM& item : m_circuitModel->GetItems() )
{ {
// Add all possible currents for the primitive. // Add all possible currents for the primitive.
for( const auto& currentName : item.model->SpiceGenerator().CurrentNames( item ) ) for( const std::string& name : item.model->SpiceGenerator().CurrentNames( item ) )
m_signals->Append( currentName ); m_signals->Append( name );
} }
} }
} }

View File

@ -759,8 +759,8 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType,
if( xAxisName.IsEmpty() ) if( xAxisName.IsEmpty() )
return false; return false;
auto data_x = m_simulator->GetMagPlot( (const char*) xAxisName.c_str() ); std::vector<double> data_x = m_simulator->GetMagPlot( (const char*) xAxisName.c_str() );
unsigned int size = data_x.size(); unsigned int size = data_x.size();
if( data_x.empty() ) if( data_x.empty() )
return false; return false;
@ -868,11 +868,11 @@ void SIM_PLOT_FRAME::updateSignalList()
else else
m_signalsIconColorList->RemoveAll(); m_signalsIconColorList->RemoveAll();
for( const auto& trace : GetCurrentPlot()->GetTraces() ) for( const auto& [name, trace] : GetCurrentPlot()->GetTraces() )
{ {
wxBitmap bitmap( isize, isize ); wxBitmap bitmap( isize, isize );
bmDC.SelectObject( bitmap ); bmDC.SelectObject( bitmap );
wxColour tcolor = trace.second->GetPen().GetColour(); wxColour tcolor = trace->GetPen().GetColour();
wxColour bgColor = m_signals->wxWindow::GetBackgroundColour(); wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
bmDC.SetPen( wxPen( bgColor ) ); bmDC.SetPen( wxPen( bgColor ) );
@ -903,9 +903,9 @@ void SIM_PLOT_FRAME::updateSignalList()
// calculated from the trace name index // calculated from the trace name index
int imgidx = 0; int imgidx = 0;
for( const auto& trace : plotPanel->GetTraces() ) for( const auto& [name, trace] : plotPanel->GetTraces() )
{ {
m_signals->InsertItem( imgidx, trace.first, imgidx ); m_signals->InsertItem( imgidx, name, imgidx );
imgidx++; imgidx++;
} }
} }
@ -913,7 +913,7 @@ void SIM_PLOT_FRAME::updateSignalList()
void SIM_PLOT_FRAME::updateTuners() void SIM_PLOT_FRAME::updateTuners()
{ {
const auto& spiceItems = m_circuitModel->GetItems(); const std::list<SPICE_ITEM>& spiceItems = m_circuitModel->GetItems();
for( auto it = m_tuners.begin(); it != m_tuners.end(); /* iteration inside the loop */ ) for( auto it = m_tuners.begin(); it != m_tuners.end(); /* iteration inside the loop */ )
{ {
@ -921,9 +921,10 @@ void SIM_PLOT_FRAME::updateTuners()
if( std::find_if( spiceItems.begin(), spiceItems.end(), if( std::find_if( spiceItems.begin(), spiceItems.end(),
[&]( const SPICE_ITEM& item ) [&]( const SPICE_ITEM& item )
{ {
return item.refName == ref; return item.refName == ref;
}) == spiceItems.end() ) }
) == spiceItems.end() )
{ {
// The component does not exist anymore, remove the associated tuner // The component does not exist anymore, remove the associated tuner
TUNER_SLIDER* tuner = *it; TUNER_SLIDER* tuner = *it;
@ -940,7 +941,7 @@ void SIM_PLOT_FRAME::updateTuners()
void SIM_PLOT_FRAME::applyTuners() void SIM_PLOT_FRAME::applyTuners()
{ {
for( auto& tuner : m_tuners ) for( const TUNER_SLIDER* tuner : m_tuners )
m_simulator->Command( tuner->GetTunerCommand() ); m_simulator->Command( tuner->GetTunerCommand() );
} }
@ -1095,11 +1096,11 @@ bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
file.AddLine( wxString::Format( wxT( "%llu" ), plotPanel->GetTraces().size() ) ); file.AddLine( wxString::Format( wxT( "%llu" ), plotPanel->GetTraces().size() ) );
for( const auto& trace : plotPanel->GetTraces() ) for( const auto& [name, trace] : plotPanel->GetTraces() )
{ {
file.AddLine( wxString::Format( wxT( "%d" ), trace.second->GetType() ) ); file.AddLine( wxString::Format( wxT( "%d" ), trace->GetType() ) );
file.AddLine( trace.second->GetName() ); file.AddLine( trace->GetName() );
file.AddLine( trace.second->GetParam() ); file.AddLine( trace->GetParam() );
} }
} }
@ -1258,11 +1259,8 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event )
wxString xAxisName( m_simulator->GetXAxis( simType ) ); wxString xAxisName( m_simulator->GetXAxis( simType ) );
out.Write( wxString::Format( wxT( "%s%c" ), xAxisName, SEPARATOR ) ); out.Write( wxString::Format( wxT( "%s%c" ), xAxisName, SEPARATOR ) );
for( const auto& trace : traces ) for( const auto& [name, trace] : traces )
{ out.Write( wxString::Format( wxT( "%s%c" ), name, SEPARATOR ) );
wxString yAxisName = trace.first;
out.Write( wxString::Format( wxT( "%s%c" ), yAxisName, SEPARATOR ) );
}
out.Write( wxS( "\r\n" ) ); out.Write( wxS( "\r\n" ) );
@ -1272,9 +1270,9 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event )
double xAxisValue = traces.begin()->second->GetDataX().at( curRow ); double xAxisValue = traces.begin()->second->GetDataX().at( curRow );
out.Write( wxString::Format( wxT( "%g%c" ), xAxisValue, SEPARATOR ) ); out.Write( wxString::Format( wxT( "%g%c" ), xAxisValue, SEPARATOR ) );
for( const auto& trace : traces ) for( const auto& [name, trace] : traces )
{ {
double yAxisValue = trace.second->GetDataY().at( curRow ); double yAxisValue = trace->GetDataY().at( curRow );
out.Write( wxString::Format( wxT( "%g%c" ), yAxisValue, SEPARATOR ) ); out.Write( wxString::Format( wxT( "%g%c" ), yAxisValue, SEPARATOR ) );
} }
@ -1731,16 +1729,16 @@ void SIM_PLOT_FRAME::onCursorUpdate( wxCommandEvent& event )
// Update cursor values // Update cursor values
int itemidx = 0; int itemidx = 0;
for( const auto& trace : plotPanel->GetTraces() ) for( const auto& [name, trace] : plotPanel->GetTraces() )
{ {
if( CURSOR* cursor = trace.second->GetCursor() ) if( CURSOR* cursor = trace->GetCursor() )
{ {
// Find the right icon color in list. // Find the right icon color in list.
// It is the icon used in m_signals list for the same trace // It is the icon used in m_signals list for the same trace
long iconColor = m_signals->FindItem( -1, trace.first ); long iconColor = m_signals->FindItem( -1, name );
const wxRealPoint coords = cursor->GetCoords(); const wxRealPoint coords = cursor->GetCoords();
long idx = m_cursors->InsertItem( itemidx++, trace.first, iconColor ); long idx = m_cursors->InsertItem( itemidx++, name, iconColor );
m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() ); m_cursors->SetItem( idx, X_COL, SPICE_VALUE( coords.x ).ToSpiceString() );
m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() ); m_cursors->SetItem( idx, Y_COL, SPICE_VALUE( coords.y ).ToSpiceString() );
} }
@ -1804,16 +1802,16 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
std::vector<struct TRACE_DESC> traceInfo; std::vector<struct TRACE_DESC> traceInfo;
// Get information about all the traces on the plot, remove and add again // Get information about all the traces on the plot, remove and add again
for( auto& trace : plotPanel->GetTraces() ) for( auto& [name, trace] : plotPanel->GetTraces() )
{ {
struct TRACE_DESC placeholder; struct TRACE_DESC placeholder;
placeholder.m_name = trace.second->GetName(); placeholder.m_name = trace->GetName();
placeholder.m_type = trace.second->GetType(); placeholder.m_type = trace->GetType();
traceInfo.push_back( placeholder ); traceInfo.push_back( placeholder );
} }
for( auto& trace : traceInfo ) for( const struct TRACE_DESC& trace : traceInfo )
{ {
if( !updatePlot( trace.m_name, trace.m_type, plotPanel ) ) if( !updatePlot( trace.m_name, trace.m_type, plotPanel ) )
removePlot( trace.m_name ); removePlot( trace.m_name );
@ -1828,7 +1826,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) ); m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) );
m_simConsole->SetInsertionPointEnd(); m_simConsole->SetInsertionPointEnd();
for( const auto& vec : m_simulator->AllPlots() ) for( const std::string& vec : m_simulator->AllPlots() )
{ {
std::vector<double> val_list = m_simulator->GetRealPlot( vec, 1 ); std::vector<double> val_list = m_simulator->GetRealPlot( vec, 1 );