Go to the documentation of this file.
33 #include <unordered_map>
44 class FixedBlockMemoryAllocator;
56 m_HashTable{
STD_ALLOCATOR_RAW_MEM(HashTableElem, RawMemAllocator,
"Allocator for unordered_map<ResMappingHashKey, RefCntAutoPtr<IDeviceObject>>")}
65 IDeviceObject* pObject,
66 bool bIsUnique)
override final;
71 IDeviceObject*
const* ppObjects,
73 bool bIsUnique)
override final;
80 IDeviceObject** ppResource,
81 Uint32 ArrayIndex)
override final;
87 struct ResMappingHashKey : public HashMapStringKey
89 using TBase = HashMapStringKey;
91 ResMappingHashKey(
const Char* Str,
bool bMakeCopy,
Uint32 ArrInd) noexcept :
92 HashMapStringKey{Str, bMakeCopy},
95 Ownership_Hash = (
ComputeHash(GetHash(), ArrInd) & HashMask) | (Ownership_Hash & StrOwnershipMask);
98 ResMappingHashKey(ResMappingHashKey&& rhs) noexcept :
99 HashMapStringKey{std::move(rhs)},
100 ArrayIndex{rhs.ArrayIndex}
104 ResMappingHashKey (
const ResMappingHashKey& ) =
delete;
105 ResMappingHashKey& operator = (
const ResMappingHashKey& ) =
delete;
106 ResMappingHashKey& operator = ( ResMappingHashKey&& ) =
delete;
109 bool operator==(
const ResMappingHashKey& RHS)
const
111 if (ArrayIndex != RHS.ArrayIndex)
120 return static_cast<const TBase&
>(*this) ==
static_cast<const TBase&
>(RHS);
130 using HashTableElem = std::pair<const ResMappingHashKey, RefCntAutoPtr<IDeviceObject>>;
131 std::unordered_map<ResMappingHashKey,
132 RefCntAutoPtr<IDeviceObject>,
133 ResMappingHashKey::Hasher,
134 std::equal_to<ResMappingHashKey>,
135 STDAllocatorRawMem<HashTableElem>>
Base interface for a reference counter object that stores the number of strong and weak references an...
Definition: ReferenceCounters.h:44
virtual void RemoveResourceByName(const Char *Name, Uint32 ArrayIndex) override final
Implementation of IResourceMapping::RemoveResourceByName()
Definition: ResourceMappingBase.cpp:76
virtual void GetResource(const Char *Name, IDeviceObject **ppResource, Uint32 ArrayIndex) override final
Implementation of IResourceMapping::GetResource()
Definition: ResourceMappingBase.cpp:87
char Char
Definition: BasicTypes.h:64
ResourceMappingImpl(IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator)
Definition: ResourceMappingImpl.hpp:54
bool operator==(const Plane3D &p1, const Plane3D &p2)
Definition: AdvancedMath.hpp:442
virtual void AddResourceArray(const Char *Name, Uint32 StartIndex, IDeviceObject *const *ppObjects, Uint32 NumElements, bool bIsUnique) override final
Implementation of IResourceMapping::AddResourceArray()
Definition: ResourceMappingBase.cpp:43
Template class implementing base functionality for an object.
Definition: ObjectBase.hpp:66
#define IMPLEMENT_QUERY_INTERFACE_IN_PLACE(InterfaceID, ParentClassName)
Definition: ObjectBase.hpp:59
virtual void AddResource(const Char *Name, IDeviceObject *pObject, bool bIsUnique) override final
Implementation of IResourceMapping::AddResource()
Definition: ResourceMappingBase.cpp:71
#define DILIGENT_CALL_TYPE
Definition: CommonDefinitions.h:45
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
std::size_t ComputeHash(const ArgsType &... Args)
Definition: HashUtils.hpp:57
Base interface for a raw memory allocator.
Definition: MemoryAllocator.h:41
#define STD_ALLOCATOR_RAW_MEM(Type, Allocator, Description)
Definition: STDAllocator.hpp:179
~ResourceMappingImpl()
Definition: ResourceMappingBase.cpp:34
ObjectBase< IResourceMapping > TObjectBase
Definition: ResourceMappingImpl.hpp:50
Implementation of the resource mapping.
Definition: ResourceMappingImpl.hpp:47
virtual size_t GetSize() override final
Returns number of resources in the resource mapping.
Definition: ResourceMappingBase.cpp:113
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37