6 #ifndef JLM_UTIL_ANNOTATION_MAP_HPP
7 #define JLM_UTIL_ANNOTATION_MAP_HPP
13 #include <string_view>
14 #include <unordered_map>
31 :
Label_(std::move(label)),
36 :
Label_(std::move(label)),
41 :
Label_(std::move(label)),
46 :
Label_(std::move(label)),
53 [[nodiscard]]
const std::string_view &
62 template<
typename TValue>
63 [[nodiscard]]
const TValue &
66 return std::get<TValue>(
Value_);
74 template<
typename TValue>
78 return std::holds_alternative<TValue>(
Value_);
90 return !(*
this == other);
117 explicit ConstIterator(
const typename AnnotationMapType::const_iterator & it)
122 [[nodiscard]]
const std::vector<Annotation> &
125 return It_.operator->()->second;
128 const std::vector<Annotation> &
134 const std::vector<Annotation> *
168 typename AnnotationMapType::const_iterator
It_ = {};
193 return Map_.find(key) !=
Map_.end();
201 [[nodiscard]]
const std::vector<Annotation> &
214 Map_[key].emplace_back(std::move(annotation));
ConstIterator & operator++()
ConstIterator operator++(int)
std::forward_iterator_tag iterator_category
const std::vector< Annotation > & Annotations() const noexcept
bool operator==(const ConstIterator &other) const
ConstIterator(const typename AnnotationMapType::const_iterator &it)
bool operator!=(const ConstIterator &other) const
const std::vector< Annotation > & operator*() const
std::ptrdiff_t difference_type
const std::vector< Annotation > * operator->() const
AnnotationMapType::const_iterator It_
void AddAnnotation(const void *key, Annotation annotation)
const std::vector< Annotation > & GetAnnotations(const void *key) const noexcept
AnnotationRange Annotations() const
std::unordered_map< const void *, std::vector< Annotation > > AnnotationMapType
bool HasAnnotations(const void *key) const noexcept
bool operator!=(const Annotation &other) const noexcept
bool HasValueType() const noexcept
std::variant< std::string, int64_t, uint64_t, double > AnnotationValue
const TValue & Value() const
Annotation(std::string_view label, std::string value)
Annotation(std::string_view label, double value)
Annotation(std::string_view label, int64_t value)
const std::string_view & Label() const noexcept
bool operator==(const Annotation &other) const noexcept
Annotation(std::string_view label, uint64_t value)