12#ifndef CMSIS_PLUS_POSIX_IO_DEVICE_REGISTRY_H_
13#define CMSIS_PLUS_POSIX_IO_DEVICE_REGISTRY_H_
17#if defined(__cplusplus)
21#if defined(OS_USE_OS_APP_CONFIG_H)
22#include <cmsis-plus/os-app-config.h>
34#pragma GCC diagnostic push
36#pragma clang diagnostic ignored "-Wc++98-compat"
105#pragma GCC diagnostic push
106#if defined(__clang__)
107#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
111#pragma GCC diagnostic pop
131 &device::registry_links_, T>;
132 static device_list registry_list__;
151 template <
typename T>
157#pragma GCC diagnostic push
158#if defined(__clang__)
159#elif defined(__GNUC__)
160#pragma GCC diagnostic ignored "-Waggregate-return"
162 for (
auto&& d : registry_list__)
165 if (std::strcmp (
device->
name (), d.name ()) == 0)
171#pragma GCC diagnostic push
175 registry_list__.link (*
device);
177 trace::printf (
"Device '%s%s' linked\n", value_type::device_prefix (),
184 template <
typename T>
188 assert (path !=
nullptr);
190 auto prefix = value_type::device_prefix ();
191 if (std::strncmp (prefix, path, std::strlen (prefix)) != 0)
197#pragma GCC diagnostic push
198#if defined(__clang__)
199#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
202 auto name = path + std::strlen (prefix);
203#pragma GCC diagnostic pop
205 for (
auto&& p : registry_list__)
207 if (p.match_name (name))
221#pragma GCC diagnostic push
222#if defined(__clang__)
223#pragma clang diagnostic ignored "-Wexit-time-destructors"
224#pragma clang diagnostic ignored "-Wglobal-constructors"
228 template <
typename T>
232#pragma GCC diagnostic pop
242#pragma GCC diagnostic pop
Devices registry static class.
static value_type * identify_device(const char *path)
~device_registry()=delete
static void link(value_type *device)
const char * name(void) const
The core of a double linked list, pointers to next, previous.
int puts(const char *s)
Write the string and a line terminator to the trace device.
int printf(const char *format,...)
Write a formatted string to the trace device.