Logging User Types#

#include <dplx/dlog/loggable.hpp>
namespace dplx::dlog {}

Concepts#

template<typename T>
concept loggable#

Models the requirements for a type to be retirable to a log record, i.e. it has a (known) deeppack encoder and the type reification_type_of<T>::type satisfies reifiable.

template<typename T>
concept reifiable#

Models the requirements for a type to be reifiable from a log record, i.e. it has a (known) deeppack decoder and a reification_type_id has been associated with it via reification_tag<T>.

Customization Points#

template<typename T>
reification_type_id reification_tag_v = reification_tag<T>::value#
template<typename T>
struct reification_tag#

Associates an identifier with T which is used to discern retired types within log records.

User specializations are expected (but currently not required) to be derived from user_reification_type_constant.

There is no default identifier generation scheme due to the fact that it is impossible to generate cross-platform long-term-stable integer values based on the C++ type system alone.

template<typename T>
using reification_type_of_t = typename reification_type_of<T>::type#
template<typename T>
struct reification_type_of#

A type function which associates the type which should be used to reify a retired object of T.

Defaults to the identity function.

using type = T#

Core Types#

enum class reification_type_id : std::uint64_t#
enumerator uint64#
enumerator int64#
enumerator float_single#
enumerator float_double#
enumerator string#
inline constexpr reification_type_id user_defined_reification_flag#

This flag must be set for all type identifiers not provided by this library.

Utilities#

template<reification_type_id Id>
using reification_type_constant = std::integral_constant<reification_type_id, Id>#
template<std::uint64_t Id>
using user_reification_type_constant = reification_type_constant<make_user_reification_id(Id)>#
consteval auto make_user_reification_type_id(std::uint64_t id) noexcept -> reification_type_id#

Casts id to reification_type_id and marks it as user provided by setting user_defined_reification_flag.