Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
IDBMemento Class Referenceabstract

Abstract interface for memento-like management of BlockAccessor states. More...

#include <IDBMemento.h>

Inheritance diagram for IDBMemento:

Public Member Functions

virtual ~IDBMemento ()=default
 Virtual destructor for proper polymorphic cleanup.
 
virtual void takeSnapshot (std::shared_ptr< BlockAccessor > blocks)=0
 Takes a snapshot of the given BlockAccessor.
 
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.
 
virtual std::size_t stack_size ()=0
 Returns the number of snapshots currently stored.
 

Detailed Description

Abstract interface for memento-like management of BlockAccessor states.

This interface provides a minimal set of operations to:

  • capture the current state of a BlockAccessor (takeSnapshot),
  • roll back a given number of steps (restore),
  • inspect the content of stored snapshots (print_snapshot_content),
  • query the number of available snapshots (stack_size).

It is intended to be used by higher-level components such as MemoryManager to manage reversible changes to parameter blocks.

Definition at line 36 of file IDBMemento.h.

Constructor & Destructor Documentation

◆ ~IDBMemento()

virtual IDBMemento::~IDBMemento ( )
virtualdefault

Virtual destructor for proper polymorphic cleanup.

Member Function Documentation

◆ print_snapshot_content()

virtual void IDBMemento::print_snapshot_content ( std::size_t  n = 0)
pure virtual

Prints the content of a stored snapshot.

Mainly intended for debugging. The exact format is implementation- dependent. If n exceeds the number of snapshots, behavior is implementation-defined (often using the most recent snapshot).

Parameters
nIndex of the snapshot to print (0 can mean most recent).

◆ restore()

virtual void IDBMemento::restore ( std::size_t  n_steps = 1)
pure virtual

Restores the state n_steps snapshots back.

Implementations typically:

  • pop n_steps snapshots from an internal stack,
  • overwrite the current BlockAccessor state with the last popped one.

If n_steps exceeds the number of stored snapshots, behavior is implementation-defined (often a no-op or clamped restore).

Parameters
n_stepsNumber of snapshots to roll back (default 1).

◆ stack_size()

virtual std::size_t IDBMemento::stack_size ( )
pure virtual

Returns the number of snapshots currently stored.

Returns
Size of the internal snapshot stack.

Implemented in DBMemento.

◆ takeSnapshot()

virtual void IDBMemento::takeSnapshot ( std::shared_ptr< BlockAccessor blocks)
pure virtual

Takes a snapshot of the given BlockAccessor.

The implementation decides whether to deep-copy the data or only capture references. In typical usage (e.g. DBMemento), a deep copy is taken so that later modifications do not affect the stored state.

Parameters
blocksShared pointer to the BlockAccessor to snapshot.

Implemented in DBMemento.


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