Diligent Engine
Loading...
Searching...
No Matches
Diligent::RadientDataBlobReadAccess Class Reference

#include <RadientDataBlobReadAccess.hpp>

Public Member Functions

 RadientDataBlobReadAccess () noexcept=default
 Creates an inactive scope.
 RadientDataBlobReadAccess (IRadientDataBlob *pBlob)
 operator bool () const noexcept
 Returns true if this helper owns read access, including for an empty blob.
const void * GetData () const noexcept
 Returns the read pointer, or null for an inactive scope or an empty blob.
Uint64 GetSize () const noexcept
 Returns the size captured after acquisition, or zero for an inactive scope.
RADIENT_STATUS Reset () noexcept

Detailed Description

Owns one shared read scope and keeps its blob alive until access is released.

Accepts both read-only and mutable blobs. Construction attempts BeginRead; use operator bool() to check whether access was acquired. Successful empty scopes are active even though GetData() is null. Moving transfers the read scope without calling BeginRead or EndRead on it. Copying is not allowed.

Destruction and move assignment release any previously owned scope and ignore its EndRead result. Use Reset() explicitly to observe callback errors. Never call EndRead directly for a read owned by this helper. Concurrent access to the same helper requires external synchronization, as does handing it to another thread. Data pointers are valid only while the owning read scope remains active.

Constructor & Destructor Documentation

◆ RadientDataBlobReadAccess()

Diligent::RadientDataBlobReadAccess::RadientDataBlobReadAccess ( IRadientDataBlob * pBlob)
inlineexplicit

Attempts to acquire read access, retaining pBlob through the matching EndRead. A null blob or failed acquisition leaves the scope inactive, retains no reference, and never calls EndRead.

Member Function Documentation

◆ Reset()

RADIENT_STATUS Diligent::RadientDataBlobReadAccess::Reset ( )
inlinenoexcept

Releases read access and the strong reference, leaving this helper inactive. Returns EndRead's result, or RADIENT_STATUS_NO_CHANGE if already inactive. The scope is released even if a callback makes EndRead return FAILED. State is cleared before invoking EndRead, so reentrant Reset() is harmless.