29 #include "ResourceMapping.h" 30 #include "ObjectBase.h" 31 #include <unordered_map> 32 #include "HashUtils.h" 33 #include "STDAllocator.h" 37 struct ResMappingHashKey
39 ResMappingHashKey(
const Char* Str,
bool bMakeCopy, Uint32 ArrInd):
40 StrKey(Str, bMakeCopy),
45 ResMappingHashKey(ResMappingHashKey &&rhs) :
46 StrKey(
std::move(rhs.StrKey)),
47 ArrayIndex(rhs.ArrayIndex)
50 bool operator == (
const ResMappingHashKey& RHS)
const 52 return StrKey == RHS.StrKey && ArrayIndex == RHS.ArrayIndex;
59 Hash = ComputeHash( StrKey, ArrayIndex );
66 ResMappingHashKey(
const ResMappingHashKey& ) =
delete;
67 ResMappingHashKey& operator = (
const ResMappingHashKey& ) =
delete;
68 ResMappingHashKey& operator = ( ResMappingHashKey&& ) =
delete;
70 HashMapStringKey StrKey;
72 mutable size_t Hash = 0;
79 struct hash<
Diligent::ResMappingHashKey>
81 size_t operator()(
const Diligent::ResMappingHashKey &Key )
const 90 class FixedBlockMemoryAllocator;
102 m_HashTable(STD_ALLOCATOR_RAW_MEM(HashTableElem, RawMemAllocator,
"Allocator for unordered_map< ResMappingHashKey, RefCntAutoPtr<IDeviceObject> >") )
107 virtual void QueryInterface(
const Diligent::INTERFACE_ID &IID, IObject **ppInterface )
override final;
113 virtual void AddResourceArray(
const Char *Name, Uint32 StartIndex,
IDeviceObject *
const* ppObjects, Uint32 NumElements,
bool bIsUnique )
override final;
122 virtual size_t GetSize()override final;
130 std::unordered_map< ResMappingHashKey,
RefCntAutoPtr<
IDeviceObject>,
std::hash<ResMappingHashKey>,
std::equal_to<ResMappingHashKey>, STDAllocatorRawMem<HashTableElem> > m_HashTable;
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:40
Template class implementing base functionality for an object.
Definition: ObjectBase.h:62
Namespace for the OpenGL implementation of the graphics engine.
Definition: BufferD3D11Impl.h:34
Definition: AdvancedMath.h:316
ResourceMappingImpl(IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator)
Definition: ResourceMappingImpl.h:100
virtual void QueryInterface(const Diligent::INTERFACE_ID &IID, IObject **ppInterface) override final
Queries the specific interface, see IObject::QueryInterface() for details.
virtual size_t GetSize() override final
Returns number of resources in the resource mapping.
Definition: ResourceMapping.cpp:117
virtual void RemoveResourceByName(const Char *Name, Uint32 ArrayIndex) override final
Implementation of IResourceMapping::RemoveResourceByName()
Definition: ResourceMapping.cpp:80
virtual void AddResource(const Char *Name, IDeviceObject *pObject, bool bIsUnique) override final
Implementation of IResourceMapping::AddResource()
Definition: ResourceMapping.cpp:75
Template class that implements reference counting.
Definition: RefCntAutoPtr.h:71
virtual void GetResource(const Char *Name, IDeviceObject **ppResource, Uint32 ArrayIndex) override final
Implementation of IResourceMapping::GetResource()
Definition: ResourceMapping.cpp:91
Implementation of the resource mapping.
Definition: ResourceMappingImpl.h:93
virtual void AddResourceArray(const Char *Name, Uint32 StartIndex, IDeviceObject *const *ppObjects, Uint32 NumElements, bool bIsUnique) override final
Implementation of IResourceMapping::AddResourceArray()
Definition: ResourceMapping.cpp:43