Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::svg::DocumentReadAccess Class Reference

Scoped read access to a DocumentState. More...

#include "donner/svg/DocumentState.h"

Public Member Functions

 DocumentReadAccess (DocumentState &documentState)
 Create a read access guard.
 DocumentReadAccess (const DocumentReadAccess &other)=delete
 Copying access guards is not allowed.
 DocumentReadAccess (DocumentReadAccess &&other) noexcept
 Moving access guards transfers the held access.
 ~DocumentReadAccess ()
 Destructor, releasing the held access.
DocumentReadAccessoperator= (const DocumentReadAccess &other)=delete
 Copying access guards is not allowed.
DocumentReadAccessoperator= (DocumentReadAccess &&other) noexcept=delete
 Moving access guards by assignment is not needed by callers.
DocumentStatedocumentState () const
 Get the guarded document state.
Registryregistry () const
 Get the guarded registry.

Static Public Member Functions

static std::optional< DocumentReadAccesstryAcquire (DocumentState &documentState)
 Attempt to create a read access guard without waiting for a writer.

Detailed Description

Scoped read access to a DocumentState.

Constructor & Destructor Documentation

◆ DocumentReadAccess()

donner::svg::DocumentReadAccess::DocumentReadAccess ( DocumentState & documentState)
inlineexplicit

Create a read access guard.

Parameters
documentStateDocument state being accessed.

Member Function Documentation

◆ tryAcquire()

std::optional< DocumentReadAccess > donner::svg::DocumentReadAccess::tryAcquire ( DocumentState & documentState)
inlinestatic

Attempt to create a read access guard without waiting for a writer.

Reentrant access from a thread that already holds read or write access succeeds immediately.

Parameters
documentStateDocument state being accessed.
Returns
A read guard, or std::nullopt while another thread owns or is waiting for write access.

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