Change API for PdmObjectHandle and PdmFieldHandle

* Refactor interface to PdmObjectHandle and PdmFieldHandle
Return objects instead of passing in structures as parameters

* Add nodiscard to several functions
* Remove redundant this->
* Rename to ptrReferencedObjectsByType
This commit is contained in:
Magne Sjaastad
2023-05-12 21:41:34 +02:00
committed by GitHub
parent 37e29a0f68
commit 0c90f67dcc
510 changed files with 1651 additions and 3111 deletions

View File

@@ -115,8 +115,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot )
if ( updateParentPlot )
{
RimSummaryPlot* parentPlot;
firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
parentPlot->updateAll();
}
}
@@ -133,8 +132,7 @@ void RimSummaryCurveCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle
curve->updateCurveAppearance();
}
RimSummaryPlot* parentPlot;
firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
parentPlot->plotWidget()->scheduleReplot();
}
}
@@ -252,7 +250,7 @@ void RimSummaryCurveCollection::removeCurve( RimSummaryCurve* curve )
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves() const
{
return m_curves.children();
return m_curves.childrenByType();
}
//--------------------------------------------------------------------------------------------------
@@ -362,8 +360,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
curve->updateConnectedEditors();
}
RimSummaryPlot* parentPlot;
firstAncestorOrThisOfTypeAsserted( parentPlot );
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
parentPlot->updatePlotTitle();
if ( parentPlot->plotWidget() ) parentPlot->plotWidget()->updateLegend();
@@ -384,9 +381,7 @@ void RimSummaryCurveCollection::setCurrentSummaryCurve( RimSummaryCurve* curve )
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimSummaryCurveCollection::fieldsToShowInToolbar()
{
RimSummaryCrossPlot* parentCrossPlot;
firstAncestorOrThisOfType( parentCrossPlot );
auto parentCrossPlot = firstAncestorOrThisOfType<RimSummaryCrossPlot>();
if ( parentCrossPlot )
{
return m_unionSourceStepping->fieldsToShowInToolbar();
@@ -463,8 +458,7 @@ void RimSummaryCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
}
else if ( changedField == &m_editPlot )
{
RimSummaryPlot* plot = nullptr;
this->firstAncestorOrThisOfType( plot );
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
if ( plot )
{
RicEditSummaryPlotFeature::editSummaryPlot( plot );