Medical Imaging Interaction Toolkit  2016.11.0
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="")
 
virtual ~OperationEvent ()
 
OperationGetOperation ()
 
OperationActorGetDestination ()
 
virtual void ReverseOperations () override
 
virtual 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 143 of file mitkOperationEvent.h.

Constructor & Destructor Documentation

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

Definition at line 86 of file mitkOperationEvent.cpp.

References mitk::New(), and OnObjectDeleted().

mitk::OperationEvent::~OperationEvent ( )
virtual

Definition at line 105 of file mitkOperationEvent.cpp.

Member Function Documentation

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

Definition at line 141 of file mitkOperationEvent.cpp.

Referenced by mitk::LimitedLinearUndo::GetLastOfType().

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

Definition at line 81 of file mitkOperationEvent.cpp.

Referenced by mitk::LimitedLinearUndo::GetLastOfType().

bool mitk::OperationEvent::IsValid ( )
virtual

Definition at line 151 of file mitkOperationEvent.cpp.

Referenced by mitk::LimitedLinearUndo::GetLastOfType().

void mitk::OperationEvent::OnObjectDeleted ( )
protected

Definition at line 146 of file mitkOperationEvent.cpp.

Referenced by OperationEvent().

void mitk::OperationEvent::ReverseAndExecute ( )
overridevirtual

Reimplemented from mitk::UndoStackItem.

Definition at line 134 of file mitkOperationEvent.cpp.

void mitk::OperationEvent::ReverseOperations ( )
overridevirtual

swaps the Undo and Redo- operation and changes m_Reversed

Reimplemented from mitk::UndoStackItem.

Definition at line 122 of file mitkOperationEvent.cpp.

References mitk::UndoStackItem::ReverseOperations().


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