Load a resource by path. When we need a resource, we call this API. Load if resource is not found.
121 {
123
124 {
125 std::unique_lock<std::shared_mutex> lock(
m_Mutex);
126
128 {
129 std::function<std::any()> fn = [&]() -> std::any {
130 T*
inst =
new Ty(std::forward<Args>(args)...);
131 return std::shared_ptr<T>(
inst);
132 };
133
134 m_Resources[path] = std::make_unique<Resource>(fn);
135 }
136
137 }
138
140 }
#define SPICES_PROFILE_ZONE
static std::unordered_map< std::string, std::unique_ptr< Resource > > m_Resources
Static variable stores all specific resources in a basic type Pool.
static std::shared_mutex m_Mutex
Mutex for this pool.
Spices::ClassTraitsTest inst