|
| | resource_cache () |
| | Default constructor.
|
| |
| | resource_cache (const allocator_type &allocator) |
| | Constructs an empty cache with a given allocator.
|
| |
| | resource_cache (const loader_type &callable, const allocator_type &allocator=allocator_type{}) |
| | Constructs an empty cache with a given allocator and loader.
|
| |
|
| resource_cache (const resource_cache &)=default |
| | Default copy constructor.
|
| |
| | resource_cache (const resource_cache &other, const allocator_type &allocator) |
| | Allocator-extended copy constructor.
|
| |
|
| resource_cache (resource_cache &&) noexcept=default |
| | Default move constructor.
|
| |
| | resource_cache (resource_cache &&other, const allocator_type &allocator) |
| | Allocator-extended move constructor.
|
| |
|
| ~resource_cache ()=default |
| | Default destructor.
|
| |
| resource_cache & | operator= (const resource_cache &)=default |
| | Default copy assignment operator.
|
| |
| resource_cache & | operator= (resource_cache &&) noexcept=default |
| | Default move assignment operator.
|
| |
| constexpr allocator_type | get_allocator () const noexcept |
| | Returns the associated allocator.
|
| |
| const_iterator | cbegin () const noexcept |
| | Returns an iterator to the beginning.
|
| |
| const_iterator | begin () const noexcept |
| | Returns an iterator to the beginning.
|
| |
| iterator | begin () noexcept |
| | Returns an iterator to the beginning.
|
| |
| const_iterator | cend () const noexcept |
| | Returns an iterator to the end.
|
| |
| const_iterator | end () const noexcept |
| | Returns an iterator to the end.
|
| |
| iterator | end () noexcept |
| | Returns an iterator to the end.
|
| |
| bool | empty () const noexcept |
| | Returns true if a cache contains no resources, false otherwise.
|
| |
| size_type | size () const noexcept |
| | Number of resources managed by a cache.
|
| |
| void | clear () noexcept |
| | Clears a cache.
|
| |
| template<typename... Args> |
| std::pair< iterator, bool > | load (const id_type id, Args &&...args) |
| | Loads a resource, if its identifier does not exist.
|
| |
| template<typename... Args> |
| std::pair< iterator, bool > | force_load (const id_type id, Args &&...args) |
| | Force loads a resource, if its identifier does not exist.
|
| |
| resource< const value_type > | operator[] (const id_type id) const |
| | Returns a handle for a given resource identifier.
|
| |
| resource< value_type > | operator[] (const id_type id) |
| | Returns a handle for a given resource identifier.
|
| |
| bool | contains (const id_type id) const |
| | Checks if a cache contains a given identifier.
|
| |
| iterator | erase (const_iterator pos) |
| | Removes an element from a given position.
|
| |
| iterator | erase (const_iterator first, const_iterator last) |
| | Removes the given elements from a cache.
|
| |
| size_type | erase (const id_type id) |
| | Removes the given elements from a cache.
|
| |
| loader_type | loader () const |
| | Returns the loader used to create resources.
|
| |
template<typename Type, typename = resource_loader<Type>, typename = std::allocator<Type>>
class entt::resource_cache< Type, typename, typename >
Basic cache for resources of any type.
- Template Parameters
-
| Type | Type of resources managed by a cache. |
| Loader | Type of loader used to create the resources. |
| Allocator | Type of allocator used to manage memory and elements. |
Definition at line 12 of file fwd.hpp.
template<typename Type , typename = resource_loader<Type>, typename = std::allocator<Type>>
Returns an iterator to the beginning.
If the cache is empty, the returned iterator will be equal to end().
- Returns
- An iterator to the first instance of the internal cache.
Definition at line 249 of file cache.hpp.
template<typename Type , typename = resource_loader<Type>, typename = std::allocator<Type>>
Returns an iterator to the beginning.
If the cache is empty, the returned iterator will be equal to end().
- Returns
- An iterator to the first instance of the internal cache.
Definition at line 254 of file cache.hpp.
template<typename Type , typename = resource_loader<Type>, typename = std::allocator<Type>>
Returns an iterator to the beginning.
If the cache is empty, the returned iterator will be equal to end().
- Returns
- An iterator to the first instance of the internal cache.
Definition at line 244 of file cache.hpp.
template<typename Type , typename = resource_loader<Type>, typename = std::allocator<Type>>
template<typename... Args>
Force loads a resource, if its identifier does not exist.
Arguments are forwarded directly to the loader and consumed only if the resource doesn't already exist.
- Warning
- If the resource isn't loaded correctly, the returned handle could be invalid and any use of it will result in undefined behavior.
- Template Parameters
-
| Args | Types of arguments to use to load the resource if required. |
- Parameters
-
| id | Unique resource identifier. |
| args | Arguments to use to load the resource if required. |
- Returns
- A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.
Definition at line 329 of file cache.hpp.
template<typename Type , typename = resource_loader<Type>, typename = std::allocator<Type>>
template<typename... Args>
Loads a resource, if its identifier does not exist.
Arguments are forwarded directly to the loader and consumed only if the resource doesn't already exist.
- Warning
- If the resource isn't loaded correctly, the returned handle could be invalid and any use of it will result in undefined behavior.
- Template Parameters
-
| Args | Types of arguments to use to load the resource if required. |
- Parameters
-
| id | Unique resource identifier. |
| args | Arguments to use to load the resource if required. |
- Returns
- A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.
Definition at line 316 of file cache.hpp.