Add some missing deep comparisions for BOARD_STACKUP

This commit is contained in:
Jon Evans 2024-01-25 09:08:10 -05:00
parent fec57459f3
commit a377fa4201
2 changed files with 49 additions and 1 deletions

View File

@ -29,6 +29,19 @@
#include "stackup_predefined_prms.h"
bool DIELECTRIC_PRMS::operator==( const DIELECTRIC_PRMS& aOther ) const
{
if( m_Material != aOther.m_Material ) return false;
if( m_Thickness != aOther.m_Thickness ) return false;
if( m_ThicknessLocked != aOther.m_ThicknessLocked ) return false;
if( m_EpsilonR != aOther.m_EpsilonR ) return false;
if( m_LossTangent != aOther.m_LossTangent ) return false;
if( m_Color != aOther.m_Color ) return false;
return true;
}
BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType )
{
DIELECTRIC_PRMS item_prms;
@ -91,6 +104,29 @@ BOARD_STACKUP_ITEM::BOARD_STACKUP_ITEM( const BOARD_STACKUP_ITEM& aOther )
}
bool BOARD_STACKUP_ITEM::operator==( const BOARD_STACKUP_ITEM& aOther ) const
{
if( m_Type != aOther.m_Type ) return false;
if( m_LayerName != aOther.m_LayerName ) return false;
if( m_TypeName != aOther.m_TypeName ) return false;
if( m_LayerId != aOther.m_LayerId ) return false;
if( m_DielectricLayerId != aOther.m_DielectricLayerId ) return false;
if( m_enabled != aOther.m_enabled ) return false;
if( !std::equal( std::begin( m_DielectricPrmsList ), std::end( m_DielectricPrmsList ),
std::begin( aOther.m_DielectricPrmsList ),
[]( const DIELECTRIC_PRMS& aA, const DIELECTRIC_PRMS& aB )
{
return aA == aB;
} ) )
{
return false;
}
return true;
}
void BOARD_STACKUP_ITEM::AddDielectricPrms( int aDielectricPrmsIdx )
{
// add a DIELECTRIC_PRMS item to m_DielectricPrmsList
@ -369,8 +405,14 @@ bool BOARD_STACKUP::operator==( const BOARD_STACKUP& aOther ) const
if( m_EdgePlating != aOther.m_EdgePlating ) return false;
if( m_FinishType != aOther.m_FinishType ) return false;
if( !std::equal( std::begin( m_list ), std::end( m_list ), std::begin( aOther.m_list ) ) )
if( !std::equal( std::begin( m_list ), std::end( m_list ), std::begin( aOther.m_list ),
[]( const BOARD_STACKUP_ITEM* aA, const BOARD_STACKUP_ITEM* aB )
{
return *aA == *aB;
} ) )
{
return false;
}
return true;
}

View File

@ -69,6 +69,9 @@ public:
m_EpsilonR( 1.0 ), m_LossTangent( 0.0 )
{}
bool operator==( const DIELECTRIC_PRMS& aOther ) const;
bool operator!=( const DIELECTRIC_PRMS& aOther ) const { return !operator==( aOther ); }
private:
friend class BOARD_STACKUP_ITEM;
@ -93,6 +96,9 @@ public:
BOARD_STACKUP_ITEM( BOARD_STACKUP_ITEM_TYPE aType );
BOARD_STACKUP_ITEM( const BOARD_STACKUP_ITEM& aOther );
bool operator==( const BOARD_STACKUP_ITEM& aOther ) const;
bool operator!=( const BOARD_STACKUP_ITEM& aOther ) const { return !operator==( aOther ); }
/**
* Add (insert) a DIELECTRIC_PRMS item to m_DielectricPrmsList
* all values are set to default