Key-value archive that owns stored objects of type T, keyed by K.
More...
#include <aeongames/Archive.hpp>
|
| template<typename... Args> |
| T * | Store (const K &k, Args... args) |
| | Construct and store a new object under the given key.
|
| T * | Store (const K &k, std::unique_ptr< T > &&pointer) |
| | Store an existing uniquely-owned object under the given key.
|
| std::unique_ptr< T > | Dispose (const K &k) |
| | Remove and return the object associated with the given key.
|
| const T * | Get (const K &k) const |
| | Retrieve a stored object by key (const).
|
| T * | Get (const K &k) |
| | Retrieve a stored object by key (mutable).
|
| const K & | GetKey (const T *t) const |
| | Find the key associated with a stored object.
|
template<class K, class T>
class AeonGames::Archive< K, T >
Key-value archive that owns stored objects of type T, keyed by K.
- Template Parameters
-
| K | Key type (must be hashable). |
| T | Value type. |
Definition at line 32 of file Archive.hpp.
◆ Dispose()
template<class K, class T>
Remove and return the object associated with the given key.
- Parameters
-
| k | Key of the object to dispose. |
- Returns
- Unique pointer to the removed object, or nullptr if not found.
Definition at line 64 of file Archive.hpp.
◆ Get() [1/2]
template<class K, class T>
Retrieve a stored object by key (mutable).
- Parameters
-
- Returns
- Pointer to the object, or nullptr if not found.
Definition at line 94 of file Archive.hpp.
◆ Get() [2/2]
template<class K, class T>
Retrieve a stored object by key (const).
- Parameters
-
- Returns
- Pointer to the object, or nullptr if not found.
Definition at line 80 of file Archive.hpp.
◆ GetKey()
template<class K, class T>
Find the key associated with a stored object.
- Parameters
-
| t | Pointer to the object to look up. |
- Returns
- Const reference to the key.
- Exceptions
-
| std::runtime_error | if the object is not found. |
Definition at line 104 of file Archive.hpp.
◆ Store() [1/2]
template<class K, class T>
template<typename... Args>
Construct and store a new object under the given key.
- Template Parameters
-
| Args | Constructor argument types. |
- Parameters
-
| k | Key to associate with the new object. |
| args | Arguments forwarded to the T constructor. |
- Returns
- Raw pointer to the stored object.
Definition at line 43 of file Archive.hpp.
◆ Store() [2/2]
template<class K, class T>
Store an existing uniquely-owned object under the given key.
- Parameters
-
| k | Key to associate with the object. |
| pointer | Unique pointer to the object to store (moved). |
- Returns
- Raw pointer to the stored object.
Definition at line 54 of file Archive.hpp.
The documentation for this class was generated from the following file: