Skip to main content

doubly-list-links.h File

C++ header file with the declarations for the µOS++ doubly linked list link node classes. More...

Included Headers

#include "micro-os-plus/diag/trace.h" #include <cstdint> #include <cstddef> #include <cassert> #include <concepts> #include <iterator> #include "inlines/doubly-list-links-inlines.h"

Namespaces Index

namespacemicro_os_plus

The primary namespace for the µOS++ framework. More...

namespaceutils

The µOS++ utilities definitions. More...

Classes Index

classdoubly_list_links

A class for the core of a doubly linked list (pointers to neighbours). More...

classdoubly_list_links_base

A base class for a doubly linked list node. More...

classstatic_doubly_list_links

A class for the core of a statically allocated doubly linked list (pointers to neighbours). More...

Concepts Index

conceptdoubly_list_links_node

Concept satisfied by any type publicly derived from doubly_list_links_base. More...

Description

C++ header file with the declarations for the µOS++ doubly linked list link node classes.

The doubly-list-links.h header file contains the C++ declarations of the doubly_list_links_base, doubly_list_links, and static_doubly_list_links classes.

The class implementations are in doubly-list-links.cpp and doubly-list-links-inlines.h.

File Listing

The file content with the documentation metadata removed is:

1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2016-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 */
11
12// ----------------------------------------------------------------------------
26
27#ifndef MICRO_OS_PLUS_UTILS_LISTS_DOUBLY_LIST_LINKS_H_
28#define MICRO_OS_PLUS_UTILS_LISTS_DOUBLY_LIST_LINKS_H_
29
30// ----------------------------------------------------------------------------
31
32#if defined(__cplusplus)
33
34// ----------------------------------------------------------------------------
35
36// Repeated here, the file is included directly by `doubly-list-links.cpp`.
37#if __has_include("micro-os-plus/project-config.h")
38#include "micro-os-plus/project-config.h"
39#endif // __has_include("micro-os-plus/project-config.h")
40
41#if __has_include("micro-os-plus/utils/lists-defines.h")
42#include "micro-os-plus/utils/lists-defines.h"
43#endif // __has_include("micro-os-plus/utils/lists-defines.h")
44
45#include "micro-os-plus/diag/trace.h"
46
47#include <cstdint>
48#include <cstddef>
49#include <cassert>
50#include <concepts>
51#include <iterator>
52
53// ----------------------------------------------------------------------------
54
55#if defined(__GNUC__)
56#pragma GCC diagnostic push
57
58#pragma GCC diagnostic ignored "-Waggregate-return"
59#if defined(__clang__)
60#pragma clang diagnostic ignored "-Wc++98-compat"
61#endif // defined(__clang__)
62#endif // defined(__GNUC__)
63
79{
80 // ==========================================================================
81
98 {
99 public:
103 constexpr doubly_list_links_base () noexcept;
104
105 // This class follows the rule of five.
106
116
125
136 = delete;
137
147 = delete;
148
152 constexpr ~doubly_list_links_base ();
153
162 [[nodiscard]] bool
163 initialised (void) const noexcept;
164
173 constexpr void
174 initialise (void) noexcept;
175
184 bool
185 initialise_once (void) noexcept;
186
194 void
195 link_next (doubly_list_links_base* node) noexcept;
196
204 void
206
215 void
216 unlink (void) noexcept;
217
226 [[nodiscard]] constexpr bool
227 linked (void) const noexcept;
228
236 [[nodiscard]] constexpr doubly_list_links_base*
237 next (void) const noexcept;
238
246 [[nodiscard]] constexpr doubly_list_links_base*
247 previous (void) const noexcept;
248
249 protected:
254
259 };
260
261 // ==========================================================================
262
281 {
282 public:
287 using is_statically_allocated = std::false_type;
288
292 constexpr doubly_list_links () noexcept;
293
294 // This class follows the rule of five.
295
305
314
324 operator= (const doubly_list_links&)
325 = delete;
326
335 operator= (doubly_list_links&&)
336 = delete;
337
345 constexpr ~doubly_list_links ();
346 };
347
348 // ==========================================================================
349
381 {
382 public:
386 using is_statically_allocated = std::true_type;
387
392 constexpr static_doubly_list_links () noexcept;
393
403
413
423 operator= (const static_doubly_list_links&)
424 = delete;
425
435 = delete;
436
440 constexpr ~static_doubly_list_links ();
441
450 constexpr void
451 reset (void) noexcept;
452 };
453
454 // ==========================================================================
455
466 template <class T>
468 = std::derived_from<T, doubly_list_links_base>;
469
470 // --------------------------------------------------------------------------
471} // namespace micro_os_plus::utils
472
473#if defined(__GNUC__)
474#pragma GCC diagnostic pop
475#endif // defined(__GNUC__)
476
477// ----------------------------------------------------------------------------
478
479#endif // defined(__cplusplus)
480
481// ============================================================================
482// Templates & constexpr implementations.
483
485
486// ----------------------------------------------------------------------------
487
488#endif // MICRO_OS_PLUS_UTILS_LISTS_DOUBLY_LIST_LINKS_H_
489
490// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.