a batch of RAII on the structure \( s \) [see batch()]
More...
#include <ADS/Modification.h>
|
| | Batch (S &s) |
| | opens a batch on \( s \)
|
| | Batch (Batch &&b) noexcept |
| | the batch of \( b \), which no longer has it
|
| | Batch (const Batch &)=delete |
| | not copied
|
| Batch & | operator= (const Batch &)=delete |
| | not assigned
|
| Batch & | operator= (Batch &&)=delete |
| | not assigned
|
| | ~Batch () noexcept(false) |
| | closes the batch, if still open; if its scope exits by an exception, the structure goes back to the checkpoint when it is undoable and the events are dropped, else the observers get Rebuilt (or the events, if the structure has no Rebuilt)
|
| void | close (void) |
| | closes the batch: the outermost one sends the events, coalesced; idempotent
|
| void | rollback (void) |
| | brings the structure back to where it was when the batch opened, and drops its events: the observers see nothing
|
template<class S>
class ADS::Batch< S >
a batch of RAII on the structure \( s \) [see batch()]
◆ Batch() [1/3]
◆ Batch() [2/3]
the batch of \( b \), which no longer has it
◆ Batch() [3/3]
◆ ~Batch()
closes the batch, if still open; if its scope exits by an exception, the structure goes back to the checkpoint when it is undoable and the events are dropped, else the observers get Rebuilt (or the events, if the structure has no Rebuilt)
◆ close()
closes the batch: the outermost one sends the events, coalesced; idempotent
In pseudocode (beyond the book), with \( d \) the depth of the batches, \( B \) the events collected and \( M_o \) the kinds that the observer \( o \) wants:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{close}() \cr
2 & \quad d \gets d - 1;\ \textbf{if}\ d > 0\ \textbf{then}
\ \textbf{return} \cr
3 & \quad C \gets \mathrm{coalesce}( B );\ B \gets \emptyset \cr
4 & \quad \textbf{foreach}\ \text{observer } o\ \textbf{do} \cr
5 & \qquad C_o \gets \text{the events of } C \text{ whose kind is in }
M_o \cr
6 & \qquad \textbf{if}\ C_o = \emptyset\ \textbf{then}
\ \textbf{continue} \cr
7 & \qquad o.\mathrm{group\_begin}() \cr
8 & \qquad \textbf{if}\ o \text{ has a policy } p \textbf{ and }
p.\mathrm{scratch}( o.\mathrm{reoptStats}( |C_o| ) )
\ \textbf{then}\ o.\mathrm{on}( \mathrm{Rebuilt} ) \cr
9 & \qquad \textbf{else}\ o.\mathrm{on}( C_o ) \cr
10 & \qquad o.\mathrm{group\_end}()
\end{array}}
\]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ rollback()
brings the structure back to where it was when the batch opened, and drops its events: the observers see nothing
- Precondition
- the structure can go back to the checkpoint (revertible(), when it has it)
The documentation for this class was generated from the following file: