Skip to main content

doubly-list-links-inlines.h File

C++ header file with the inline implementations for the doubly_list_links_base, doubly_list_links, and static_doubly_list_links classes. More...

Namespaces Index

namespacemicro_os_plus

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

namespaceutils

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

Description

C++ header file with the inline implementations for the doubly_list_links_base, doubly_list_links, and static_doubly_list_links classes.

Class definitions are located in doubly-list-links.h. Inline methods are separated into this file to improve project structure and maintainability.

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// ----------------------------------------------------------------------------
13
14#if !defined(MICRO_OS_PLUS_UTILS_LISTS_DOUBLY_LIST_LINKS_H_)
15#error \
16 "Do not include this file directly; use micro-os-plus/utils/doubly-list-links.h."
17#endif // MICRO_OS_PLUS_UTILS_LISTS_DOUBLY_LIST_LINKS_H_
18
30
31#ifndef MICRO_OS_PLUS_UTILS_LISTS_INLINES_DOUBLY_LIST_LINKS_INLINES_H_
32#define MICRO_OS_PLUS_UTILS_LISTS_INLINES_DOUBLY_LIST_LINKS_INLINES_H_
33
34// ----------------------------------------------------------------------------
35
36#if defined(__cplusplus)
37
38// ----------------------------------------------------------------------------
39
40#if defined(__GNUC__)
41#pragma GCC diagnostic push
42
43#pragma GCC diagnostic ignored "-Waggregate-return"
44#if defined(__clang__)
45#pragma clang diagnostic ignored "-Wc++98-compat"
46#endif // defined(__clang__)
47#endif // defined(__GNUC__)
48
49// ----------------------------------------------------------------------------
50
52{
53 // ==========================================================================
54
83 {
84 // Must be empty! No members must be changed by this constructor!
85 }
86
101 {
102 // Must be empty! No members must be changed by this destructor!
103 }
104
119 constexpr void
121 {
122 previous_ = this;
123 next_ = this;
124 }
125
126#if defined(__GNUC__)
127#pragma GCC diagnostic push
128
129#if defined(__clang__)
130#else
131#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
132#endif // defined(__clang__)
133#endif // defined(__GNUC__)
134
146 constexpr doubly_list_links_base*
147 doubly_list_links_base::next (void) const noexcept
148 {
149 return next_;
150 }
151
163 constexpr doubly_list_links_base*
165 {
166 return previous_;
167 }
168
176 constexpr bool
177 doubly_list_links_base::linked (void) const noexcept
178 {
179 if (next_ == this || previous_ == this)
180 {
181 assert (next_ == this);
182 assert (previous_ == this);
183 return false;
184 }
185 return true;
186 }
187
188#if defined(__GNUC__)
189#pragma GCC diagnostic pop
190#endif // defined(__GNUC__)
191
192 // ==========================================================================
193
221 {
222 // Must be empty! No members must be changed by this constructor!
223 }
224
232 {
233 reset ();
234 }
235
249 constexpr void
251 {
252 // Force actual writes, even if the compiler could otherwise prove that
253 // the values are never read afterwards (dead store elimination).
254 *const_cast<doubly_list_links_base* volatile*> (&next_) = nullptr;
255 *const_cast<doubly_list_links_base* volatile*> (&previous_) = nullptr;
256 }
257
258 // ==========================================================================
259
284 {
285 // For regular (non static) classes the members
286 // must be explicitly initialised.
287 initialise ();
288 }
289
296 {
297 }
298
299 // --------------------------------------------------------------------------
300} // namespace micro_os_plus::utils
301
302#if defined(__GNUC__)
303#pragma GCC diagnostic pop
304#endif // defined(__GNUC__)
305
306// ----------------------------------------------------------------------------
307
308#endif // defined(__cplusplus)
309
310// ----------------------------------------------------------------------------
311
312#endif // MICRO_OS_PLUS_UTILS_LISTS_INLINES_DOUBLY_LIST_LINKS_INLINES_H_
313
314// ----------------------------------------------------------------------------

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.