Cogs.Core
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Cogs::Handle_t< Type, Convertible > Struct Template Reference

Handle template class used to provide opaque, non-converting handles. More...

#include <Common.h>

Public Types

typedef int64_t handle_type
 Internal handle storage type.
 

Public Member Functions

 Handle_t ()
 Construct a handle.
 
 Handle_t (const Handle_t &other)
 Copy constructor.
 
 Handle_t (const handle_type &handle)
 Construct a handle with an explicit internal resource handle.
 
 Handle_t (const Convertible &other)
 Conversion constructor from Convertible type.
 
Handle_toperator= (const Handle_t &other)
 Assignment operator.
 
bool operator== (const Handle_t &other) const
 Equality operator.
 
 operator bool () const
 Boolean conversion operator.
 
 operator Convertible ()
 Conversion operator to automatically convert handle instances to the template Convertible type.
 

Public Attributes

handle_type handle
 Internal resource handle.
 

Static Public Attributes

static const Handle_t NoHandle = Handle_t<T, U>(0)
 Represents a handle to nothing.
 
static const Handle_t InvalidHandle = Handle_t<T, U>(-1)
 Represents an invalid handle.
 

Detailed Description

template<typename Type, typename Convertible = NoConversion>
struct Cogs::Handle_t< Type, Convertible >

Handle template class used to provide opaque, non-converting handles.

Definition at line 21 of file Common.h.

Member Typedef Documentation

◆ handle_type

template<typename Type , typename Convertible = NoConversion>
typedef int64_t Cogs::Handle_t< Type, Convertible >::handle_type

Internal handle storage type.

Definition at line 24 of file Common.h.

Constructor & Destructor Documentation

◆ Handle_t() [1/4]

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::Handle_t ( )
inline

Construct a handle.

The handle is default initialized to Handle_t::InvalidHandle.

Definition at line 29 of file Common.h.

◆ Handle_t() [2/4]

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::Handle_t ( const Handle_t< Type, Convertible > &  other)
inline

Copy constructor.

The handle constructed from will still be valid after the copy.

Definition at line 34 of file Common.h.

◆ Handle_t() [3/4]

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::Handle_t ( const handle_type handle)
inlineexplicit

Construct a handle with an explicit internal resource handle.

Parameters
handleA 64-bit resource handle.

Definition at line 41 of file Common.h.

◆ Handle_t() [4/4]

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::Handle_t ( const Convertible &  other)
inline

Conversion constructor from Convertible type.

Parameters
otherAn instance of the Convertible type. The internal resource handle is copied from this instance.

Definition at line 48 of file Common.h.

Member Function Documentation

◆ operator bool()

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::operator bool ( ) const
inlineexplicit

Boolean conversion operator.

Definition at line 64 of file Common.h.

References Cogs::Handle_t< Type, Convertible >::handle.

◆ operator Convertible()

template<typename Type , typename Convertible = NoConversion>
Cogs::Handle_t< Type, Convertible >::operator Convertible ( )
inline

Conversion operator to automatically convert handle instances to the template Convertible type.

Returns
A Convertible instance holding the same internal handle as this instance.

Definition at line 71 of file Common.h.

◆ operator=()

template<typename Type , typename Convertible = NoConversion>
Handle_t & Cogs::Handle_t< Type, Convertible >::operator= ( const Handle_t< Type, Convertible > &  other)
inline

Assignment operator.

Definition at line 53 of file Common.h.

References Cogs::Handle_t< Type, Convertible >::handle.

◆ operator==()

template<typename Type , typename Convertible = NoConversion>
bool Cogs::Handle_t< Type, Convertible >::operator== ( const Handle_t< Type, Convertible > &  other) const
inline

Equality operator.

Parameters
otherAnother handle instance.
Returns
true if the internal handles of this and other are equal.

Definition at line 61 of file Common.h.

References Cogs::Handle_t< Type, Convertible >::handle.

