Plasma Engine  2.0
Loading...
Searching...
No Matches
plTagSetTemplate< 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 plTagSetTemplate &other) const
 
bool operator!= (const plTagSetTemplate &other) const
 
void Set (const plTag &tag)
 Adds the given tag to the set.
 
void Remove (const plTag &tag)
 Removes the given tag.
 
bool IsSet (const plTag &tag) const
 Returns true, if the given tag is in the set.
 
bool IsAnySet (const plTagSetTemplate &otherSet) const
 Returns true if this tag set contains any tag set in the given other tag set.
 
plUInt32 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 (plStringView sTag)
 Adds the tag with the given name. If the tag does not exist, it will be registered.
 
void RemoveByName (plStringView sTag)
 Removes the given tag. If it doesn't exist, nothing happens.
 
bool IsSetByName (plStringView 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 (plStreamWriter &inout_stream) const
 Writes the tag set state to a stream. Tags itself are serialized as strings.
 
void Load (plStreamReader &inout_stream, plTagRegistry &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 = plDefaultAllocatorWrapper>
class plTagSetTemplate< 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 plTagSet, usage of plTagSetTemplate is only necessary if the allocator needs to be overridden.


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