2026-09-16 15:02:57 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2026- Equinor ASA
|
|
|
|
|
//
|
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "cafPdmScriptResponse.h"
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
#include <expected>
|
|
|
|
|
|
|
|
|
|
class RimCase;
|
|
|
|
|
class Rim3dView;
|
2026-09-16 16:03:31 +02:00
|
|
|
class RimFractureTemplate;
|
2026-09-16 17:20:17 +02:00
|
|
|
class RimIdenticalGridCaseGroup;
|
|
|
|
|
class RimEclipseStatisticsCase;
|
2026-09-16 17:47:03 +02:00
|
|
|
class RimWellLogPlot;
|
2026-09-16 15:02:57 +02:00
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
|
{
|
|
|
|
|
class PdmObjectHandle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
/// Helpers used by the legacy command file interface (Ricf*) to forward to the object-oriented
|
|
|
|
|
/// command methods (Rimc*). The legacy interface identifies objects by integer ids, while the
|
|
|
|
|
/// object methods operate directly on objects. These helpers translate between the two.
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
namespace RicfForwarding
|
|
|
|
|
{
|
2026-09-18 10:00:59 +02:00
|
|
|
/// Find a grid case by id. A negative id is not accepted.
|
2026-09-16 15:02:57 +02:00
|
|
|
std::expected<RimCase*, QString> findCase( int caseId );
|
|
|
|
|
|
2026-09-18 10:00:59 +02:00
|
|
|
/// Find a grid case by id, or the first Eclipse result case in the project when the id is negative.
|
|
|
|
|
/// Only for legacy commands that documented this fallback (replaceCase).
|
|
|
|
|
std::expected<RimCase*, QString> findCaseOrFirstEclipseResultCase( int caseId );
|
|
|
|
|
|
2026-09-16 15:02:57 +02:00
|
|
|
/// Find a view by id in the given case. A negative id is not accepted.
|
|
|
|
|
std::expected<Rim3dView*, QString> findView( RimCase* rimCase, int viewId );
|
|
|
|
|
|
2026-09-16 15:08:37 +02:00
|
|
|
/// Find a 3D view by id anywhere in the project. A negative id is not accepted.
|
|
|
|
|
std::expected<Rim3dView*, QString> findView( int viewId );
|
|
|
|
|
|
2026-09-18 10:00:59 +02:00
|
|
|
/// Find a grid case group by id. A negative id is not accepted.
|
2026-09-16 17:20:17 +02:00
|
|
|
std::expected<RimIdenticalGridCaseGroup*, QString> findCaseGroup( int groupId );
|
|
|
|
|
|
2026-09-18 10:00:59 +02:00
|
|
|
/// Find a grid case group by id, or the first case group in the project when the id is negative.
|
|
|
|
|
/// Only for legacy commands that documented this fallback (replaceSourceCases).
|
|
|
|
|
std::expected<RimIdenticalGridCaseGroup*, QString> findCaseGroupOrFirst( int groupId );
|
|
|
|
|
|
2026-09-16 17:20:17 +02:00
|
|
|
/// Find a statistics case by case id in any grid case group.
|
|
|
|
|
std::expected<RimEclipseStatisticsCase*, QString> findStatisticsCase( int caseId );
|
|
|
|
|
|
2026-09-16 17:47:03 +02:00
|
|
|
/// Find a well log plot by view id.
|
|
|
|
|
std::expected<RimWellLogPlot*, QString> findWellLogPlot( int viewId );
|
|
|
|
|
|
2026-09-16 16:03:31 +02:00
|
|
|
/// Find a fracture template by id.
|
|
|
|
|
std::expected<RimFractureTemplate*, QString> findFractureTemplate( int templateId );
|
|
|
|
|
|
2026-09-16 15:02:57 +02:00
|
|
|
/// Convert the result of a Rimc method execution to a script response, logging errors with the command name.
|
|
|
|
|
caf::PdmScriptResponse toScriptResponse( const std::expected<caf::PdmObjectHandle*, QString>& result, const QString& commandName );
|
|
|
|
|
|
|
|
|
|
/// Create an error response and log the message with the command name.
|
|
|
|
|
caf::PdmScriptResponse errorResponse( const QString& message, const QString& commandName );
|
|
|
|
|
|
|
|
|
|
} // namespace RicfForwarding
|