Diligent Engine
Loading...
Searching...
No Matches
Diligent::IRadientDataBlob Struct Referenceabstract

#include <RadientDataBlob.h>

Inheritance diagram for Diligent::IRadientDataBlob:
Diligent.IObject Diligent::IRadientMutableDataBlob

Public Member Functions

virtual Uint64 DILIGENT_CALL_TYPE GetSize () const =0
virtual RADIENT_STATUS DILIGENT_CALL_TYPE BeginRead (const void **ppData)=0
virtual RADIENT_STATUS DILIGENT_CALL_TYPE EndRead ()=0
Public Member Functions inherited from Diligent.IObject
virtual void DILIGENT_CALL_TYPE QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
 Queries the specific interface.
template<typename DerivedType, typename = typename std::enable_if<std::is_base_of<IObject, DerivedType>::value>::type>
void QueryInterface (const INTERFACE_ID &IID, DerivedType **ppInterface)
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE AddRef ()=0
 Increments the number of strong references by 1.
virtual ReferenceCounterValueType DILIGENT_CALL_TYPE Release ()=0
virtual IReferenceCounters *DILIGENT_CALL_TYPE GetReferenceCounters () const =0

Detailed Description

Reference-counted CPU bytes with shared read access.

All methods are thread-safe. Each successful BeginRead is paired with exactly one EndRead. Scopes are not tied to a thread; handing a scope to another thread requires caller-provided synchronization. Ending another caller's scope is invalid usage. Access acquisition returns an error on conflict without waiting for active scopes to finish.

A read-only interface does not imply immutable storage: a mutable blob also exposes this interface, and its read scopes prevent concurrent writes and resizing through IRadientMutableDataBlob. Blobs created by CreateRadientDataBlob expose only read access and do not provide IRadientMutableDataBlob through QueryInterface.

Data pointers are usable only within their corresponding access scope. The caller holds a strong reference until it ends the scope; BeginRead does not retain the blob. Read access does not permit modifying the bytes.

Member Function Documentation

◆ BeginRead()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientDataBlob::BeginRead ( const void ** ppData)
pure virtual

Acquires one shared read scope and returns the first byte through ppData. Additional readers are allowed. Returns RADIENT_STATUS_INVALID_OPERATION while a mutable blob has a writer or if the reader counter cannot increase. A null ppData returns RADIENT_STATUS_INVALID_ARGUMENT. Any failure clears a non-null output and leaves access state unchanged. Returns RADIENT_STATUS_OK on success, including for an empty blob, whose output pointer is null.

◆ EndRead()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientDataBlob::EndRead ( )
pure virtual

Releases one read scope after its caller has finished reading the bytes. Returns RADIENT_STATUS_INVALID_OPERATION without changing state if there are no readers. Otherwise returns RADIENT_STATUS_OK, invoking OnLastReaderReleased if set and this releases the final reader. The callback completes before EndRead returns. A callback exception produces RADIENT_STATUS_FAILED with access already released. The blob remains available for further reads after a successful read cycle.

◆ GetSize()

virtual Uint64 DILIGENT_CALL_TYPE Diligent::IRadientDataBlob::GetSize ( ) const
pure virtual

Returns the current data size in bytes, including during active read or write access. The size is stable within an acquired access scope. Outside a scope, a mutable blob can be resized before the caller uses this value; query the size after acquiring access when using it with a data pointer. Does not acquire access or invoke either callback.