RAII transaction on a StateTree. More...
#include <state_tree.hpp>
Public Member Functions | |
| Transaction ()=default | |
| An inert transaction (is_active() is false). | |
| Transaction (Transaction &&other) noexcept | |
| Transaction & | operator= (Transaction &&other) noexcept |
Commits the transaction currently held, then takes over other. | |
| Transaction (const Transaction &)=delete | |
| Transaction & | operator= (const Transaction &)=delete |
| ~Transaction () | |
| void | commit () |
| End this transaction and keep its edits. | |
| bool | abort () |
| Revert every edit made since this transaction began, in reverse order, drop their pending notifications, and end the transaction. | |
| bool | is_active () const |
| Whether this object still holds an open transaction. | |
Friends | |
| class | StateTree |
| class | StateTree::ValidatedTransaction |
RAII transaction on a StateTree.
Edits made while it is open are applied immediately; coalesced listener notifications are held until the outermost transaction on the tree ends, then delivered as one burst. Destroying an active Transaction commits it.
Move-only. NOT thread-safe — commit / abort on the thread that owns the tree.
|
default |
An inert transaction (is_active() is false).
|
noexcept |
|
delete |
| pulp::state::StateTree::Transaction::~Transaction | ( | ) |
| bool pulp::state::StateTree::Transaction::abort | ( | ) |
Revert every edit made since this transaction began, in reverse order, drop their pending notifications, and end the transaction.
Returns false when inactive. Immediate listeners see the reverting edits; coalesced listeners see nothing for the reverted edits.
| void pulp::state::StateTree::Transaction::commit | ( | ) |
End this transaction and keep its edits.
When it is the last open transaction on the tree, the notification burst is delivered and the undo step (if any) is pushed. No-op when inactive.
|
inline |
Whether this object still holds an open transaction.
|
delete |
|
noexcept |
Commits the transaction currently held, then takes over other.
|
friend |
|
friend |