![]() |
Shamrock 2025.10.0
Astrophysical Code
|
A class that provides unique identifiers (UUID) to instances. More...
#include <shambase/include/shambase/WithUUID.hpp>
Public Member Functions | |
| Tint | get_uuid () const |
| Get the uuid of the class. | |
| bool | is_alive () const |
| Whether this instance still holds a valid uuid (false once moved from). | |
| void | invalidate () |
| Marks this instance's uuid as invalid, e.g. to give up identity outside of a move. | |
| WithUUID () | |
| Constructor of the class. | |
| WithUUID (const WithUUID &)=delete | |
| would duplicate the uuid | |
| WithUUID & | operator= (const WithUUID &)=delete |
| would duplicate the uuid | |
| WithUUID (WithUUID &&other) noexcept | |
| Move constructor: transfers the uuid to this and invalidates other. | |
| WithUUID & | operator= (WithUUID &&other) noexcept |
| Move assignment: transfers the uuid to this and invalidates other. | |
Static Public Attributes | |
| static constexpr Tint | invalid_uuid = std::numeric_limits<Tint>::max() |
Protected Attributes | |
| Tint | uuid |
| The unique identifier of the class. | |
A class that provides unique identifiers (UUID) to instances.
| T | The class type to which the UUID will be assigned |
| Tint | The data type for the UUID |
| thread_safe | Whether the UUID constructor should be thread-safe |
Example usage:
Copy is deleted (would duplicate the uuid). Move transfers the uuid and invalidates the source, so check is_alive() rather than assuming a moved-from instance still has one.
Definition at line 41 of file WithUUID.hpp.
|
inline |
Constructor of the class.
Assigns a unique identifier to the class
Definition at line 72 of file WithUUID.hpp.
|
inlinenoexcept |
Move constructor: transfers the uuid to this and invalidates other.
Definition at line 90 of file WithUUID.hpp.
|
inline |
|
inline |
Marks this instance's uuid as invalid, e.g. to give up identity outside of a move.
Definition at line 65 of file WithUUID.hpp.
|
inline |
Whether this instance still holds a valid uuid (false once moved from).
Definition at line 62 of file WithUUID.hpp.
|
inlinenoexcept |
Move assignment: transfers the uuid to this and invalidates other.
Definition at line 93 of file WithUUID.hpp.
|
staticconstexpr |
Sentinel marking an invalidated/moved-from instance (0 is a valid uuid, so max is used instead).
Definition at line 52 of file WithUUID.hpp.
|
protected |
The unique identifier of the class.
Definition at line 47 of file WithUUID.hpp.