Sim Model Editor: Don't use shared_ptr
This commit is contained in:
parent
fef6eaa8ba
commit
4caa65d100
|
@ -166,9 +166,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
|
|||
|
||||
if( isIbisLoaded() && ( m_modelNameCombobox->GetSelection() >= 0 ) )
|
||||
{
|
||||
std::shared_ptr<SIM_MODEL_KIBIS> kibismodel =
|
||||
std::dynamic_pointer_cast<SIM_MODEL_KIBIS>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ) );
|
||||
SIM_MODEL_KIBIS* kibismodel = dynamic_cast<SIM_MODEL_KIBIS*>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() );
|
||||
|
||||
if( kibismodel )
|
||||
{
|
||||
|
@ -277,8 +276,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
|
|||
|
||||
if( isIbisLoaded() )
|
||||
{
|
||||
std::shared_ptr<SIM_MODEL_KIBIS> kibismodel = std::dynamic_pointer_cast<SIM_MODEL_KIBIS>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ) );
|
||||
SIM_MODEL_KIBIS* kibismodel = dynamic_cast<SIM_MODEL_KIBIS*>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() );
|
||||
|
||||
if( kibismodel )
|
||||
{
|
||||
|
@ -882,22 +881,15 @@ int DIALOG_SIM_MODEL<T>::findSymbolPinRow( const wxString& aSymbolPinNumber ) co
|
|||
|
||||
template <typename T>
|
||||
SIM_MODEL& DIALOG_SIM_MODEL<T>::curModel() const
|
||||
{
|
||||
return *curModelSharedPtr();
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<SIM_MODEL> DIALOG_SIM_MODEL<T>::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<int>( m_curModelType ) );
|
||||
return *m_models.at( static_cast<int>( m_curModelType ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1155,13 +1147,11 @@ void DIALOG_SIM_MODEL<T>::onTypeChoice( wxCommandEvent& aEvent )
|
|||
|| type == SIM_MODEL::TYPE::KIBIS_DRIVER_RECT
|
||||
|| type == SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS ) )
|
||||
{
|
||||
std::shared_ptr<SIM_MODEL_KIBIS> kibismodel =
|
||||
std::dynamic_pointer_cast<SIM_MODEL_KIBIS>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ) );
|
||||
SIM_MODEL_KIBIS* kibismodel = dynamic_cast<SIM_MODEL_KIBIS*>(
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ).get() );
|
||||
|
||||
m_libraryModels.at( m_modelNameCombobox->GetSelection() ) =
|
||||
std::shared_ptr<SIM_MODEL>( dynamic_cast<SIM_MODEL*>(
|
||||
new SIM_MODEL_KIBIS( type, *kibismodel, m_fields ) ) );
|
||||
std::make_unique<SIM_MODEL_KIBIS>( type, *kibismodel, m_fields );
|
||||
}
|
||||
|
||||
m_curModelType = type;
|
||||
|
|
|
@ -107,7 +107,6 @@ private:
|
|||
int findSymbolPinRow( const wxString& aSymbolPinNumber ) const;
|
||||
|
||||
SIM_MODEL& curModel() const;
|
||||
std::shared_ptr<SIM_MODEL> curModelSharedPtr() const;
|
||||
|
||||
wxString getSymbolPinString( int aSymbolPinNumber ) const;
|
||||
wxString getModelPinString( int aModelPinIndex ) const;
|
||||
|
@ -142,13 +141,13 @@ private:
|
|||
SCH_SYMBOL& m_symbol;
|
||||
std::vector<T>& m_fields;
|
||||
|
||||
std::vector<std::shared_ptr<SIM_MODEL>> m_models;
|
||||
std::vector<std::unique_ptr<SIM_MODEL>> m_models;
|
||||
std::vector<LIB_PIN*> m_sortedSymbolPins;
|
||||
std::map<SIM_MODEL::DEVICE_TYPE_, SIM_MODEL::TYPE> m_curModelTypeOfDeviceType;
|
||||
SIM_MODEL::TYPE m_curModelType = SIM_MODEL::TYPE::NONE;
|
||||
|
||||
std::shared_ptr<SIM_LIBRARY> m_library;
|
||||
std::vector<std::shared_ptr<SIM_MODEL>> m_libraryModels;
|
||||
std::vector<std::unique_ptr<SIM_MODEL>> m_libraryModels;
|
||||
const SIM_MODEL* m_prevModel;
|
||||
|
||||
MODEL_NAME_VALIDATOR m_modelNameValidator;
|
||||
|
|
Loading…
Reference in New Issue