2017-06-29 04:48:26 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-06-29 04:48:26 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-06-29 04:48:26 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-06-29 04:48:26 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2019-05-23 06:59:19 -05:00
|
|
|
#include "RicfCommandResponse.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RicfFieldCapability.h"
|
|
|
|
#include "RicfObjectCapability.h"
|
2019-10-15 08:46:19 -05:00
|
|
|
#include "cafCmdFeature.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmObject.h"
|
2017-06-29 04:48:26 -05:00
|
|
|
|
2020-02-21 04:28:54 -06:00
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
class RicfCommandObject : public caf::PdmObject, public RicfObjectCapability
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RicfCommandObject();
|
|
|
|
~RicfCommandObject() override;
|
|
|
|
|
|
|
|
virtual RicfCommandResponse execute() = 0;
|
|
|
|
|
|
|
|
static QString pythonHelpString( const QString& existingTooltip, const QString& keyword );
|
|
|
|
};
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#define RICF_InitField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
2020-02-21 04:28:54 -06:00
|
|
|
CAF_PDM_InitField( field, \
|
|
|
|
keyword, \
|
|
|
|
default, \
|
|
|
|
uiName, \
|
|
|
|
iconResourceName, \
|
|
|
|
RicfCommandObject::pythonHelpString( toolTip, keyword ), \
|
|
|
|
whatsThis ); \
|
|
|
|
AddRicfCapabilityToField( field, keyword )
|
2017-06-29 04:48:26 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
#define RICF_InitFieldNoDefault( field, keyword, uiName, iconResourceName, toolTip, whatsThis ) \
|
2020-02-21 04:28:54 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( field, \
|
|
|
|
keyword, \
|
|
|
|
uiName, \
|
|
|
|
iconResourceName, \
|
|
|
|
RicfCommandObject::pythonHelpString( toolTip, keyword ), \
|
|
|
|
whatsThis ); \
|
|
|
|
AddRicfCapabilityToField( field, keyword )
|
|
|
|
|
|
|
|
#define RICF_InitFieldTranslated( field, keyword, scriptKeyword, default, uiName, iconResourceName, toolTip, whatsThis ) \
|
|
|
|
CAF_PDM_InitField( field, \
|
|
|
|
keyword, \
|
|
|
|
default, \
|
|
|
|
uiName, \
|
|
|
|
iconResourceName, \
|
|
|
|
RicfCommandObject::pythonHelpString( toolTip, scriptKeyword ), \
|
|
|
|
whatsThis ); \
|
|
|
|
AddRicfCapabilityToField( field, scriptKeyword )
|
|
|
|
|
|
|
|
#define RICF_InitFieldNoDefaultTranslated( field, keyword, scriptKeyword, uiName, iconResourceName, toolTip, whatsThis ) \
|
|
|
|
CAF_PDM_InitFieldNoDefault( field, \
|
|
|
|
keyword, \
|
|
|
|
uiName, \
|
|
|
|
iconResourceName, \
|
|
|
|
RicfCommandObject::pythonHelpString( toolTip, scriptKeyword ), \
|
|
|
|
whatsThis ); \
|
|
|
|
AddRicfCapabilityToField( field, scriptKeyword )
|
2017-06-29 04:48:26 -05:00
|
|
|
|
2020-02-24 08:42:23 -06:00
|
|
|
#define RICF_InitObject( uiName, iconResourceName, toolTip, whatsThis ) \
|
|
|
|
CAF_PDM_InitObject( uiName, iconResourceName, toolTip, whatsThis ); \
|
|
|
|
RicfObjectCapability::addCapabilityToObject( this, classKeyword(), whatsThis );
|
|
|
|
|
|
|
|
#define RICF_InitObjectWithScriptNameAndComment( uiName, iconResourceName, toolTip, whatsThis, scriptClassName, scriptComment ) \
|
|
|
|
CAF_PDM_InitObject( uiName, iconResourceName, toolTip, whatsThis ); \
|
|
|
|
RicfObjectCapability::addCapabilityToObject( this, scriptClassName, scriptComment );
|
|
|
|
|
2019-10-15 08:46:19 -05:00
|
|
|
#define RICF_HEADER_INIT \
|
|
|
|
CAF_CMD_HEADER_INIT; \
|
|
|
|
CAF_PDM_HEADER_INIT
|
|
|
|
|
|
|
|
// RICF_SOURCE_INIT calls CAF_FACTORY_REGISTER2 to avoid name conflicts with CAF_PDM_SOURCE_INIT
|
|
|
|
#define RICF_SOURCE_INIT( ClassName, CommandIdName, CommandKeyword ) \
|
|
|
|
const std::string& ClassName::idNameStatic() \
|
|
|
|
{ \
|
|
|
|
static std::string id = CommandIdName; \
|
|
|
|
return id; \
|
|
|
|
} \
|
|
|
|
CAF_FACTORY_REGISTER2( caf::CmdFeature, ClassName, std::string, ClassName::idNameStatic() ); \
|
|
|
|
CAF_PDM_SOURCE_INIT( ClassName, CommandKeyword )
|