MeshKernel
MKStateUndoAction.hpp
1 //---- GPL ---------------------------------------------------------------------
2 //
3 // Copyright (C) Stichting Deltares, 2011-2024.
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation version 3.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // contact: delft3d.support@deltares.nl
18 // Stichting Deltares
19 // P.O. Box 177
20 // 2600 MH Delft, The Netherlands
21 //
22 // All indications and logos of, and references to, "Delft3D" and "Deltares"
23 // are registered trademarks of Stichting Deltares, and remain the property of
24 // Stichting Deltares. All rights reserved.
25 //
26 //------------------------------------------------------------------------------
27 
28 #pragma once
29 
30 #include <memory>
31 
32 #include "MeshKernel/UndoActions/UndoAction.hpp"
33 
34 #include "MeshKernelApi/State.hpp"
35 
36 namespace meshkernelapi
37 {
38 
44  class MKStateUndoAction : public meshkernel::UndoAction
45  {
46  public:
48  static std::unique_ptr<MKStateUndoAction> Create(MeshKernelState& mkState);
49 
53  explicit MKStateUndoAction(MeshKernelState& mkState);
54 
55  private:
57  void SwapContents();
58 
60  void DoCommit() override;
61 
63  void DoRestore() override;
64 
66  MeshKernelState m_mkState;
67 
69  MeshKernelState& m_mkStateReference;
70  };
71 
72 } // namespace meshkernelapi
meshkernelapi::MeshKernelState
The class holding the state of the C API library.
Definition: State.hpp:54
meshkernelapi
Contains all structs and functions exposed at the API level.
Definition: BoundingBox.hpp:32
meshkernelapi::MKStateUndoAction::MKStateUndoAction
MKStateUndoAction(MeshKernelState &mkState)
Constructor.
meshkernelapi::MKStateUndoAction::Create
static std::unique_ptr< MKStateUndoAction > Create(MeshKernelState &mkState)
Allocate a CompoundUndoAction and return a unique_ptr to the newly create object.
meshkernelapi::MKStateUndoAction
Undo action for MeshKernelState.
Definition: MKStateUndoAction.hpp:44