tagval 0.2.0
Modern C++23 header-only library of tagged values (open/closed enumerations with metadata)
Loading...
Searching...
No Matches
kind_registry.hpp File Reference

Program-wide registry of every tag-value kind that opts in via the TAGVAL_REGISTER_KIND macro. More...

#include <tagval/closed_ended.hpp>
#include <tagval/descriptor.hpp>
#include <tagval/entry.hpp>
#include <tagval/open_ended.hpp>
#include <commons/color.hpp>
#include <commons/fixed_string.hpp>
#include <commons/icon.hpp>
#include <algorithm>
#include <concepts>
#include <functional>
#include <memory>
#include <optional>
#include <ranges>
#include <span>
#include <string_view>
#include <type_traits>
#include <variant>
#include <vector>
+ Include dependency graph for kind_registry.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagval::KindEntryView
 Flattened, copy-friendly view of a single entry. More...
 
class  tagval::KindView
 Type-erased handle to one registered kind. More...
 
class  tagval::detail::KindViewFactory< T >
 Builds a KindView for a single concrete kind type. More...
 
class  tagval::KindRegistry
 Program-wide index of every kind that opted in via TAGVAL_REGISTER_KIND. More...
 

Namespaces

namespace  tagval
 
namespace  tagval::detail
 

Concepts

concept  tagval::detail::TagValKind
 Concept: T is a tag-value kind (derives from ClosedEnded or OpenEnded).
 

Enumerations

enum class  tagval::KindCategory { tagval::Closed , tagval::Open }
 Which CRTP base a kind derives from. More...
 

Functions

template<comms::FixedString Id, typename T >
constexpr KindCategory tagval::detail::probe_kind (ClosedEnded< Id, T > *) noexcept
 Overload set used to detect whether T is a tag-value kind and, if so, which CRTP base it derives from.
 
template<comms::FixedString Id, typename T >
constexpr KindCategory tagval::detail::probe_kind (OpenEnded< Id, T > *) noexcept
 
constexpr std::monostate tagval::detail::probe_kind (...) noexcept
 
template<typename T >
requires TagValKind<T>
constexpr KindCategory tagval::detail::category_of () noexcept
 Category of a tag-value kind.
 

Detailed Description

Program-wide registry of every tag-value kind that opts in via the TAGVAL_REGISTER_KIND macro.

This is distinct from OpenEndedRegistry<Owner> in <tagval/openended_registry.hpp>, which is per-OpenEnded-kind storage of extern-entry pointers. KindRegistry indexes kinds — both ClosedEnded and OpenEnded — and is intended for tools that want to enumerate the full set of tag-value kinds in a program (API documentation, OpenAPI emitters, debug/admin endpoints, etc.).

Registration is opt-in via the TAGVAL_REGISTER_KIND macro (declared in <tagval/macros.hpp>); a kind that is never registered does not appear in the registry even if it is otherwise used in the program.

Concurrency model mirrors OpenEndedRegistry: mutation only happens during static-init (single-threaded by contract); reads after main() are safe for concurrent readers.