|
Uni20
Asynchronous tensor and runtime library.
|
#include <uni20/mdspan/format.hpp>#include <fmt/chrono.h>#include <fmt/core.h>#include <fmt/format.h>#include <atomic>#include <cctype>#include <chrono>#include <cstdint>#include <cstdlib>#include <cstring>#include <filesystem>#include <format>#include <fstream>#include <functional>#include <ranges>#include <type_traits>Go to the source code of this file.
Classes | |
| struct | trace::FormattingOptions |
| Configuration and formatting options for a trace module. More... | |
| struct | trace::FormattingOptions::ColorOptionTraits |
| Enables/disables/auto color for this module (from UNI20_COLOR or programmatic override). More... | |
| struct | trace::FormattingOptions::ThreadIdOptionTraits |
| Controls thread-id prefixing (from UNI20_TRACE_THREAD_ID or module override). More... | |
Namespaces | |
| namespace | trace |
Concepts | |
| concept | trace::HasFmtFormatter |
| concept | trace::HasStdFormatter |
| concept | trace::Container |
| concept | trace::HasPresentationMdspanView |
Enumerations | |
| enum class | trace::trace_format_context { trace::normal , trace::fatal } |
Functions | |
| void | trace::append_optional_parameters (uni20::presentation::styled_text &text, FormattingOptions const &opts, uni20::presentation::styled_text const ¶meters, std::string_view style_kind, bool start_newline=false) |
| void | trace::append_parameter_separator (uni20::presentation::styled_text &text, FormattingOptions const &opts, std::string_view style_kind, bool start_newline) |
| void | trace::append_trace_location (uni20::presentation::styled_text &text, FormattingOptions const &opts, std::string_view label, std::string_view style_kind, const char *file, int line) |
| void | trace::append_trace_module_location (uni20::presentation::styled_text &text, FormattingOptions const &opts, std::string_view label, std::string_view style_kind, const char *module, const char *file, int line) |
| bool | trace::canFormatAsPresentationMatrix (const std::vector< std::vector< std::string > > &elems) |
| template<typename... Args> | |
| void | trace::CheckCall (const char *cond, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::CheckEqualCall (const char *a, const char *b, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::CheckFloatingEqCall (const char *a, const char *b, std::int64_t ulps, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugCheckCall (const char *cond, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugCheckEqualCall (const char *a, const char *b, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugCheckFloatingEqCall (const char *a, const char *b, std::int64_t ulps, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugPreconditionCall (const char *cond, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugPreconditionEqualCall (const char *a, const char *b, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugPreconditionFloatingEqCall (const char *a, const char *b, std::int64_t ulps, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceModuleCall (const char *module, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceModuleStackCall (const char *module, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceOnceCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceStackCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::DebugTraceStackOnceCall (const char *exprList, const char *file, int line, const Args &... args) |
| std::size_t | trace::displayWidth (std::string_view str, FormattingOptions const &opts) |
| std::size_t | trace::displayWidth (std::string_view str, uni20::presentation::output_policy const &policy) |
| template<typename... Args> | |
| void | trace::ErrorCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::ErrorIfCall (const char *cond, const char *exprList, const char *file, int line, const Args &... args) |
| template<class Error > requires std::derived_from<std::remove_cvref_t<Error>, uni20::diagnostic_error> && detail::HasDiagnosticReport<Error> | |
| uni20::presentation::styled_text | trace::format_diagnostic (Error const &error) |
| Format a structured diagnostic using the active trace presentation policy. | |
| template<class Error > requires std::derived_from<std::remove_cvref_t<Error>, uni20::diagnostic_error> && detail::HasDiagnosticReport<Error> | |
| uni20::presentation::styled_text | trace::format_diagnostic (Error const &error, uni20::presentation::output_policy const &policy) |
| Format a structured diagnostic using its ADL presentation report and attached context. | |
| std::string | trace::format_timestamp () |
| std::string | trace::format_trace_prefix (FormattingOptions const &opts) |
| uni20::presentation::styled_text | trace::format_trace_prefix_text (FormattingOptions const &opts) |
| std::string | trace::formatContainerToString (const std::string &elem, FormattingOptions const &opts, size_t max_width=0) |
| std::string | trace::formatContainerToString (const std::string &elem, size_t max_width=0) |
| std::string | trace::formatContainerToString (const std::vector< std::string > &elems, FormattingOptions const &opts, size_t max_width=0) |
| std::string | trace::formatContainerToString (const std::vector< std::string > &elems, size_t max_width=0) |
| std::string | trace::formatContainerToString (const std::vector< std::vector< std::string > > &elems, FormattingOptions const &opts, size_t max_width=0) |
| std::string | trace::formatContainerToString (const std::vector< std::vector< std::string > > &elems, size_t max_width=0) |
| std::string | trace::formatContainerToStringImpl (const std::string &elem, uni20::presentation::output_policy const &policy, size_t max_width=0) |
| std::string | trace::formatContainerToStringImpl (const std::vector< std::string > &elems, uni20::presentation::output_policy const &policy, size_t max_width=0) |
| std::string | trace::formatContainerToStringImpl (const std::vector< std::vector< std::string > > &elems, uni20::presentation::output_policy const &policy, size_t max_width=0) |
| std::string | trace::formatItemString (const std::pair< std::string, bool > &name, const std::string &value, const FormattingOptions &opts, int available_width) |
| template<typename T > | |
| std::string | trace::formatItemString (const std::pair< std::string, bool > &name, const std::vector< T > &values, const FormattingOptions &opts, int available_width) |
| std::string | trace::formatItemString (const std::pair< std::string, bool > &name, detail::TraceNameValue const &value, const FormattingOptions &opts, int available_width) |
| uni20::presentation::styled_text | trace::formatItemText (const std::pair< std::string, bool > &name, const std::string &value, const FormattingOptions &opts, int available_width) |
| template<typename T > | |
| uni20::presentation::styled_text | trace::formatItemText (const std::pair< std::string, bool > &name, const std::vector< T > &values, const FormattingOptions &opts, int available_width) |
| uni20::presentation::styled_text | trace::formatItemText (const std::pair< std::string, bool > &name, detail::TraceNameValue const &value, const FormattingOptions &opts, int available_width) |
| template<uni20::presentation::mdspan_like MDS> | |
| std::string | trace::formatMdspanForTrace (MDS const &mds, FormattingOptions const &opts, int value_width, trace_format_context context, std::string_view label) |
| template<typename... Args> | |
| std::string | trace::formatParameterList (const char *exprList, const FormattingOptions &opts, const Args &... args) |
| template<typename... Args> | |
| uni20::presentation::styled_text | trace::formatParameterListText (const char *exprList, const FormattingOptions &opts, const Args &... args) |
| template<typename... Args> | |
| uni20::presentation::styled_text | trace::formatParameterListTextForContext (const char *exprList, const FormattingOptions &opts, trace_format_context context, const Args &... args) |
| std::string | trace::formatParameters (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts) |
| template<typename T , typename... Ts> | |
| std::string | trace::formatParameters (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts, const T &first, const Ts &... rest) |
| uni20::presentation::styled_text | trace::formatParametersText (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts) |
| template<typename T , typename... Ts> | |
| uni20::presentation::styled_text | trace::formatParametersText (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts, const T &first, const Ts &... rest) |
| uni20::presentation::styled_text | trace::formatParametersTextForContext (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts, trace_format_context context) |
| template<typename T , typename... Ts> | |
| uni20::presentation::styled_text | trace::formatParametersTextForContext (std::vector< std::pair< std::string, bool > >::const_iterator b, const FormattingOptions &opts, trace_format_context context, const T &first, const Ts &... rest) |
| std::string | trace::formatRectangularContainerAsPresentationMatrix (const std::vector< std::vector< std::string > > &elems, FormattingOptions const &opts) |
| std::string | trace::formatValue (char *s, FormattingOptions const &opts) |
| Format a mutable C‐string. | |
| std::string | trace::formatValue (const char *s, FormattingOptions const &) |
| Format a C‐string (null‐terminated) as a normal string. | |
| template<Container ContainerType> | |
| auto | trace::formatValue (const ContainerType &c, FormattingOptions const &opts) -> std::vector< decltype(formatValue(*std::begin(c), opts))> |
Format each element of a container by recursively calling formatValue. | |
| template<typename Promise > | |
| std::string | trace::formatValue (const std::coroutine_handle< Promise > &h, FormattingOptions const &) |
| std::string | trace::formatValue (const std::coroutine_handle<> &h, FormattingOptions const &) |
| template<typename T > requires (!Container<T> && !HasFmtFormatter<T> && HasStdFormatter<T> && !uni20::RealOrComplex<T>) | |
| std::string | trace::formatValue (const T &value, FormattingOptions const &) |
| template<typename T > requires (!Container<T> && HasFmtFormatter<T> && !uni20::RealOrComplex<T>) | |
| std::string | trace::formatValue (const T &value, FormattingOptions const &opts) |
| Format a non-container, non-Uni20-scalar type with an fmt formatter. | |
| detail::TraceNameValue | trace::formatValue (detail::TraceNameValue const &nv, FormattingOptions const &opts) |
| special case for detail::TraceNameValue to return the pre-formatted name,value pair | |
| template<uni20::presentation::mdspan_like MDS> | |
| std::string | trace::formatValue (MDS const &mds, FormattingOptions const &opts) |
| Format an mdspan-like value as presentation-layer tensor art. | |
| std::string | trace::formatValue (std::string_view s, FormattingOptions const &) |
| Format a C‐string (null‐terminated) as a normal string. | |
| template<uni20::Complex T> requires uni20::Real<uni20::make_real_t<T>> | |
| std::string | trace::formatValue (T const &value, FormattingOptions const &opts) |
| Format any Uni20 complex scalar using its real type's trace precision. | |
| template<HasPresentationMdspanView T> | |
| std::string | trace::formatValue (T const &value, FormattingOptions const &opts) |
| Format tensor/view-like values through their mdspan view. | |
| template<uni20::Real T> | |
| std::string | trace::formatValue (T value, FormattingOptions const &opts) |
| Format any Uni20 real scalar using its configured trace precision. | |
| template<typename U > requires (!std::is_same_v<U, char> && !std::is_same_v<U, const char>) | |
| std::string | trace::formatValue (U *ptr, FormattingOptions const &) |
| Format any non‐character pointer by showing its pointee type and address. | |
| template<uni20::presentation::mdspan_like MDS> | |
| std::string | trace::formatValueForContext (MDS const &mds, FormattingOptions const &opts, int value_width, trace_format_context context, std::string_view label) |
| template<HasPresentationMdspanView T> | |
| std::string | trace::formatValueForContext (T const &value, FormattingOptions const &opts, int value_width, trace_format_context context, std::string_view label) |
| template<typename T > | |
| auto | trace::formatValueForContext (T const &value, FormattingOptions const &opts, int, trace_format_context, std::string_view) |
| FormattingOptions & | trace::get_formatting_options (const std::string &module="") |
| get the FormattingOptions object for a given module; use "" as the module name (or default parameter) for the global format | |
| int | trace::getMaxLineWidth (const std::string &str) |
| std::size_t | trace::getMaxLineWidth (const std::string &str, uni20::presentation::output_policy const &policy) |
| bool | trace::isMultiline (const std::string &str) |
| template<typename T > | |
| bool | trace::isMultiline (const std::vector< T > &str) |
| size_t | trace::maxWidth (const std::string &str) |
| size_t | trace::maxWidth (const std::string &str, uni20::presentation::output_policy const &policy) |
| template<typename T > | |
| size_t | trace::maxWidth (const std::vector< T > &elems) |
| template<typename T > | |
| size_t | trace::maxWidth (const std::vector< T > &elems, uni20::presentation::output_policy const &policy) |
| template<typename... Args> | |
| void | trace::PanicCall (const char *exprList, const char *file, int line, const Args &... args) |
| std::vector< std::pair< std::string, bool > > | trace::parseNames (std::string_view s) |
| template<typename... Args> | |
| void | trace::PreconditionCall (const char *cond, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::PreconditionEqualCall (const char *a, const char *b, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::PreconditionFloatingEqCall (const char *a, const char *b, std::int64_t ulps, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::print (fmt::format_string< Args... > fmt_str, Args &&... args) |
| Print formatted string via the default (empty-module) sink. | |
| template<class Exception > requires std::derived_from<std::remove_cvref_t<Exception>, std::exception> | |
| void | trace::raise (Exception &&exception, std::source_location where=std::source_location::current()) |
| Raise a concrete exception through Uni20's configured error boundary. | |
| bool | trace::should_show_thread_id (FormattingOptions const &opts) |
| template<typename... Args> | |
| void | trace::TraceCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::TraceModuleCall (const char *module, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::TraceModuleStackCall (const char *module, const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::TraceOnceCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::TraceStackCall (const char *exprList, const char *file, int line, const Args &... args) |
| template<typename... Args> | |
| void | trace::TraceStackOnceCall (const char *exprList, const char *file, int line, const Args &... args) |
| std::string | trace::trim (const std::string &s) |