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

@@ -165,8 +165,7 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( updateParentPlot )
{
RimWellLogTrack* track = nullptr;
this->firstAncestorOrThisOfTypeAsserted( track );
auto track = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
track->updateStackedCurveData();
updateZoomInParentPlot();
@@ -184,8 +183,7 @@ void RimWellFlowRateCurve::updateCurveAppearance()
bool isLastCurveInGroup = false;
{
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
auto wellLogTrack = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
std::map<int, std::vector<RimWellLogCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
const std::vector<RimWellLogCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
@@ -269,8 +267,7 @@ void RimWellFlowRateCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedF
//--------------------------------------------------------------------------------------------------
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType( wellLogPlot );
auto wellLogPlot = firstAncestorOrThisOfType<RimWellLogPlot>();
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
{
return true;
@@ -284,10 +281,7 @@ bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
{
RimWellAllocationPlot* wap = nullptr;
this->firstAncestorOrThisOfType( wap );
return wap;
return firstAncestorOrThisOfType<RimWellAllocationPlot>();
}
//--------------------------------------------------------------------------------------------------