diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 78751f811d..d39c85563b 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -166,9 +166,8 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() if( isIbisLoaded() && ( m_modelNameCombobox->GetSelection() >= 0 ) ) { - std::shared_ptr kibismodel = - std::dynamic_pointer_cast( - m_libraryModels.at( m_modelNameCombobox->GetSelection() ) ); + SIM_MODEL_KIBIS* kibismodel = dynamic_cast( + m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() ); if( kibismodel ) { @@ -277,8 +276,8 @@ bool DIALOG_SIM_MODEL::TransferDataFromWindow() if( isIbisLoaded() ) { - std::shared_ptr kibismodel = std::dynamic_pointer_cast( - m_libraryModels.at( m_modelNameCombobox->GetSelection() ) ); + SIM_MODEL_KIBIS* kibismodel = dynamic_cast( + m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() ); if( kibismodel ) { @@ -882,22 +881,15 @@ int DIALOG_SIM_MODEL::findSymbolPinRow( const wxString& aSymbolPinNumber ) co template SIM_MODEL& DIALOG_SIM_MODEL::curModel() const -{ - return *curModelSharedPtr(); -} - - -template -std::shared_ptr DIALOG_SIM_MODEL::curModelSharedPtr() const { if( m_useLibraryModelRadioButton->GetValue() && m_modelNameCombobox->GetSelection() != wxNOT_FOUND ) { - return m_libraryModels.at( m_modelNameCombobox->GetSelection() ); + return *m_libraryModels.at( m_modelNameCombobox->GetSelection() ); } else { - return m_models.at( static_cast( m_curModelType ) ); + return *m_models.at( static_cast( m_curModelType ) ); } } @@ -1155,13 +1147,11 @@ void DIALOG_SIM_MODEL::onTypeChoice( wxCommandEvent& aEvent ) || type == SIM_MODEL::TYPE::KIBIS_DRIVER_RECT || type == SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS ) ) { - std::shared_ptr kibismodel = - std::dynamic_pointer_cast( - m_libraryModels.at( m_modelNameCombobox->GetSelection() ) ); + SIM_MODEL_KIBIS* kibismodel = dynamic_cast( + m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() ); m_libraryModels.at( m_modelNameCombobox->GetSelection() ) = - std::shared_ptr( dynamic_cast( - new SIM_MODEL_KIBIS( type, *kibismodel, m_fields ) ) ); + std::make_unique( type, *kibismodel, m_fields ); } m_curModelType = type; diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index 7f04f3dc8c..7025c07ef8 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -107,7 +107,6 @@ private: int findSymbolPinRow( const wxString& aSymbolPinNumber ) const; SIM_MODEL& curModel() const; - std::shared_ptr curModelSharedPtr() const; wxString getSymbolPinString( int aSymbolPinNumber ) const; wxString getModelPinString( int aModelPinIndex ) const; @@ -142,13 +141,13 @@ private: SCH_SYMBOL& m_symbol; std::vector& m_fields; - std::vector> m_models; + std::vector> m_models; std::vector m_sortedSymbolPins; std::map m_curModelTypeOfDeviceType; SIM_MODEL::TYPE m_curModelType = SIM_MODEL::TYPE::NONE; std::shared_ptr m_library; - std::vector> m_libraryModels; + std::vector> m_libraryModels; const SIM_MODEL* m_prevModel; MODEL_NAME_VALIDATOR m_modelNameValidator;