We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c8faca commit 87100fbCopy full SHA for 87100fb
1 file changed
Common/interface/ObjectsRegistry.hpp
@@ -1,4 +1,4 @@
1
-/* Copyright 2023 Diligent Graphics LLC
+/* Copyright 2023-2024 Diligent Graphics LLC
2
3
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -250,6 +250,20 @@ class ObjectsRegistry
250
PurgeUnguarded();
251
}
252
253
+ /// Processes each element in the cache with the specified handler.
254
+ template <typename HandlerType>
255
+ void ProcessElements(HandlerType&& Handler)
256
+ {
257
+ std::lock_guard<std::mutex> Guard{m_CacheMtx};
258
+ for (auto& Entry : m_Cache)
259
260
+ if (auto pObject = Entry.second->Lock())
261
262
+ Handler(Entry.first, *pObject);
263
+ }
264
265
266
+
267
private:
268
class ObjectWrapper
269
{
0 commit comments