12 template <
typename FmtExtender =
void>
32 operator std::string()
const
54 return id == other.id;
59 return !(*
this == other);
77 [[nodiscard]]
char const*
data()
const
82 [[nodiscard]]
size_t size()
const
88 template <
typename FmtExtender>
91 j = entity_id.
value();
94 template <
typename FmtExtender>
100 entity_id = j.get<std::string>();
105 "{} should be hex-encoded string: {}",
106 FmtExtender::ID_LABEL,
111 template <
typename FmtExtender>
115 return FmtExtender::ID_LABEL;
118 template <
typename FmtExtender>
120 nlohmann::json& schema,
123 schema[
"type"] =
"string";
128 schema[
"format"] =
"hex";
135 static std::string
format(
const std::string& core)
137 return fmt::format(
"m[{}]", core);
146 static std::string
format(
const std::string& core)
148 return fmt::format(
"u[{}]", core);
157 static std::string
format(
const std::string& core)
159 return fmt::format(
"n[{}]", core);
170 template <
typename FmtExtender>
171 static inline std::ostream& operator<<(
174 if constexpr (std::is_same_v<FmtExtender, void>)
176 os << entity_id.
value();
180 os << FmtExtender::format(entity_id.
value());
185 template <
typename FmtExtender>
186 struct hash<
ccf::EntityId<FmtExtender>>
190 return std::hash<std::string>{}(entity_id.
value());
197template <
typename FmtExtender>
198struct formatter<
ccf::EntityId<FmtExtender>>
200 template <
typename ParseContext>
201 constexpr auto parse(ParseContext& ctx)
206 template <
typename FormatContext>
209 std::stringstream ss;
211 return format_to(ctx.out(),
"{}", ss.str());
218 template <
typename FmtExtender>
224 const auto& data = entity_id.
value();
Definition sha256_hash.h:88
ccf::ByteVector SerialisedEntry
Definition serialised_entry.h:8
Definition app_interface.h:14
std::string schema_name(const ClaimsDigest *claims_digest_type)
Definition claims_digest.h:59
void from_json(const nlohmann::json &j, ClaimsDigest &hash)
Definition claims_digest.h:54
void to_json(nlohmann::json &j, const ClaimsDigest &hash)
Definition claims_digest.h:49
void fill_json_schema(nlohmann::json &schema, const ClaimsDigest *claims_digest_type)
Definition claims_digest.h:65
Definition entity_id.h:14
EntityId(const EntityId &id_)=default
EntityId(const Value &id_)
Definition entity_id.h:27
static constexpr size_t LENGTH
Definition entity_id.h:18
EntityId(EntityId &&id_) noexcept
Definition entity_id.h:29
char const * data() const
Definition entity_id.h:77
size_t size() const
Definition entity_id.h:82
bool operator<(const EntityId &other) const
Definition entity_id.h:62
EntityId(Value &&id_)
Definition entity_id.h:28
EntityId & operator=(EntityId &&other)=default
const Value & value() const
Definition entity_id.h:72
std::string Value
Definition entity_id.h:19
Value & value()
Definition entity_id.h:67
EntityId & operator=(const Value &id_)
Definition entity_id.h:46
bool operator!=(const EntityId &other) const
Definition entity_id.h:57
bool operator==(const EntityId &other) const
Definition entity_id.h:52
EntityId & operator=(const EntityId &other)
Definition entity_id.h:37
static SerialisedEntry to_serialised(const ccf::EntityId< FmtExtender > &entity_id)
Definition entity_id.h:221
static ccf::EntityId< FmtExtender > from_serialised(const SerialisedEntry &data)
Definition entity_id.h:228
Definition blit_serialiser.h:14
auto format(const ccf::EntityId< FmtExtender > &v, FormatContext &ctx) const
Definition entity_id.h:207
constexpr auto parse(ParseContext &ctx)
Definition entity_id.h:201
size_t operator()(const ccf::EntityId< FmtExtender > &entity_id) const
Definition entity_id.h:188