ezEngine  Release 25.03
ezTagSetTemplate< BlockStorageAllocator > Class Template Reference

A dynamic collection of tags featuring fast lookups. More...

#include <TagSet.h>

Classes

class  Iterator
 Allows to iterate over all tags in this set. More...
 

Public Member Functions

bool operator== (const ezTagSetTemplate &other) const
 
bool operator!= (const ezTagSetTemplate &other) const
 
void Set (const ezTag &tag)
 Adds the given tag to the set.
 
void Remove (const ezTag &tag)
 Removes the given tag.
 
bool IsSet (const ezTag &tag) const
 Returns true, if the given tag is in the set.
 
bool IsAnySet (const ezTagSetTemplate &otherSet) const
 Returns true if this tag set contains any tag set in the given other tag set.
 
ezUInt32 GetNumTagsSet () const
 Returns how many tags are in this set.
 
bool IsEmpty () const
 True if the tag set never contained any tag or was cleared.
 
void Clear ()
 Removes all tags from the set.
 
void SetByName (ezStringView sTag)
 Adds the tag with the given name. If the tag does not exist, it will be registered.
 
void RemoveByName (ezStringView sTag)
 Removes the given tag. If it doesn't exist, nothing happens.
 
bool IsSetByName (ezStringView sTag) const
 Checks whether the named tag is part of this set. Returns false if the tag does not exist.
 
bool IsSetByName (const ezTempHashedString &sTag) const
 Checks whether the named tag is part of this set. Returns false if the tag does not exist.
 
Iterator GetIterator () const
 Returns an iterator to list all tags in this set.
 
void Save (ezStreamWriter &inout_stream) const
 Writes the tag set state to a stream. Tags itself are serialized as strings.
 
void Load (ezStreamReader &inout_stream, ezTagRegistry &inout_registry)
 Reads the tag set state from a stream and registers the tags with the given registry.
 

Friends

class Iterator
 

Detailed Description

template<typename BlockStorageAllocator = ezDefaultAllocatorWrapper>
class ezTagSetTemplate< BlockStorageAllocator >

A dynamic collection of tags featuring fast lookups.

This class can be used to store a (dynamic) collection of tags. Tags are registered within the global tag registry and allocated a bit index. The tag set allows comparatively fast lookups to check if a given tag is in the set or not. Adding a tag may have some overhead depending whether the block storage for the tag bit indices needs to be expanded or not (if the storage needs to be expanded the hybrid array will be resized). Typical storage requirements for a given tag set instance should be small since the block storage is a sliding window. The standard class which can be used is ezTagSet, usage of ezTagSetTemplate is only necessary if the allocator needs to be overridden.


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