netzob.Common.Utils.UndoRedo package

Submodules

netzob.Common.Utils.UndoRedo.AbstractMemento module

class AbstractMemento(originator)[source]

Bases: object

This class represents a Memento meaning the serialization of an object state.

originator

The instance from which the memento has been computed

netzob.Common.Utils.UndoRedo.AbstractMementoCreator module

class AbstractMementoCreator[source]

Bases: object

Parent class of objects to save for Undo/Redo.

This abstract class must be inherited by all the objects which need to be saved for Undo/Redo processes. These objects have to provide two methods, storeInMemento and restoreFromMemento both used to save and restore current state of the object.

restoreFromMemento(memento)[source]

This method restores current object internals with provided memento.

The provided memento should be created by the storeInMemento method and represents the current object. It returns the current state of the object before the restore operation

Parameters:memento (netzob.Common.Utils.UndoRedo.AbstractMemento.AbstractMemento) – memento containing internals to set in current object to restore it.
Returns:the memento of current object before executing the restore process
Return type:netzob.Common.Utils.UndoRedo.AbstractMemento.AbstractMemento
storeInMemento()[source]

This method creates a memento to represent the current state of object.

This memento should be stored in the UndoRedo action stack and might be used as a parameter of the restoreFromMemento method.

Returns:the created memento representing current object
Return type:netzob.Common.Utils.UndoRedo.AbstractMemento.AbstractMemento

Module contents