UndoAction.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #pragma once
25 
26 // std
27 #include <exception>
28 #include <vector>
29 
30 // local
31 #include "ClassDefinitions.h"
32 #include "Operation.h"
33 #include "Controller.h"
34 
35 namespace controller
36 {
37  /**
38  * A container class to store multiple Operations and undo/redo them.
39  *
40  * @see controller::Operation
41  */
42  class UndoAction
43  {
44  public:
45  /**
46  * A Constructor.
47  * Creates a new UndoAction containing multiple Operations.
48  *
49  * @param operations The operations, the new instance should contain.
50  * @see controller::Operation
51  */
52  UndoAction(const std::shared_ptr<std::vector<OperationPtr> >& operations);
53 
54  /**
55  * Returns all Operations needed to redo this Action.
56  */
57  std::shared_ptr<std::vector<OperationPtr> > redo();
58 
59  /**
60  * Returns all Operations needed to undo this Action.
61  */
62  std::shared_ptr<std::vector<OperationPtr> > undo();
63 
64  /**
65  * Returns all Operations saved in this class.
66  *
67  * @return the operations
68  */
69  const std::shared_ptr<std::vector<OperationPtr> > getOperations() const;
70 
71  private:
72  std::shared_ptr<std::vector<OperationPtr> > operations;
73  };
74 }
75 
Operation.h
ClassDefinitions.h
controller::UndoAction::redo
std::shared_ptr< std::vector< OperationPtr > > redo()
Returns all Operations needed to redo this Action.
Definition: UndoAction.cpp:36
Controller.h
controller::UndoAction::UndoAction
UndoAction(const std::shared_ptr< std::vector< OperationPtr > > &operations)
A Constructor.
Definition: UndoAction.cpp:31
controller
Definition: AddOperation.h:39
controller::UndoAction::undo
std::shared_ptr< std::vector< OperationPtr > > undo()
Returns all Operations needed to undo this Action.
Definition: UndoAction.cpp:41
controller::UndoAction
A container class to store multiple Operations and undo/redo them.
Definition: UndoAction.h:42
controller::UndoAction::getOperations
const std::shared_ptr< std::vector< OperationPtr > > getOperations() const
Returns all Operations saved in this class.
Definition: UndoAction.cpp:53