From 2228b67aa4444b4fe5d28c93f7714b2c6511b396 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 25 Oct 2024 17:59:43 +0200 Subject: [PATCH] Add some friends to protect direct access to internal cell storage --- .../ReservoirDataModel/RigActiveCellGrid.h | 3 ++- ApplicationLibCode/ReservoirDataModel/RigMainGrid.h | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h index 47ba91ee2a..142b47e822 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellGrid.h @@ -34,7 +34,8 @@ class RigActiveCellGrid : public RigMainGrid size_t totalCellCount() const override; size_t totalActiveCellCount() const; -public: // only for use by file readers! +protected: // only for use by file readers! + friend class RifReaderOpmCommonActive; std::map& nativeCells(); const std::map& nativeCells() const; void setTotalCellCount( size_t totalCellCount ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h index 88ac93e79f..a4e98184a3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h @@ -113,7 +113,16 @@ class RigMainGrid : public RigGridBase bool isDualPorosity() const; void setDualPorosity( bool enable ); -public: // only for use by file readers! +protected: // only for use by file readers and internal services. TODO: replace with a better API + friend class RigGridBase; + friend class RigReservoirBuilder; + friend class RifRoffFileTools; + friend class RifEclipseOutputFileTools; + friend class RifReaderEclipseOutput; + friend class RifReaderOpmCommon; + friend class RiaGrpcCaseService; + friend class RiaActiveCellInfoStateHandler; + friend class RicCreateTemporaryLgrFeature; std::vector& reservoirCells(); const std::vector& reservoirCells() const;