6#include <unordered_map>
8#include "nlohmann/json.hpp"
42 std::
size_t size() const noexcept;
50 std::
size_t hash() const noexcept;
65 bool operator==(const
Identifier &rhs) const noexcept;
70 std::strong_ordering operator<=>(const
Identifier &rhs) const noexcept = default;
80 friend
std::ostream &operator<<(
std::ostream &stream, const
Identifier &identifier);
84 std::size_t hash_code_{std::hash<std::string>{}(
"")};
86 void validate_identifier()
const;
89void from_json(
const nlohmann::json &j, Identifier &
id);
92template <
template <
typename...>
class Map,
class Value>
93void map_from_json(
const nlohmann::json &j, Map<hgps::core::Identifier, Value> &map) {
95 for (
const auto &item : j.items()) {
96 map.emplace(item.key(), item.value().get<Value>());
104core::Identifier
operator""_id(
const char *
id,
size_t);
109void from_json(
const nlohmann::json &j, std::map<hgps::core::Identifier, T> &map) {
110 hgps::core::detail::map_from_json(j, map);
114void from_json(
const nlohmann::json &j, std::unordered_map<hgps::core::Identifier, T> &map) {
115 hgps::core::detail::map_from_json(j, map);
119template <>
struct hash<
hgps::core::Identifier> {
void from_json(const nlohmann::json &j, Identifier &id)
Definition identifier.cpp:60
@ other
Common diseases excluding cancers.
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
Global namespace.
Definition column_iterator.h:123
Entity unique identifier data type.
Definition identifier.h:20
bool is_empty() const noexcept
Checks whether this is an empty identifier.
Definition identifier.cpp:24
bool equal(const std::string &other) const noexcept
Determines whether a string representation and this instance have same value.
Definition identifier.cpp:36
constexpr Identifier()=default
Initialises a new instance of the hgps::core::Identifier class.
std::size_t size() const noexcept
Gets the side of the identifier.
Definition identifier.cpp:26
std::size_t hash() const noexcept
Gets the identifier hash code value.
Definition identifier.cpp:30
static Identifier empty()
Represents the empty Identifier, read-only.
Definition identifier.cpp:9
const std::string & to_string() const noexcept
Convert the identifier to a string representation.
Definition identifier.cpp:28