Health-GPS
1.2.2.0
Global Health Policy Simulation model (Health-GPS)
|
Entity unique identifier data type. More...
#include <identifier.h>
Public Member Functions | |
constexpr | Identifier ()=default |
Initialises a new instance of the hgps::core::Identifier class. More... | |
Identifier (const char *const value) | |
Initialises a new instance of the hgps::core::Identifier class. More... | |
Identifier (std::string value) | |
Initialises a new instance of the hgps::core::Identifier class. More... | |
bool | is_empty () const noexcept |
Checks whether this is an empty identifier. More... | |
std::size_t | size () const noexcept |
Gets the side of the identifier. More... | |
const std::string & | to_string () const noexcept |
Convert the identifier to a string representation. More... | |
std::size_t | hash () const noexcept |
Gets the identifier hash code value. More... | |
bool | equal (const std::string &other) const noexcept |
Determines whether a string representation and this instance have same value. More... | |
bool | equal (const Identifier &other) const noexcept |
Determines whether two identifiers have the same value. More... | |
bool | operator== (const Identifier &rhs) const noexcept |
Determines whether two identifiers have the same value. More... | |
std::strong_ordering | operator<=> (const Identifier &rhs) const noexcept=default |
Compare two identifier. More... | |
Static Public Member Functions | |
static Identifier | empty () |
Represents the empty Identifier, read-only. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Identifier &identifier) |
Output streams operator for Identifier type. More... | |
Entity unique identifier data type.
Wrappers a string identifier to provide consistent comparison operation using hash code instead of strings.
_
, alpha: a-z
and digits: 0-9
.
|
constexprdefault |
Initialises a new instance of the hgps::core::Identifier class.
hgps::core::Identifier::Identifier | ( | const char *const | value | ) |
Initialises a new instance of the hgps::core::Identifier class.
value | The characters array identifier |
std::invalid_argument | for value starting with a number or containing invalid characters. |
hgps::core::Identifier::Identifier | ( | std::string | value | ) |
Initialises a new instance of the hgps::core::Identifier class.
value | The string identifier |
std::invalid_argument | for value starting with a number or containing invalid characters. |
|
static |
Represents the empty Identifier, read-only.
|
noexcept |
Determines whether two identifiers have the same value.
other | The Identifier to compare to this instance. |
|
noexcept |
Determines whether a string representation and this instance have same value.
other | The string representation to compare to this instance. |
|
noexcept |
Gets the identifier hash code value.
|
noexcept |
Checks whether this is an empty identifier.
|
defaultnoexcept |
Compare two identifier.
rhs | The Identifier to compare to this instance. |
|
noexcept |
Determines whether two identifiers have the same value.
rhs | The Identifier to compare to this instance. |
|
noexcept |
Gets the side of the identifier.
|
noexcept |
Convert the identifier to a string representation.
|
friend |
Output streams operator for Identifier type.
stream | The stream to output |
identifier | The Identifier instance |