Add proper comparison operators for BOARD_DESIGN_SETTINGS and children
BOARD::operator== was just comparing pointers
This commit is contained in:
parent
81dbb12054
commit
b8aef58561
|
@ -314,6 +314,31 @@ NET_SETTINGS::~NET_SETTINGS()
|
|||
}
|
||||
|
||||
|
||||
bool NET_SETTINGS::operator==( const NET_SETTINGS& aOther ) const
|
||||
{
|
||||
if( !std::equal( std::begin( m_NetClasses ), std::end( m_NetClasses ),
|
||||
std::begin( aOther.m_NetClasses ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_NetClassPatternAssignments ),
|
||||
std::end( m_NetClassPatternAssignments ),
|
||||
std::begin( aOther.m_NetClassPatternAssignments ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_NetClassLabelAssignments ),
|
||||
std::end( m_NetClassLabelAssignments ),
|
||||
std::begin( aOther.m_NetClassLabelAssignments ) ) )
|
||||
return false;
|
||||
|
||||
|
||||
if( !std::equal( std::begin( m_NetColorAssignments ), std::end( m_NetColorAssignments ),
|
||||
std::begin( aOther.m_NetColorAssignments ) ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool NET_SETTINGS::migrateSchema0to1()
|
||||
{
|
||||
if( m_internals->contains( "classes" ) && m_internals->At( "classes" ).is_array() )
|
||||
|
|
|
@ -127,6 +127,8 @@ struct VIA_DIMENSION
|
|||
return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
|
||||
}
|
||||
|
||||
bool operator!=( const VIA_DIMENSION& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
bool operator<( const VIA_DIMENSION& aOther ) const
|
||||
{
|
||||
if( m_Diameter != aOther.m_Diameter )
|
||||
|
@ -168,6 +170,8 @@ struct DIFF_PAIR_DIMENSION
|
|||
&& ( m_ViaGap == aOther.m_ViaGap );
|
||||
}
|
||||
|
||||
bool operator!=( const DIFF_PAIR_DIMENSION& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
bool operator<( const DIFF_PAIR_DIMENSION& aOther ) const
|
||||
{
|
||||
if( m_Width != aOther.m_Width )
|
||||
|
@ -206,6 +210,13 @@ struct TEXT_ITEM_INFO
|
|||
m_Visible = aVisible;
|
||||
m_Layer = aLayer;
|
||||
}
|
||||
|
||||
bool operator==( const TEXT_ITEM_INFO& aOther ) const
|
||||
{
|
||||
return m_Text.IsSameAs( aOther.m_Text )
|
||||
&& ( m_Visible == aOther.m_Visible )
|
||||
&& ( m_Layer == aOther.m_Layer );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -230,6 +241,12 @@ public:
|
|||
|
||||
virtual ~BOARD_DESIGN_SETTINGS();
|
||||
|
||||
bool operator==( const BOARD_DESIGN_SETTINGS& aOther ) const;
|
||||
bool operator!=( const BOARD_DESIGN_SETTINGS& aOther ) const
|
||||
{
|
||||
return !operator==( aOther );
|
||||
}
|
||||
|
||||
BOARD_DESIGN_SETTINGS( const BOARD_DESIGN_SETTINGS& aOther);
|
||||
|
||||
BOARD_DESIGN_SETTINGS& operator=( const BOARD_DESIGN_SETTINGS& aOther );
|
||||
|
|
|
@ -37,6 +37,10 @@ public:
|
|||
|
||||
virtual ~NET_SETTINGS();
|
||||
|
||||
bool operator==( const NET_SETTINGS& aOther ) const;
|
||||
|
||||
bool operator!=( const NET_SETTINGS& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
public:
|
||||
std::map<wxString, std::shared_ptr<NETCLASS>> m_NetClasses;
|
||||
std::shared_ptr<NETCLASS> m_DefaultNetClass;
|
||||
|
|
|
@ -2660,7 +2660,7 @@ bool BOARD::operator==( const BOARD_ITEM& aItem ) const
|
|||
|
||||
const BOARD& other = static_cast<const BOARD&>( aItem );
|
||||
|
||||
if( m_designSettings != other.m_designSettings )
|
||||
if( *m_designSettings != *other.m_designSettings )
|
||||
return false;
|
||||
|
||||
if( m_NetInfo.GetNetCount() != other.m_NetInfo.GetNetCount() )
|
||||
|
|
|
@ -994,6 +994,98 @@ void BOARD_DESIGN_SETTINGS::initFromOther( const BOARD_DESIGN_SETTINGS& aOther )
|
|||
}
|
||||
|
||||
|
||||
bool BOARD_DESIGN_SETTINGS::operator==( const BOARD_DESIGN_SETTINGS& aOther ) const
|
||||
{
|
||||
if( m_TrackWidthList != aOther.m_TrackWidthList ) return false;
|
||||
if( m_ViasDimensionsList != aOther.m_ViasDimensionsList ) return false;
|
||||
if( m_DiffPairDimensionsList != aOther.m_DiffPairDimensionsList ) return false;
|
||||
if( m_CurrentViaType != aOther.m_CurrentViaType ) return false;
|
||||
if( m_UseConnectedTrackWidth != aOther.m_UseConnectedTrackWidth ) return false;
|
||||
if( m_TempOverrideTrackWidth != aOther.m_TempOverrideTrackWidth ) return false;
|
||||
if( m_MinClearance != aOther.m_MinClearance ) return false;
|
||||
if( m_MinConn != aOther.m_MinConn ) return false;
|
||||
if( m_TrackMinWidth != aOther.m_TrackMinWidth ) return false;
|
||||
if( m_ViasMinAnnularWidth != aOther.m_ViasMinAnnularWidth ) return false;
|
||||
if( m_ViasMinSize != aOther.m_ViasMinSize ) return false;
|
||||
if( m_MinThroughDrill != aOther.m_MinThroughDrill ) return false;
|
||||
if( m_MicroViasMinSize != aOther.m_MicroViasMinSize ) return false;
|
||||
if( m_MicroViasMinDrill != aOther.m_MicroViasMinDrill ) return false;
|
||||
if( m_CopperEdgeClearance != aOther.m_CopperEdgeClearance ) return false;
|
||||
if( m_HoleClearance != aOther.m_HoleClearance ) return false;
|
||||
if( m_HoleToHoleMin != aOther.m_HoleToHoleMin ) return false;
|
||||
if( m_SilkClearance != aOther.m_SilkClearance ) return false;
|
||||
if( m_MinResolvedSpokes != aOther.m_MinResolvedSpokes ) return false;
|
||||
if( m_MinSilkTextHeight != aOther.m_MinSilkTextHeight ) return false;
|
||||
if( m_MinSilkTextThickness != aOther.m_MinSilkTextThickness ) return false;
|
||||
if( m_DRCSeverities != aOther.m_DRCSeverities ) return false;
|
||||
if( m_DrcExclusions != aOther.m_DrcExclusions ) return false;
|
||||
if( m_ZoneKeepExternalFillets != aOther.m_ZoneKeepExternalFillets ) return false;
|
||||
if( m_MaxError != aOther.m_MaxError ) return false;
|
||||
if( m_SolderMaskExpansion != aOther.m_SolderMaskExpansion ) return false;
|
||||
if( m_SolderMaskMinWidth != aOther.m_SolderMaskMinWidth ) return false;
|
||||
if( m_SolderMaskToCopperClearance != aOther.m_SolderMaskToCopperClearance ) return false;
|
||||
if( m_SolderPasteMargin != aOther.m_SolderPasteMargin ) return false;
|
||||
if( m_SolderPasteMarginRatio != aOther.m_SolderPasteMarginRatio ) return false;
|
||||
if( m_AllowSoldermaskBridgesInFPs != aOther.m_AllowSoldermaskBridgesInFPs ) return false;
|
||||
if( m_DefaultFPTextItems != aOther.m_DefaultFPTextItems ) return false;
|
||||
|
||||
if( !std::equal( std::begin( m_LineThickness ), std::end( m_LineThickness ),
|
||||
std::begin( aOther.m_LineThickness ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_TextSize ), std::end( m_TextSize ),
|
||||
std::begin( aOther.m_TextSize ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_TextThickness ), std::end( m_TextThickness ),
|
||||
std::begin( aOther.m_TextThickness ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_TextItalic ), std::end( m_TextItalic ),
|
||||
std::begin( aOther.m_TextItalic ) ) )
|
||||
return false;
|
||||
|
||||
if( !std::equal( std::begin( m_TextUpright ), std::end( m_TextUpright ),
|
||||
std::begin( aOther.m_TextUpright ) ) )
|
||||
return false;
|
||||
|
||||
if( m_DimensionUnitsMode != aOther.m_DimensionUnitsMode ) return false;
|
||||
if( m_DimensionPrecision != aOther.m_DimensionPrecision ) return false;
|
||||
if( m_DimensionUnitsFormat != aOther.m_DimensionUnitsFormat ) return false;
|
||||
if( m_DimensionSuppressZeroes != aOther.m_DimensionSuppressZeroes ) return false;
|
||||
if( m_DimensionTextPosition != aOther.m_DimensionTextPosition ) return false;
|
||||
if( m_DimensionKeepTextAligned != aOther.m_DimensionKeepTextAligned ) return false;
|
||||
if( m_DimensionArrowLength != aOther.m_DimensionArrowLength ) return false;
|
||||
if( m_DimensionExtensionOffset != aOther.m_DimensionExtensionOffset ) return false;
|
||||
if( m_auxOrigin != aOther.m_auxOrigin ) return false;
|
||||
if( m_gridOrigin != aOther.m_gridOrigin ) return false;
|
||||
if( m_HasStackup != aOther.m_HasStackup ) return false;
|
||||
if( m_UseHeightForLengthCalcs != aOther.m_UseHeightForLengthCalcs ) return false;
|
||||
if( m_trackWidthIndex != aOther.m_trackWidthIndex ) return false;
|
||||
if( m_viaSizeIndex != aOther.m_viaSizeIndex ) return false;
|
||||
if( m_diffPairIndex != aOther.m_diffPairIndex ) return false;
|
||||
if( m_useCustomTrackVia != aOther.m_useCustomTrackVia ) return false;
|
||||
if( m_customTrackWidth != aOther.m_customTrackWidth ) return false;
|
||||
if( m_customViaSize != aOther.m_customViaSize ) return false;
|
||||
if( m_useCustomDiffPair != aOther.m_useCustomDiffPair ) return false;
|
||||
if( m_customDiffPair != aOther.m_customDiffPair ) return false;
|
||||
if( m_copperLayerCount != aOther.m_copperLayerCount ) return false;
|
||||
if( m_enabledLayers != aOther.m_enabledLayers ) return false;
|
||||
if( m_boardThickness != aOther.m_boardThickness ) return false;
|
||||
if( m_currentNetClassName != aOther.m_currentNetClassName ) return false;
|
||||
if( m_stackup != aOther.m_stackup ) return false;
|
||||
if( *m_NetSettings != *aOther.m_NetSettings ) return false;
|
||||
if( *m_Pad_Master != *aOther.m_Pad_Master ) return false;
|
||||
if( m_defaultZoneSettings != aOther.m_defaultZoneSettings ) return false;
|
||||
|
||||
if( m_StyleFPFields != aOther.m_StyleFPFields ) return false;
|
||||
if( m_StyleFPText != aOther.m_StyleFPText ) return false;
|
||||
if( m_StyleFPShapes != aOther.m_StyleFPShapes ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_DESIGN_SETTINGS::migrateSchema0to1()
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -360,6 +360,22 @@ BOARD_STACKUP& BOARD_STACKUP::operator=( const BOARD_STACKUP& aOther )
|
|||
}
|
||||
|
||||
|
||||
bool BOARD_STACKUP::operator==( const BOARD_STACKUP& aOther ) const
|
||||
{
|
||||
if( m_HasDielectricConstrains != aOther.m_HasDielectricConstrains ) return false;
|
||||
if( m_HasThicknessConstrains != aOther.m_HasThicknessConstrains ) return false;
|
||||
if( m_EdgeConnectorConstraints != aOther.m_EdgeConnectorConstraints ) return false;
|
||||
if( m_CastellatedPads != aOther.m_CastellatedPads ) return false;
|
||||
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 ) ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_STACKUP::RemoveAll()
|
||||
{
|
||||
for( BOARD_STACKUP_ITEM* item : m_list )
|
||||
|
|
|
@ -214,6 +214,9 @@ public:
|
|||
BOARD_STACKUP( const BOARD_STACKUP& aOther );
|
||||
BOARD_STACKUP& operator=( const BOARD_STACKUP& aOther );
|
||||
|
||||
bool operator==( const BOARD_STACKUP& aOther ) const;
|
||||
bool operator!=( const BOARD_STACKUP& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
~BOARD_STACKUP() { RemoveAll(); }
|
||||
|
||||
const std::vector<BOARD_STACKUP_ITEM*>& GetList() const { return m_list; }
|
||||
|
|
|
@ -1689,7 +1689,7 @@ bool PAD::operator==( const BOARD_ITEM& aOther ) const
|
|||
if( Type() != aOther.Type() )
|
||||
return false;
|
||||
|
||||
if( m_parent->m_Uuid != aOther.GetParent()->m_Uuid )
|
||||
if( m_parent && aOther.GetParent() && m_parent->m_Uuid != aOther.GetParent()->m_Uuid )
|
||||
return false;
|
||||
|
||||
const PAD& other = static_cast<const PAD&>( aOther );
|
||||
|
|
|
@ -724,6 +724,7 @@ public:
|
|||
double Similarity( const BOARD_ITEM& aOther ) const override;
|
||||
|
||||
bool operator==( const BOARD_ITEM& aOther ) const override;
|
||||
bool operator!=( const BOARD_ITEM& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
#if defined(DEBUG)
|
||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
|
|
|
@ -85,6 +85,49 @@ ZONE_SETTINGS::ZONE_SETTINGS()
|
|||
}
|
||||
|
||||
|
||||
bool ZONE_SETTINGS::operator==( const ZONE_SETTINGS& aOther ) const
|
||||
{
|
||||
if( m_ZonePriority != aOther.m_ZonePriority ) return false;
|
||||
if( m_FillMode != aOther.m_FillMode ) return false;
|
||||
if( m_ZoneClearance != aOther.m_ZoneClearance ) return false;
|
||||
if( m_ZoneMinThickness != aOther.m_ZoneMinThickness ) return false;
|
||||
if( m_HatchThickness != aOther.m_HatchThickness ) return false;
|
||||
if( m_HatchGap != aOther.m_HatchGap ) return false;
|
||||
if( m_HatchOrientation != aOther.m_HatchOrientation ) return false;
|
||||
if( m_HatchSmoothingLevel != aOther.m_HatchSmoothingLevel ) return false;
|
||||
if( m_HatchSmoothingValue != aOther.m_HatchSmoothingValue ) return false;
|
||||
if( m_HatchBorderAlgorithm != aOther.m_HatchBorderAlgorithm ) return false;
|
||||
if( m_HatchHoleMinArea != aOther.m_HatchHoleMinArea ) return false;
|
||||
if( m_NetcodeSelection != aOther.m_NetcodeSelection ) return false;
|
||||
if( m_Name != aOther.m_Name ) return false;
|
||||
if( m_ZoneBorderDisplayStyle != aOther.m_ZoneBorderDisplayStyle ) return false;
|
||||
if( m_BorderHatchPitch != aOther.m_BorderHatchPitch ) return false;
|
||||
if( m_ThermalReliefGap != aOther.m_ThermalReliefGap ) return false;
|
||||
if( m_ThermalReliefSpokeWidth != aOther.m_ThermalReliefSpokeWidth ) return false;
|
||||
if( m_padConnection != aOther.m_padConnection ) return false;
|
||||
if( m_cornerSmoothingType != aOther.m_cornerSmoothingType ) return false;
|
||||
if( m_cornerRadius != aOther.m_cornerRadius ) return false;
|
||||
if( m_isRuleArea != aOther.m_isRuleArea ) return false;
|
||||
if( m_keepoutDoNotAllowCopperPour != aOther.m_keepoutDoNotAllowCopperPour ) return false;
|
||||
if( m_keepoutDoNotAllowVias != aOther.m_keepoutDoNotAllowVias ) return false;
|
||||
if( m_keepoutDoNotAllowTracks != aOther.m_keepoutDoNotAllowTracks ) return false;
|
||||
if( m_keepoutDoNotAllowPads != aOther.m_keepoutDoNotAllowPads ) return false;
|
||||
if( m_keepoutDoNotAllowFootprints != aOther.m_keepoutDoNotAllowFootprints ) return false;
|
||||
if( m_Locked != aOther.m_Locked ) return false;
|
||||
if( m_removeIslands != aOther.m_removeIslands ) return false;
|
||||
if( m_minIslandArea != aOther.m_minIslandArea ) return false;
|
||||
|
||||
// Currently, the teardrop area type is not really a ZONE_SETTINGS parameter,
|
||||
// but a ZONE parameter only.
|
||||
// However it can be used in dialogs
|
||||
if( m_TeardropType != aOther.m_TeardropType ) return false;
|
||||
|
||||
if( m_Layers != aOther.m_Layers ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE& aSource )
|
||||
{
|
||||
m_ZonePriority = aSource.GetAssignedPriority();
|
||||
|
|
|
@ -136,6 +136,10 @@ private:
|
|||
public:
|
||||
ZONE_SETTINGS();
|
||||
|
||||
bool operator==( const ZONE_SETTINGS& aOther ) const;
|
||||
|
||||
bool operator!=( const ZONE_SETTINGS& aOther ) const { return !operator==( aOther ); }
|
||||
|
||||
/**
|
||||
* operator << ( const ZONE& )
|
||||
* was Function ImportSetting
|
||||
|
|
Loading…
Reference in New Issue