31#if !defined(MICRO_OS_PLUS_DIAG_TRACE_H_)
32#error "Do not include this file directly; use <micro-os-plus/diag/trace.h>."
37#ifndef MICRO_OS_PLUS_DIAG_TRACE_CPP_API_H_
38#define MICRO_OS_PLUS_DIAG_TRACE_CPP_API_H_
42#if defined(__cplusplus)
99#pragma GCC diagnostic push
100#if defined(__clang__)
101#pragma clang diagnostic ignored "-Wpre-c++17-compat"
106#pragma GCC diagnostic push
107#if defined(__clang__)
108#pragma clang diagnostic ignored "-Wc++98-compat"
109#pragma clang diagnostic ignored "-Wc++98-c++11-c++14-compat"
144 write (
const void* buf, std::size_t nbyte)
noexcept;
159 flush (
void)
noexcept;
177 printf (
const char* format, ...) noexcept;
193 vprintf (const
char* format, std::va_list arguments) noexcept;
208 puts (const
char* s =
"") noexcept;
241 dump_args (
int argc,
char* argv[], const
char* name =
"main") noexcept;
243#pragma GCC diagnostic pop
248#if defined(MICRO_OS_PLUS_DIAG_TRACE_ENABLED)
254#pragma GCC diagnostic push
255#if defined(__clang__)
256#pragma clang diagnostic ignored "-Wc++98-compat"
321 write (
const void* buf, std::size_t nbyte)
noexcept;
360 template <
typename T>
362 { T::initialise () }
noexcept -> std::same_as<void>;
363 { T::write (buf, n) }
noexcept -> std::same_as<ssize_t>;
364 { T::flush () }
noexcept -> std::same_as<void>;
390 template <trace_policy T>
441 std::size_t nbyte)
noexcept (
noexcept (T::write (buf, nbyte)))
443 return T::write (buf, nbyte);
464 flush (
void)
noexcept (
noexcept (T::flush ()))
486 printf (
const char* format, ...) noexcept
487 __attribute__ ((format (
printf, 1, 2)));
507 vprintf (const
char* format, std::va_list arguments) noexcept;
524 puts (const
char* s =
"") noexcept;
558 dump_args (
int argc,
char* argv[], const
char* name =
"main") noexcept;
567#pragma GCC diagnostic push
568#if defined(__clang__)
569#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
574#pragma GCC diagnostic pop
577#pragma GCC diagnostic pop
586#pragma GCC diagnostic pop
Policy class for the production trace instance.
static void initialise(void) noexcept
Initialise the trace output channel.
static ssize_t write(const void *buf, std::size_t nbyte) noexcept
Write the given number of bytes to the trace output channel.
static void flush(void) noexcept
Flush the trace output channel.
Tracing API bound to a given policy class.
static void flush(void) noexcept(noexcept(T::flush()))
Flush the trace output channel.
tracer()=delete
Deleted default constructor.
static int printf(const char *format,...) noexcept
Write a formatted string to the trace output channel.
static ssize_t write(const void *buf, std::size_t nbyte) noexcept(noexcept(T::write(buf, nbyte)))
Write the given number of bytes to the trace output channel.
static void initialise(void) noexcept(noexcept(T::initialise()))
Initialise the trace output channel.
Concept constraining the policy class T used by tracer<T>.
void initialise(void) noexcept
Initialise the trace output channel.
ssize_t write(const void *buf, std::size_t nbyte) noexcept
Write the given number of bytes to the trace output channel.
void flush(void) noexcept
Flush the trace output channel.
int printf(const char *format,...) noexcept
Write a formatted string to the trace output channel.
int puts(const char *s) noexcept
Write the string and a line terminator to the trace output channel.
int putchar(int c) noexcept
Write the single character to the trace output channel.
int vprintf(const char *format, std::va_list arguments) noexcept
Write a formatted variable arguments list to the trace output channel.
Implementation details namespace.
Tracing support namespace.
C++ header file with the inline implementations for the tracer class template.