3#include <EditorEngineProcessFramework/EditorEngineProcessFrameworkDLL.h>
5template <
typename HandleType>
11 m_GuidToHandle.
Clear();
12 m_HandleToGuid.
Clear();
15 void RegisterObject(
plUuid guid, HandleType handle)
17 auto it = m_GuidToHandle.
Find(guid);
21 UnregisterObject(guid);
23 m_GuidToHandle[guid] = handle;
24 m_HandleToGuid[handle] = guid;
26 PL_ASSERT_DEV(m_GuidToHandle.
GetCount() == m_HandleToGuid.
GetCount(),
"1:1 relationship is broken. Check operator< for handle type.");
29 void UnregisterObject(
plUuid guid)
31 const HandleType handle = m_GuidToHandle[guid];
32 m_GuidToHandle.
Remove(guid);
33 m_HandleToGuid.
Remove(handle);
35 PL_ASSERT_DEV(m_GuidToHandle.
GetCount() == m_HandleToGuid.
GetCount(),
"1:1 relationship is broken. Check operator< for handle type.");
38 void UnregisterObject(HandleType handle)
40 const plUuid guid = m_HandleToGuid[handle];
41 m_GuidToHandle.
Remove(guid);
42 m_HandleToGuid.
Remove(handle);
44 PL_ASSERT_DEV(m_GuidToHandle.
GetCount() == m_HandleToGuid.
GetCount(),
"1:1 relationship is broken. Check operator< for handle type.");
47 HandleType GetHandle(
plUuid guid)
const
49 HandleType res = HandleType();
Definition GuidHandleMap.h:7
plUInt32 GetCount() const
Returns the number of active entries in the table.
Definition HashTable_inl.h:343
bool TryGetValue(const CompatibleKeyType &key, ValueType &out_value) const
Returns whether an entry with the given key was found and if found writes out the corresponding value...
ConstIterator Find(const CompatibleKeyType &key) const
Searches for key, returns a plHashTableBaseConstIterator to it or an invalid iterator,...
Definition HashTable_inl.h:528
void Clear()
Clears the table.
Definition HashTable_inl.h:355
bool Remove(const CompatibleKeyType &key, ValueType *out_pOldValue=nullptr)
Removes the entry with the given key. Returns whether an entry was removed and optionally writes out ...
Definition HashTable.h:333
void Clear()
Destroys all elements in the map and resets its size to zero.
Definition Map_inl.h:175
bool Remove(const CompatibleKeyType &key)
Erases the key/value pair with the given key, if it exists. O(log n) operation.
Definition Map_inl.h:545
plUInt32 GetCount() const
Returns the number of elements currently stored in the map. O(1) operation.
Definition Map_inl.h:200
const ValueType & GetValueOrDefault(const CompatibleKeyType &key, const ValueType &defaultValue) const
Either returns the value of the entry with the given key, if found, or the provided default value.
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11