JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
JPL::IDType< Tag, InternalType, Atomic > Struct Template Reference

#include <JPLSpatial/Utilities/IDType.h>

Public Types

using TagType = Tag
 
using CounterType = std::conditional_t< Atomic, std::atomic< InternalType >, InternalType >
 

Public Member Functions

constexpr IDType ()=default
 
constexpr bool IsValid () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr bool operator== (const IDType other) const noexcept
 
constexpr bool operator!= (const IDType other) const noexcept
 

Static Public Member Functions

static constexpr IDType New () noexcept
 

Friends

struct std::hash< JPL::IDType< Tag, InternalType > >
 

Detailed Description

template<typename Tag, std::integral InternalType = uint32_t, bool Atomic = false>
struct JPL::IDType< Tag, InternalType, Atomic >

Simple utility, wrapping incrementing counter to generate strongly typed runtime identifiers.

It is not serializable and is meant to be use for runtime tracking only.

If template parameter 'Atomic' is set to 'true', makes the internal static counter type atomic to make sure IDs can be safely generated from multiple threads.

Member Typedef Documentation

◆ CounterType

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
using JPL::IDType< Tag, InternalType, Atomic >::CounterType = std::conditional_t<Atomic, std::atomic<InternalType>, InternalType>

◆ TagType

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
using JPL::IDType< Tag, InternalType, Atomic >::TagType = Tag

Constructor & Destructor Documentation

◆ IDType()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
constexpr JPL::IDType< Tag, InternalType, Atomic >::IDType ( )
constexprdefault

Member Function Documentation

◆ IsValid()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
constexpr bool JPL::IDType< Tag, InternalType, Atomic >::IsValid ( ) const
inlineconstexprnoexcept

◆ New()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
static constexpr IDType JPL::IDType< Tag, InternalType, Atomic >::New ( )
inlinestaticconstexprnoexcept

◆ operator bool()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
constexpr JPL::IDType< Tag, InternalType, Atomic >::operator bool ( ) const
inlineconstexprnoexcept

◆ operator!=()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
constexpr bool JPL::IDType< Tag, InternalType, Atomic >::operator!= ( const IDType< Tag, InternalType, Atomic other) const
inlineconstexprnoexcept

◆ operator==()

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
constexpr bool JPL::IDType< Tag, InternalType, Atomic >::operator== ( const IDType< Tag, InternalType, Atomic other) const
inlineconstexprnoexcept

Friends And Related Symbol Documentation

◆ std::hash< JPL::IDType< Tag, InternalType > >

template<typename Tag , std::integral InternalType = uint32_t, bool Atomic = false>
friend struct std::hash< JPL::IDType< Tag, InternalType > >
friend

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