6#include <unordered_map>
28std::unordered_map<std::string, Slot>&
slots() {
29 static std::unordered_map<std::string, Slot>
table;
41 if (!
name)
return nullptr;
42 auto& table =
slots();
43 auto it = table.find(
name);
44 return it == table.end() ? nullptr : it->second.service;
49 auto& table =
slots();
50 auto it = table.find(
name);
53 if (it != table.end() && it->second.service ==
impl) it->second.service =
nullptr;
59 for (
const auto& l : list)
60 if (l.impl ==
impl)
return;
63 std::stable_sort(list.begin(), list.end(),
64 [](
const Listener&
a,
const Listener&
b) { return a.priority < b.priority; });
69 auto& table =
slots();
70 auto it = table.find(
name);
71 if (it == table.end())
return;
72 auto& list = it->second.listeners;
73 list.erase(std::remove_if(list.begin(), list.end(),
74 [
impl](
const Listener& l) { return l.impl == impl; }),
80 auto& table =
slots();
81 auto it = table.find(
name);
82 return it == table.end() ? 0 : it->second.listeners.size();
86 if (!
name)
return nullptr;
87 auto& table =
slots();
88 auto it = table.find(
name);
89 if (it == table.end() ||
index >= it->second.listeners.size())
return nullptr;
90 return it->second.listeners[
index].impl;
105void (*gVulkanWarmup)() =
nullptr;
112 if (gVulkanWarmup) gVulkanWarmup();
std::vector< Listener > listeners
LocalPageCacheEntry slots[ShadowConfig::kLocalSlots]
EVENGINE_API_FOUNDATION void registerVulkanInstanceWarmup(void(*start)())
Register the graphics-backend function that starts VkInstance creation.
EVENGINE_API_FOUNDATION void startVulkanInstanceWarmup()
Kick off asynchronous VkInstance creation if a backend registered.
size_t listenerCountRaw(const char *name)
Listener count raw.
void addListenerRaw(const char *name, void *impl, int priority)
Adds listener raw.
void provideRaw(const char *name, void *impl)
Provides raw.
void removeListenerRaw(const char *name, void *impl)
Removes listener raw.
void * queryRaw(const char *name)
Queries raw.
void revokeRaw(const char *name, void *impl)
Revoke raw.
void clearAllRaw()
Clears all raw.
void * listenerAtRaw(const char *name, size_t index)
Listener at raw.
std::unordered_map< std::string, SkillDefinition > & table()