Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::OperationEvent Class Reference

Represents a pair of operations: undo and the according redo. More...

#include <mitkOperationEvent.h>

Inheritance diagram for mitk::OperationEvent:
Collaboration diagram for mitk::OperationEvent:

Public Member Functions

 OperationEvent (OperationActor *destination, Operation *operation, Operation *undoOperation, std::string description="")
 
 ~OperationEvent () override
 
OperationGetOperation ()
 
OperationActorGetDestination ()
 
void ReverseOperations () override
 
void ReverseAndExecute () override
 
virtual bool IsValid ()
 
- Public Member Functions inherited from mitk::UndoStackItem
 UndoStackItem (std::string description="")
 
virtual ~UndoStackItem ()
 
int GetGroupEventId ()
 Returns the GroupEventId for this object. More...
 
int GetObjectEventId ()
 Returns the ObjectEventId for this object. More...
 
std::string GetDescription ()
 Returns the textual description of this object. More...
 

Protected Member Functions

void OnObjectDeleted ()
 

Additional Inherited Members

- Static Public Member Functions inherited from mitk::UndoStackItem
static int GetCurrGroupEventId ()
 For combining operations in groups. More...
 
static int GetCurrObjectEventId ()
 For combining operations in Objects. More...
 
static void IncCurrObjectEventId ()
 Increases the current ObjectEventId For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo. More...
 
static void IncCurrGroupEventId ()
 Increases the current GroupEventId For example if a button click generates operations the GroupEventId has to be incremented to be able to undo. More...
 
- Protected Attributes inherited from mitk::UndoStackItem
bool m_Reversed
 true, if operation and undooperation have been swaped/changed More...
 

Detailed Description

Represents a pair of operations: undo and the according redo.

Additionally to the base class UndoStackItem, which only provides a description of an item, OperationEvent does the actual accounting of the undo/redo stack. This class holds two Operation objects (operation and its inverse operation) and the corresponding OperationActor. The operations may be swapped by the undo models, when an OperationEvent is moved from their undo to their redo stack or vice versa.

Note, that memory management of operation and undooperation is done by this class. Memory of both objects is freed in the destructor. For this, the method IsValid() is needed which holds information of the state of m_Destination. In case the object referenced by m_Destination is already deleted, isValid() returns false. In more detail if the destination happens to be an itk::Object (often the case), OperationEvent is informed as

Definition at line 139 of file mitkOperationEvent.h.

Constructor & Destructor Documentation

◆ OperationEvent()

mitk::OperationEvent::OperationEvent ( OperationActor destination,
Operation operation,
Operation undoOperation,
std::string  description = "" 
)

Definition at line 82 of file mitkOperationEvent.cpp.

References OnObjectDeleted().

◆ ~OperationEvent()

mitk::OperationEvent::~OperationEvent ( )
override

Definition at line 101 of file mitkOperationEvent.cpp.

Member Function Documentation

◆ GetDestination()

mitk::OperationActor * mitk::OperationEvent::GetDestination ( )

Definition at line 137 of file mitkOperationEvent.cpp.

◆ GetOperation()

mitk::Operation * mitk::OperationEvent::GetOperation ( )

Definition at line 77 of file mitkOperationEvent.cpp.

◆ IsValid()

bool mitk::OperationEvent::IsValid ( )
virtual

Definition at line 147 of file mitkOperationEvent.cpp.

◆ OnObjectDeleted()

void mitk::OperationEvent::OnObjectDeleted ( )
protected

Definition at line 142 of file mitkOperationEvent.cpp.

Referenced by OperationEvent().

◆ ReverseAndExecute()

void mitk::OperationEvent::ReverseAndExecute ( )
overridevirtual

Reimplemented from mitk::UndoStackItem.

Definition at line 130 of file mitkOperationEvent.cpp.

References mitk::OperationActor::ExecuteOperation(), and ReverseOperations().

◆ ReverseOperations()

void mitk::OperationEvent::ReverseOperations ( )
overridevirtual

swaps the Undo and Redo- operation and changes m_Reversed

Reimplemented from mitk::UndoStackItem.

Definition at line 118 of file mitkOperationEvent.cpp.

References mitk::UndoStackItem::ReverseOperations().

Referenced by ReverseAndExecute().


The documentation for this class was generated from the following files: