XII Release 0.1.0
Loading...
Searching...
No Matches
xiiTagSetTemplate< 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 xiiTagSetTemplate &other) const
 
void Set (const xiiTag &tag)
 Adds the given tag to the set.
 
void Remove (const xiiTag &tag)
 Removes the given tag.
 
bool IsSet (const xiiTag &tag) const
 Returns true, if the given tag is in the set.
 
bool IsAnySet (const xiiTagSetTemplate &otherSet) const
 Returns true if this tag set contains any tag set in the given other tag set.
 
xiiUInt32 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 (xiiStringView sTag)
 Adds the tag with the given name. If the tag does not exist, it will be registered.
 
void RemoveByName (xiiStringView sTag)
 Removes the given tag. If it doesn't exist, nothing happens.
 
bool IsSetByName (xiiStringView sTag) const
 Checks whether the named tag is part of this set. Returns false if the tag does not exist.
 
bool IsSetByName (const xiiTempHashedString &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 (xiiStreamWriter &ref_stream) const
 Writes the tag set state to a stream. Tags itself are serialized as strings.
 
void Load (xiiStreamReader &ref_stream, xiiTagRegistry &ref_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 = xiiDefaultAllocatorWrapper>
class xiiTagSetTemplate< 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 xiiTagSet, usage of xiiTagSetTemplate is only necessary if the allocator needs to be overridden.


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