Allow arguments to findOrCreateWellLogExtractor methods to be nullptr

It is a valid pattern for the methods and it should return nullptr in this case.
This commit is contained in:
Gaute Lindkvist
2020-10-27 10:36:16 +01:00
parent 6d8eb4ccfa
commit 5bc5f5ddb7
4 changed files with 34 additions and 30 deletions

View File

@@ -28,9 +28,11 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclipseCase )
RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( RimWellPath* wellPath,
RimEclipseCase* eclipseCase )
{
if ( !( wellPath && eclipseCase ) ) return nullptr;
auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr;
@@ -40,9 +42,11 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gs
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase )
RigGeoMechWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( RimWellPath* wellPath,
RimGeoMechCase* geomCase )
{
if ( !( wellPath && geomCase ) ) return nullptr;
auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr;
@@ -52,10 +56,11 @@ RigGeoMechWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gs
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor*
RiaExtractionTools::findOrCreateSimWellExtractor( gsl::not_null<const RimSimWellInView*> simWell,
gsl::not_null<const RigWellPath*> wellPathGeom )
RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( const RimSimWellInView* simWell,
const RigWellPath* wellPathGeom )
{
if ( !( simWell && wellPathGeom ) ) return nullptr;
auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr;

View File

@@ -36,13 +36,10 @@ class QString;
//==================================================================================================
namespace RiaExtractionTools
{
RigEclipseWellLogExtractor* findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclipseCase );
RigGeoMechWellLogExtractor* findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase );
RigEclipseWellLogExtractor* findOrCreateWellLogExtractor( RimWellPath* wellPath, RimEclipseCase* eclipseCase );
RigGeoMechWellLogExtractor* findOrCreateWellLogExtractor( RimWellPath* wellPath, RimGeoMechCase* geomCase );
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( gsl::not_null<const RimSimWellInView*> simWell,
gsl::not_null<const RigWellPath*> wellPathGeom );
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const RimSimWellInView* simWell, const RigWellPath* wellPathGeom );
RimWellLogPlotCollection* wellLogPlotCollection();

View File

@@ -59,12 +59,13 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor*
RimWellLogPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
gsl::not_null<const RigWellPath*> wellPathGeometry,
gsl::not_null<const RigEclipseCaseData*> eclCaseData )
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeometry,
const RigEclipseCaseData* eclCaseData )
{
if ( !( wellPathGeometry && eclCaseData ) ) return nullptr;
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
@@ -84,9 +85,10 @@ RigEclipseWellLogExtractor*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclCase )
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase )
{
if ( !( wellPath && eclCase ) ) return nullptr;
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
auto wellPathGeometry = wellPath->wellPathGeometry();
@@ -111,9 +113,11 @@ RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( gsl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geoMechCase )
RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
if ( !( wellPath && geoMechCase ) ) return nullptr;
RigGeoMechCaseData* caseData = geoMechCase->geoMechData();
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !( caseData && wellPathGeometry ) ) return nullptr;

View File

@@ -48,15 +48,13 @@ public:
RimWellLogPlotCollection();
~RimWellLogPlotCollection() override;
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
gsl::not_null<const RigWellPath*> wellPathGeometry,
gsl::not_null<const RigEclipseCaseData*> eclCaseData );
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeometry,
const RigEclipseCaseData* eclCaseData );
RigEclipseWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geoMechCase );
RigEclipseWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
std::vector<RimWellLogPlot*> wellLogPlots() const;
void addWellLogPlot( gsl::not_null<RimWellLogPlot*> wellLogPlot );