Skip to main content

trace_policy Concept

Concept constraining the policy class T used by tracer<T>. More...

Definition

template <typename T>
concept micro_os_plus::trace::detail::trace_policy = requires (const void* buf, std::size_t n) {
      { T::initialise () } noexcept -> std::same_as<void>;
      { T::write (buf, n) } noexcept -> std::same_as<ssize_t>;
      { T::flush () } noexcept -> std::same_as<void>;
    }

Description

Concept constraining the policy class T used by tracer<T>.

Template Parameters
T

The policy class to be constrained.

A conforming T must expose three static, noexcept member functions with the following exact signatures:

  • static void T::initialise() noexcept
  • static ssize_t T::write(const void*, std::size_t) noexcept
  • static void T::flush() noexcept

The noexcept requirement is enforced by the concept so that a non-conforming policy is rejected at instantiation time rather than silently invoking std::terminate through the unconditionally noexcept free-function wrappers. A clear diagnostic is emitted at the point of instantiation if any required function is absent, has the wrong signature, or is not noexcept.

Definition at line 361 of file trace-cpp-api.h.

  template<typename T>
  concept trace_policy = requires (const void* buf, std::size_t n) {
  { T::initialise () } noexcept -> std::same_as<void>;
  { T::write (buf, n) } noexcept -> std::same_as<ssize_t>;
  { T::flush () } noexcept -> std::same_as<void>;
  }

Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.17.0.