diag-trace 5.0.0
µOS++ Tracing Infrastructure
Loading...
Searching...
No Matches
micro_os_plus::trace::detail::trace_policy Concept Reference

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

#include <trace-cpp-api.h>

Concept definition

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>;
}
Concept constraining the policy class T used by tracer<T>.

Detailed Description

Template Parameters
TThe 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.