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

#include <RadientDataBlob.h>

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

Public Member Functions

virtual RADIENT_STATUS DILIGENT_CALL_TYPE BeginWrite (void **ppData)=0
virtual RADIENT_STATUS DILIGENT_CALL_TYPE EndWrite ()=0
virtual RADIENT_STATUS DILIGENT_CALL_TYPE Resize (Uint64 NewSize)=0
Public Member Functions inherited from Diligent::IRadientDataBlob
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

An owning data blob with shared reads, exclusive writes, and resizable storage.

Created by CreateRadientMutableDataBlob. QueryInterface exposes both IID_RadientDataBlob and IID_RadientMutableDataBlob on the same object. All interface views share the same access state. Methods are thread-safe, and access scopes follow the lifetime and synchronization rules of IRadientDataBlob.

Member Function Documentation

◆ BeginWrite()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMutableDataBlob::BeginWrite ( void ** ppData)
pure virtual

Acquires exclusive write access and returns the first byte through ppData. Returns RADIENT_STATUS_INVALID_OPERATION while any reader or writer is active, including a second BeginWrite from the current writer. 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. The caller retains the blob through EndWrite; BeginWrite does not retain it.

◆ EndWrite()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMutableDataBlob::EndWrite ( )
pure virtual

Releases exclusive access after the caller has finished writing the bytes. Returns RADIENT_STATUS_OK when a writer was active. Completed writes are visible to subsequent successful read or write acquisitions through either interface. Otherwise returns RADIENT_STATUS_INVALID_OPERATION without changing state. Does not invoke OnLastReaderReleased or OnDestroy.

◆ Resize()

virtual RADIENT_STATUS DILIGENT_CALL_TYPE Diligent::IRadientMutableDataBlob::Resize ( Uint64 NewSize)
pure virtual

Changes the data size when no read or write scope is active.

Parameters
[in]NewSize- New size in bytes. Zero makes the blob empty; subsequent successful access returns a null data pointer.

Preserves existing bytes up to the smaller of the old and new sizes, and zero-initializes added bytes. Shrinking discards bytes beyond NewSize. The allocation may move, so subsequent access scopes can return a different data pointer.

Returns RADIENT_STATUS_INVALID_OPERATION if any reader or writer is active, even if NewSize equals the current size. Does not wait for active scopes to finish. Otherwise returns RADIENT_STATUS_INVALID_ARGUMENT for a size beyond the implementation's addressable allocation range, RADIENT_STATUS_FAILED if allocation fails, or RADIENT_STATUS_OK on success. Resizing to the current size succeeds without changing the contents when no scope is active. Failure leaves the size, contents, and access state unchanged. Resizing does not acquire an access scope or invoke either callback. The new size is visible through every interface view of the blob.