Plasma Engine  2.0
Loading...
Searching...
No Matches
TagRegistry.h
1
2#pragma once
3
6class plTag;
9
10#include <Foundation/Containers/Map.h>
11#include <Foundation/Threading/Mutex.h>
12
21class PL_FOUNDATION_DLL plTagRegistry
22{
23public:
25
26 static plTagRegistry& GetGlobalRegistry();
27
29 const plTag& RegisterTag(plStringView sTagString); // [tested]
30
32 const plTag& RegisterTag(const plHashedString& sTagString); // [tested]
33
35 const plTag* GetTagByName(const plTempHashedString& sTagString) const; // [tested]
36
38 const plTag* GetTagByMurmurHash(plUInt32 uiMurmurHash) const;
39
41 const plTag* GetTagByIndex(plUInt32 uiIndex) const;
42
44 plUInt32 GetNumTags() const;
45
48 plResult Load(plStreamReader& inout_stream);
49
50protected:
51 mutable plMutex m_TagRegistryMutex;
52
53 plMap<plTempHashedString, plTag> m_RegisteredTags;
54 plDeque<plTag*> m_TagsByIndex;
55};
Definition Deque.h:270
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
Definition Map.h:408
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
The tag class stores the necessary lookup information for a single tag which can be used in conjuncti...
Definition Tag.h:16
The tag registry for tags in tag sets.
Definition TagRegistry.h:22
A class to use together with plHashedString for quick comparisons with temporary strings that need no...
Definition HashedString.h:151
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54