Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RHI::TagRegistry< IndexType, MaxTagCount > Class Template Referencefinal

#include <TagRegistry.h>

Inherits AZStd::intrusive_base.

Public Types

using TagType = Handle< IndexType >
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (TagRegistry, AZ::SystemAllocator)
 
 AZ_DISABLE_COPY_MOVE (TagRegistry)
 
void Reset ()
 Resets the registry back to an empty state. All references are released.
 
TagType AcquireTag (const Name &tagName)
 
void ReleaseTag (TagType tagName)
 
TagType FindTag (const Name &tagName) const
 
Name GetName (TagType tag) const
 Returns the name of the given tag, or empty string if the tag is not registered.
 
size_t GetAllocatedTagCount () const
 Returns the number of allocated tags in the registry.
 
template<class TagVisitor >
void VisitTags (TagVisitor visitor)
 

Static Public Member Functions

static Ptr< TagRegistryCreate ()
 

Friends

template<typename >
class TagBitRegistry
 

Detailed Description

template<typename IndexType, size_t MaxTagCount>
class AZ::RHI::TagRegistry< IndexType, MaxTagCount >

Allocates and registers tags by name, allowing the user to acquire and find tags from names. The class is designed to map user-friendly tag names defined through content or higher level code to low-level tags, which are simple handles.

Some notes about usage and design:

  • TagType need to be a Handle<Integer> type.
  • Tags are reference counted, which means multiple calls to 'Acquire' with the same name will increment the internal reference count on the tag. This allows shared ownership between systems, if necessary.
  • FindTag is provided to search for a tag reference without taking ownership.
  • Names are case sensitive.

Member Function Documentation

◆ AcquireTag()

template<typename IndexType , size_t MaxTagCount>
auto AZ::RHI::TagRegistry< IndexType, MaxTagCount >::AcquireTag ( const Name &  tagName)

Acquires a tag from the provided name (case sensitive). If the tag already existed, it is ref-counted. Returns a valid tag on success; returns a null tag if the registry is at full capacity. You must call ReleaseTag() if successful.

◆ FindTag()

template<typename IndexType , size_t MaxTagCount>
auto AZ::RHI::TagRegistry< IndexType, MaxTagCount >::FindTag ( const Name &  tagName) const

Finds the tag associated with the provided name (case sensitive). If a tag exists with that name, the tag is returned. The reference count is NOT incremented on success; ownership is not passed to the user. If the tag does not exist, a null tag is returned.

◆ ReleaseTag()

template<typename IndexType , size_t MaxTagCount>
void AZ::RHI::TagRegistry< IndexType, MaxTagCount >::ReleaseTag ( TagType  tagName)

Releases a reference to a tag. Tags are ref-counted, so it's necessary to maintain ownership of the tag and release when its no longer needed.


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