Unravel Engine C++ Reference
|
Manages storage and loading of assets of a specific type. More...
#include <asset_storage.h>
Public Types | |
using | request_container_t = std::unordered_map<std::string, asset_handle<T>> |
Container for asset requests. | |
template<typename F > | |
using | callable = std::function<F> |
Type alias for callable functions. | |
using | load_from_file_t = callable<bool(tpp::thread_pool& pool, asset_handle<T>&, const std::string&)> |
Function type for loading from file. | |
using | predicate_t = callable<bool(const asset_handle<T>&)> |
Function type for loading from instance. Predicate function type. | |
using | load_from_instance_t = callable<bool(tpp::thread_pool& pool, asset_handle<T>&, std::shared_ptr<T>)> |
Public Member Functions | |
~asset_storage () override=default | |
void | unload_handle (tpp::thread_pool &pool, asset_handle< T > &handle) |
Unloads a handle. | |
void | unload_with_condition (tpp::thread_pool &pool, const predicate_t &predicate) |
Unloads assets that satisfy a condition. | |
void | unload_all (tpp::thread_pool &pool) final |
Unloads all assets. | |
void | unload_group (tpp::thread_pool &pool, const std::string &group) final |
Unloads all assets in a specified group. | |
void | unload_single (tpp::thread_pool &pool, const std::string &key) final |
Unloads a single asset by its key. | |
auto | get_with_condition (const predicate_t &predicate) const -> std::vector< asset_handle< T > > |
Gets assets that satisfy a condition. | |
auto | get_group (const std::string &group) const -> std::vector< asset_handle< T > > |
Gets all assets in a specified group. | |
![]() | |
virtual | ~basic_storage ()=default |
Public Attributes | |
load_from_file_t | load_from_file |
Function for loading assets from file. | |
load_from_instance_t | load_from_instance |
Function for loading assets from instance. | |
request_container_t | container |
Container for asset requests. | |
std::recursive_mutex | container_mutex |
Mutex for container operations. | |
Manages storage and loading of assets of a specific type.
T | The type of the assets. |
Definition at line 353 of file asset_storage.h.
using unravel::asset_storage< T >::callable = std::function<F> |
Type alias for callable functions.
Definition at line 359 of file asset_storage.h.
using unravel::asset_storage< T >::load_from_file_t = callable<bool(tpp::thread_pool& pool, asset_handle<T>&, const std::string&)> |
Function type for loading from file.
Definition at line 362 of file asset_storage.h.
using unravel::asset_storage< T >::load_from_instance_t = callable<bool(tpp::thread_pool& pool, asset_handle<T>&, std::shared_ptr<T>)> |
Definition at line 366 of file asset_storage.h.
using unravel::asset_storage< T >::predicate_t = callable<bool(const asset_handle<T>&)> |
Function type for loading from instance. Predicate function type.
Definition at line 365 of file asset_storage.h.
using unravel::asset_storage< T >::request_container_t = std::unordered_map<std::string, asset_handle<T>> |
Container for asset requests.
Definition at line 356 of file asset_storage.h.
|
overridedefault |
|
inline |
Gets all assets in a specified group.
group | The group to get assets from. |
Definition at line 476 of file asset_storage.h.
|
inline |
Gets assets that satisfy a condition.
predicate | The predicate function to determine which assets to get. |
Definition at line 453 of file asset_storage.h.
|
inlinefinalvirtual |
Unloads all assets.
pool | The thread pool for unloading tasks. |
Implements unravel::basic_storage.
Definition at line 408 of file asset_storage.h.
|
inlinefinalvirtual |
Unloads all assets in a specified group.
pool | The thread pool for unloading tasks. |
group | The group to unload. |
Implements unravel::basic_storage.
Definition at line 422 of file asset_storage.h.
|
inline |
Unloads a handle.
pool | The thread pool for unloading tasks. |
handle | The handle to unload. |
Definition at line 375 of file asset_storage.h.
|
inlinefinalvirtual |
Unloads a single asset by its key.
pool | The thread pool for unloading tasks. |
key | The key of the asset to unload. |
Implements unravel::basic_storage.
Definition at line 438 of file asset_storage.h.
|
inline |
Unloads assets that satisfy a condition.
pool | The thread pool for unloading tasks. |
predicate | The predicate function to determine which assets to unload. |
Definition at line 386 of file asset_storage.h.
request_container_t unravel::asset_storage< T >::container |
Container for asset requests.
Definition at line 492 of file asset_storage.h.
|
mutable |
Mutex for container operations.
Definition at line 494 of file asset_storage.h.
load_from_file_t unravel::asset_storage< T >::load_from_file |
Function for loading assets from file.
Definition at line 488 of file asset_storage.h.
load_from_instance_t unravel::asset_storage< T >::load_from_instance |
Function for loading assets from instance.
Definition at line 490 of file asset_storage.h.