Member Data Documentation

◆ handle

template<typename Type , typename Convertible = NoConversion>
handle_type Cogs::Handle_t< Type, Convertible >::handle

Internal resource handle.

Definition at line 74 of file Common.h.

Referenced by Cogs::BuffersD3D11::annotate(), Cogs::EffectsWebGPU::getBufferBinding(), Cogs::BuffersNull::getNativeHandle(), Cogs::TexturesNull::getNativeHandle(), Cogs::EffectsWebGPU::getSamplerStateBinding(), Cogs::EffectsWebGPU::getTextureBinding(), Cogs::Handle_t< Type, Convertible >::operator bool(), Cogs::Handle_t< BufferTag, BufferHandle >::operator BufferHandle(), Cogs::Handle_t< Type, Convertible >::operator=(), Cogs::Handle_t< Type, Convertible >::operator==(), Cogs::RenderTargetsNull::releaseBlendState(), Cogs::RenderTargetsWebGPU::releaseBlendState(), Cogs::BuffersNull::releaseBuffer(), Cogs::RenderTargetsNull::releaseDepthStencilState(), Cogs::RenderTargetsWebGPU::releaseDepthStencilState(), Cogs::RenderTargetsNull::releaseDepthStencilTarget(), Cogs::EffectsNull::releaseEffect(), Cogs::BuffersNull::releaseIndexBuffer(), Cogs::RenderTargetsNull::releaseRasterizerState(), Cogs::RenderTargetsWebGPU::releaseRasterizerState(), Cogs::RenderTargetsNull::releaseRenderTarget(), Cogs::TexturesGL20::releaseSamplerState(), Cogs::TexturesNull::releaseSamplerState(), Cogs::TexturesNull::releaseTexture(), Cogs::TexturesGL20::releaseTextureView(), Cogs::TexturesNull::releaseTextureView(), Cogs::BuffersNull::releaseVertexBuffer(), Cogs::ContextGL20::setBuffer(), Cogs::ContextD3D11::setConstantBuffer(), Cogs::ContextD3D12::setConstantBuffer(), Cogs::ContextGL20::setConstantBuffer(), Cogs::ContextGLES30::setConstantBuffer(), Cogs::ContextVK::setConstantBuffer(), Cogs::ContextWebGPU::setConstantBuffer(), Cogs::ContextGLES30::setEffect(), Cogs::ContextGLES30::setIndexBuffer(), Cogs::ContextWebGPU::setIndexBuffer(), Cogs::ContextGLES30::setMatrixVariable(), Cogs::ContextD3D11::setSamplerState(), Cogs::ContextD3D12::setSamplerState(), Cogs::ContextGL20::setSamplerState(), Cogs::ContextGLES30::setSamplerState(), Cogs::ContextVK::setSamplerState(), Cogs::ContextWebGPU::setSamplerState(), Cogs::ContextGLES30::setScalarVariable(), Cogs::ContextD3D11::setTexture(), Cogs::ContextGLES30::setTexture(), Cogs::ContextD3D12::setTexture(), Cogs::ContextGL20::setTexture(), Cogs::ContextVK::setTexture(), Cogs::ContextWebGPU::setTexture(), Cogs::ContextCommon::setVariable(), Cogs::ContextGLES30::setVector2Variable(), Cogs::ContextGLES30::setVector3Variable(), and Cogs::ContextGLES30::setVector4Variable().

◆ InvalidHandle

template<typename T , typename U >
const Handle_t< T, U > Cogs::Handle_t< T, U >::InvalidHandle = Handle_t<T, U>(-1)
static

Represents an invalid handle.

Definition at line 80 of file Common.h.

Referenced by Cogs::EffectsGL20::getBufferBinding().

◆ NoHandle

template<typename T , typename U >
const Handle_t< T, U > Cogs::Handle_t< T, U >::NoHandle = Handle_t<T, U>(0)
static

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