Medical Imaging Interaction Toolkit  2023.12.00
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 swapped/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 = "" 
)

◆ ~OperationEvent()

mitk::OperationEvent::~OperationEvent ( )
override

Member Function Documentation

◆ GetDestination()

OperationActor* mitk::OperationEvent::GetDestination ( )

◆ GetOperation()

Operation* mitk::OperationEvent::GetOperation ( )

◆ IsValid()

virtual bool mitk::OperationEvent::IsValid ( )
virtual

◆ OnObjectDeleted()

void mitk::OperationEvent::OnObjectDeleted ( )
protected

◆ ReverseAndExecute()

void mitk::OperationEvent::ReverseAndExecute ( )
overridevirtual

Reimplemented from mitk::UndoStackItem.

◆ ReverseOperations()

void mitk::OperationEvent::ReverseOperations ( )
overridevirtual

Reimplemented from mitk::UndoStackItem.


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