Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::state::StateTree::Transaction Class Reference

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ Transaction() [1/3]

pulp::state::StateTree::Transaction::Transaction ( )
default

An inert transaction (is_active() is false).

◆ Transaction() [2/3]

pulp::state::StateTree::Transaction::Transaction ( Transaction && other)
noexcept

◆ Transaction() [3/3]

pulp::state::StateTree::Transaction::Transaction ( const Transaction & )
delete

◆ ~Transaction()

pulp::state::StateTree::Transaction::~Transaction ( )

Member Function Documentation

◆ abort()

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.

◆ commit()

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.

◆ is_active()

bool pulp::state::StateTree::Transaction::is_active ( ) const
inline

Whether this object still holds an open transaction.

◆ operator=() [1/2]

Transaction & pulp::state::StateTree::Transaction::operator= ( const Transaction & )
delete

◆ operator=() [2/2]

Transaction & pulp::state::StateTree::Transaction::operator= ( Transaction && other)
noexcept

Commits the transaction currently held, then takes over other.

◆ StateTree

friend class StateTree
friend

◆ StateTree::ValidatedTransaction

friend class StateTree::ValidatedTransaction
friend

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/state/include/pulp/state/state_tree.hpp