diff --git a/eeschema/sim/sim_model_kibis.cpp b/eeschema/sim/sim_model_kibis.cpp index 212fa6c740..b90e494434 100644 --- a/eeschema/sim/sim_model_kibis.cpp +++ b/eeschema/sim/sim_model_kibis.cpp @@ -242,6 +242,7 @@ SIM_MODEL_KIBIS::SIM_MODEL_KIBIS( TYPE aType, SIM_MODEL_KIBIS& aSource, ReadDataFields( 2, &aFields ); } + void SIM_MODEL_KIBIS::CreatePins( unsigned aSymbolPinCount ) { SIM_MODEL::CreatePins( aSymbolPinCount ); @@ -280,7 +281,7 @@ void SIM_MODEL_KIBIS::SetBaseModel( const SIM_MODEL& aBaseModel ) // to IBIS device model type we have multiple types of drivers available for the same sourced // model. And we don't want to inherit the default values anyway. So we just store these models // and use the only for Spice code generation. - m_sourceModel = &aBaseModel; + m_sourceModel = dynamic_cast( &aBaseModel ); } diff --git a/eeschema/sim/sim_model_kibis.h b/eeschema/sim/sim_model_kibis.h index 835c16faaf..165150d4dc 100644 --- a/eeschema/sim/sim_model_kibis.h +++ b/eeschema/sim/sim_model_kibis.h @@ -69,19 +69,15 @@ public: std::vector> GetIbisPins() const { - return GetBaseModel() - ? dynamic_cast( GetBaseModel() )->GetIbisPins() - : m_ibisPins; - }; + return m_sourceModel ? m_sourceModel->GetIbisPins() : m_ibisPins; + } std::vector GetIbisModels() const { return m_ibisModels; }; std::string GetComponentName() const { - return GetBaseModel() - ? dynamic_cast( GetBaseModel() )->GetComponentName() - : m_componentName; - }; + return m_sourceModel ? m_sourceModel->GetComponentName() : m_componentName; + } const PARAM& GetParam( unsigned aParamIndex ) const override { return m_params.at( aParamIndex ); }; @@ -103,7 +99,7 @@ private: static std::vector makeRectWaveformParamInfos(); static std::vector makePrbsWaveformParamInfos(); - const SIM_MODEL* m_sourceModel; + const SIM_MODEL_KIBIS* m_sourceModel; std::vector m_ibisModels; std::vector> m_ibisPins; std::string m_componentName;