|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Stack-based implementation of IDBMemento for BlockAccessor. More...
#include <DBMemento.h>


Public Member Functions | |
| void | takeSnapshot (std::shared_ptr< BlockAccessor > blocks) |
| Takes a snapshot of the given BlockAccessor. | |
| void | restore (size_t n_steps=1) |
| Restores the state n_steps snapshots back. | |
| void | print_snapshot_content (size_t n=0) |
| Prints the content of a stored snapshot. | |
| size_t | stack_size () |
| Returns the number of snapshots currently stored. | |
Public Member Functions inherited from IDBMemento | |
| virtual | ~IDBMemento ()=default |
| Virtual destructor for proper polymorphic cleanup. | |
| virtual void | restore (std::size_t n_steps=1)=0 |
| Restores the state n_steps snapshots back. | |
| virtual void | print_snapshot_content (std::size_t n=0)=0 |
| Prints the content of a stored snapshot. | |
Stack-based implementation of IDBMemento for BlockAccessor.
DBMemento maintains an internal stack of BlockAccessor snapshots: each call to takeSnapshot() pushes a new copy onto the stack, while restore() pops one or more entries and overwrites the target BlockAccessor with the stored state.
This is used by MemoryManager to:
Definition at line 39 of file DBMemento.h.
| void DBMemento::print_snapshot_content | ( | size_t | n = 0 | ) |
Prints the content of a stored snapshot.
Mainly for debugging. If n is 0, it usually refers to the most recent snapshot (implementation dependent).
| n | Index of the snapshot to print (default 0). |
Definition at line 20 of file DBMemento.cpp.
| void DBMemento::restore | ( | size_t | n_steps = 1 | ) |
Restores the state n_steps snapshots back.
Pops up to n_steps snapshots from the internal stack and uses the last popped snapshot to overwrite the current BlockAccessor state.
| n_steps | Number of snapshots to roll back (default 1). |
Definition at line 7 of file DBMemento.cpp.
|
virtual |
Returns the number of snapshots currently stored.
Implements IDBMemento.
Definition at line 39 of file DBMemento.cpp.
|
virtual |
Takes a snapshot of the given BlockAccessor.
The snapshot is stored internally and can be restored later with restore().
| blocks | Shared pointer to the BlockAccessor to snapshot. |
Implements IDBMemento.
Definition at line 3 of file DBMemento.cpp.