Diligent Engine API Reference: Diligent::IObject Class Reference

Diligent Engine API Reference

Public Member Functions | List of all members
Diligent::IObject Class Referenceabstract

Base interface for all dynamic objects in the engine. More...

Inheritance diagram for Diligent::IObject:

## Public Member Functions
virtual void | QueryInterface (const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
| Queries the specific interface. More...
virtual CounterValueType | AddRef ()=0
| Increments the number of strong references by 1. More...
virtual CounterValueType | Release ()=0
| Decrements the number of strong references by 1 and destroys the object when the counter reaches zero. More...
virtual IReferenceCounters * | GetReferenceCounters () const =0
| Returns the pointer to IReferenceCounters interface of the associated reference counters object. The method does NOT increment the number of strong references to the returned object.

## Detailed Description

Base interface for all dynamic objects in the engine.

## Member Function Documentation

## ◆ AddRef()

virtual CounterValueType Diligent::IObject::AddRef | ( |  | ) |
| pure virtual

Increments the number of strong references by 1.

Remarks
  This method is equivalent to GetReferenceCounters()->AddStrongRef().
  The method is thread-safe and does not require explicit synchronization.

Returns
  The number of strong references after incrementing the counter.

Note
  In a multithreaded environment, the returned number may not be reliable as other threads may simultaneously change the actual value of the counter.

Implemented in Diligent::ShaderVariableBase.

## ◆ QueryInterface()

virtual void Diligent::IObject::QueryInterface | ( | const Diligent::INTERFACE_ID & | IID,
|  | IObject ** | ppInterface
| ) |  |
| pure virtual

Queries the specific interface.

Parameters

  [in] | IID | - Unique identifier of the requested interface.
  [out] | ppInterface | - Memory address where the pointer to the requested interface will be written. If the interface is not supported, null pointer will be returned.

Remarks
  The method increments the number of strong references by 1. The interface must be released by a call to Release() method when it is no longer needed.

Implemented in Diligent::IDeviceContext, Diligent::IShader, Diligent::ITexture, Diligent::IPipelineState, Diligent::IBuffer, Diligent::ISampler, Diligent::ITextureView, Diligent::ShaderVariableBase, Diligent::ResourceMappingImpl, Diligent::IBufferView, Diligent::IResourceMapping, Diligent::ShaderGLImpl, Diligent::BufferD3D11Impl, Diligent::TextureBaseGL, Diligent::TextureBaseD3D11, Diligent::TextureD3D12Impl, Diligent::BufferGLImpl, Diligent::IRenderDevice, Diligent::BufferD3D12Impl, Diligent::BufferViewGLImpl, Diligent::ShaderD3D11Impl, Diligent::TextureViewD3D11Impl, Diligent::BufferViewD3D12Impl, Diligent::RenderDeviceD3D12Impl, Diligent::TextureViewD3D12Impl, Diligent::BufferViewD3D11Impl, Diligent::PipelineStateD3D12Impl, Diligent::SwapChainD3D12Impl, Diligent::TextureViewGLImpl, Diligent::DeviceContextD3D12Impl, Diligent::BasicFileStream, Diligent::PipelineStateD3D11Impl, Diligent::ShaderResourceBindingD3D11Impl, Diligent::SwapChainD3D11Impl, Diligent::ShaderResourceBindingD3D12Impl, Diligent::PipelineStateGLImpl, Diligent::DeviceContextD3D11Impl, Diligent::SamplerD3D12Impl, Diligent::ShaderResourceBindingGLImpl, Diligent::SamplerD3D11Impl, Diligent::DataBlobImpl, Diligent::SamplerGLImpl, Diligent::SwapChainGLImpl, Diligent::IDeviceObject, Diligent::IShaderResourceBinding, Diligent::RenderDeviceD3D11Impl, Diligent::CommandQueueD3D12Impl, and Diligent::DeviceContextGLImpl.

## ◆ Release()

virtual CounterValueType Diligent::IObject::Release | ( |  | ) |
| pure virtual

Decrements the number of strong references by 1 and destroys the object when the counter reaches zero.

Remarks
  This method is equivalent to GetReferenceCounters()->ReleaseStrongRef().
  The method is thread-safe and does not require explicit synchronization.

Returns
  The number of strong references after decrementing the counter.

Note
  In a multithreaded environment, the returned number may not be reliable as other threads may simultaneously change the actual value of the counter. The only reliable value is 0 as the object is destroyed when the last strong reference is released.

Implemented in Diligent::ShaderVariableBase.