|
| ResourceMapBase ()=default |
| Initialize a new, empty resource map.
|
|
| ResourceMapBase (size_t capacity, size_t pageSize, Memory::Allocator *allocator) |
| Initialize the resource map with the given allocator.
|
|
HandleType | addResource (const ResourceType &resource, bool persistent=false) |
| Add a new resource to the map.
|
|
HandleType | addResource (ResourceType &&resource, bool persistent=false) |
| Add a new resource to the map.
|
|
void | removeResource (HandleType handle) |
| Remove the resource with the given handle.
|
|
bool | hasResource (HandleType handle) |
| Check if the resource with the given handle exists in the map.
|
|
size_t | size () const |
| Get the number or resources in the resource map.
|
|
StoragePolicy::iterator | begin () |
| Gets an iterator to the beginning of the resource map.
|
|
StoragePolicy::iterator | end () |
| Gets an iterator to the end of the resource map.
|
|
void | clear () |
| Clear out the resources in the map.
|
|
const ResourceType & | operator[] (const HandleType handle) const |
| Get a const reference to the resource with the given handle.
|
|
ResourceType & | operator[] (const HandleType handle) |
| Get a reference to the resource with the given handle.
|
|
HandleType | getHandle (const ResourceType &r) |
| Gets a handle to the resource given.
|
|
void | pin (const HandleType handle) |
| Pin the resource with the given handle, preventing it from being cleared from the resource map automatically.
|
|
bool | pinned (const HandleType &handle) const |
| Gets if the given resource handle is pinned.
|
|
template<typename HandleType, typename ResourceType, typename StoragePolicy, typename LockingPolicy, typename VerificationPolicy>
class Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >
Definition at line 8 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
HandleType Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::addResource |
( |
const ResourceType & |
resource, |
|
|
bool |
persistent = false |
|
) |
| |
|
inline |
Add a new resource to the map.
- Parameters
-
resource | A resource instance to add to the map. |
persistent | If the resource should persist through removal. |
- Returns
- A handle to the added resource.
Definition at line 35 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
HandleType Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::addResource |
( |
ResourceType && |
resource, |
|
|
bool |
persistent = false |
|
) |
| |
|
inline |
Add a new resource to the map.
- Parameters
-
resource | A resource instance to add to the map. |
persistent | If the resource should persist through removal. |
- Returns
- A handle to the added resource.
Definition at line 49 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
StoragePolicy::iterator Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::begin |
( |
| ) |
|
|
inline |
Gets an iterator to the beginning of the resource map.
Definition at line 94 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
void Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::clear |
( |
| ) |
|
|
inline |
Clear out the resources in the map.
Pinned resources are left alone.
Definition at line 102 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
StoragePolicy::iterator Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::end |
( |
| ) |
|
|
inline |
Gets an iterator to the end of the resource map.
Definition at line 97 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
HandleType Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::getHandle |
( |
const ResourceType & |
r | ) |
|
|
inline |
Gets a handle to the resource given.
- Parameters
-
r | Pointer to the resource to fetch a handle for. |
- Returns
- Handle to the resource in the map.
Definition at line 158 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
bool Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::hasResource |
( |
HandleType |
handle | ) |
|
|
inline |
Check if the resource with the given handle exists in the map.
- Parameters
-
- Returns
- A boolean indicating if the resource was found.
Definition at line 76 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
ResourceType & Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::operator[] |
( |
const HandleType |
handle | ) |
|
|
inline |
Get a reference to the resource with the given handle.
- Parameters
-
handle | Handle to a resource currently in the resource map. |
- Returns
- A reference to the resource.
Definition at line 136 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
const ResourceType & Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::operator[] |
( |
const HandleType |
handle | ) |
const |
|
inline |
Get a const reference to the resource with the given handle.
- Parameters
-
handle | Handle to a resource currently in the resource map. |
- Returns
- A const reference to the resource.
Definition at line 115 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
void Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::pin |
( |
const HandleType |
handle | ) |
|
|
inline |
Pin the resource with the given handle, preventing it from being cleared from the resource map automatically.
- Parameters
-
handle | Handle to a resource currently in the resource map. |
Definition at line 165 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
bool Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::pinned |
( |
const HandleType & |
handle | ) |
const |
|
inline |
Gets if the given resource handle is pinned.
Definition at line 173 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
void Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::removeResource |
( |
HandleType |
handle | ) |
|
|
inline |
Remove the resource with the given handle.
- Parameters
-
handle | Valid handle to a resource to remove. |
Definition at line 61 of file ResourceMap.h.
template<typename HandleType , typename ResourceType , typename StoragePolicy , typename LockingPolicy , typename VerificationPolicy >
size_t Cogs::ResourceMapBase< HandleType, ResourceType, StoragePolicy, LockingPolicy, VerificationPolicy >::size |
( |
| ) |
const |
|
inline |
Get the number or resources in the resource map.
- Returns
- Number of resources currently in the resource map.
Definition at line 88 of file ResourceMap.h.