13#ifndef CMSIS_PLUS_POSIX_IO_DEVICE_REGISTRY_H_
14#define CMSIS_PLUS_POSIX_IO_DEVICE_REGISTRY_H_
18#if defined(__cplusplus)
22#if defined(OS_USE_OS_APP_CONFIG_H)
23#include <cmsis-plus/os-app-config.h>
35#pragma GCC diagnostic push
37#pragma clang diagnostic ignored "-Wc++98-compat"
129 static device_list registry_list__;
154#pragma GCC diagnostic push
155#if defined(__clang__)
156#elif defined(__GNUC__)
157#pragma GCC diagnostic ignored "-Waggregate-return"
159 for (
auto&& d : registry_list__)
162 if (std::strcmp (
device->
name (), d.name ()) == 0)
168#pragma GCC diagnostic push
172 registry_list__.link (*
device);
174 trace::printf (
"Device '%s%s' linked\n", value_type::device_prefix (),
185 assert(path !=
nullptr);
187 auto prefix = value_type::device_prefix ();
188 if (std::strncmp (prefix, path, std::strlen (prefix)) != 0)
195 auto name = path + std::strlen (prefix);
197 for (
auto&& p : registry_list__)
199 if (p.match_name (name))
213#pragma GCC diagnostic push
214#if defined(__clang__)
215#pragma clang diagnostic ignored "-Wexit-time-destructors"
216#pragma clang diagnostic ignored "-Wglobal-constructors"
223#pragma GCC diagnostic pop
233#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.