intrusive-list-inlines.h File
C++ header file with the inline implementations for the intrusive_list_iterator and intrusive_list class templates. More...
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | utils |
|
The µOS++ utilities definitions. More... | |
Description
C++ header file with the inline implementations for the intrusive_list_iterator and intrusive_list class templates.
Class definitions are located in intrusive-list.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:
50namespace micro_os_plus::utils
67 constexpr intrusive_list_iterator<T, N, MP,
68 U>::intrusive_list_iterator () noexcept
69 : node_{}
84 : node_{ node }
98 reference element) noexcept
100 : node_{ &(element.*MP) }
114 intrusive_list_iterator<T, N, MP, U>::operator->() const noexcept
116 return get_pointer ();
131 inline typename intrusive_list_iterator<T, N, MP, U>::reference
132 intrusive_list_iterator<T, N, MP, U>::operator*() const noexcept
134 return *get_pointer ();
146 constexpr intrusive_list_iterator<T, N, MP, U>&
149 node_ = static_cast<iterator_pointer> (node_->next ());
162 constexpr intrusive_list_iterator<T, N, MP, U>
163 intrusive_list_iterator<T, N, MP, U>::operator++(int) noexcept
166 node_ = static_cast<iterator_pointer> (node_->next ());
179 constexpr intrusive_list_iterator<T, N, MP, U>&
182 node_ = static_cast<iterator_pointer> (node_->previous ());
195 constexpr intrusive_list_iterator<T, N, MP, U>
196 intrusive_list_iterator<T, N, MP, U>::operator--(int) noexcept
199 node_ = static_cast<iterator_pointer> (node_->previous ());
214 const intrusive_list_iterator& other) const noexcept
216 return node_ == other.node_;
229 inline typename intrusive_list_iterator<T, N, MP, U>::pointer
230 intrusive_list_iterator<T, N, MP, U>::get_pointer (void) const noexcept
241 const auto offset = reinterpret_cast<difference_type> (
246 return reinterpret_cast<pointer> (reinterpret_cast<difference_type> (node_)
257 constexpr typename intrusive_list_iterator<T, N, MP, U>::iterator_pointer
258 intrusive_list_iterator<T, N, MP, U>::get_iterator_pointer () const noexcept
260 return node_;
280 template <class T, doubly_list_links_node N, N T::* MP,
281 doubly_list_links_node L, class U>
282 constexpr intrusive_list<T, N, MP, L, U>::intrusive_list () noexcept
296 template <class T, doubly_list_links_node N, N T::* MP,
297 doubly_list_links_node L, class U>
298 constexpr intrusive_list<T, N, MP, L, U>::~intrusive_list ()
316 template <class T, doubly_list_links_node N, N T::* MP,
317 doubly_list_links_node L, class U>
319 intrusive_list<T, N, MP, L, U>::initialise_once (void) noexcept
321 return doubly_list<N, L>::initialise_once ();
331 template <class T, doubly_list_links_node N, N T::* MP,
332 doubly_list_links_node L, class U>
334 intrusive_list<T, N, MP, L, U>::empty (void) const noexcept
336 return doubly_list<N, L>::empty ();
348 template <class T, doubly_list_links_node N, N T::* MP,
349 doubly_list_links_node L, class U>
351 intrusive_list<T, N, MP, L, U>::link_tail (U& node) noexcept
363 const auto offset = reinterpret_cast<difference_type> (
367 (const_cast<N*> (doubly_list<N, L>::tail ()))
369 reinterpret_cast<difference_type> (&node) + offset));
381 template <class T, doubly_list_links_node N, N T::* MP,
382 doubly_list_links_node L, class U>
384 intrusive_list<T, N, MP, L, U>::link_head (U& node) noexcept
396 const auto offset = reinterpret_cast<difference_type> (
400 (const_cast<N*> (doubly_list<N, L>::head ()))
402 reinterpret_cast<difference_type> (&node) + offset));
419 template <class T, doubly_list_links_node N, N T::* MP,
420 doubly_list_links_node L, class U>
421 inline typename intrusive_list<T, N, MP, L, U>::iterator
422 intrusive_list<T, N, MP, L, U>::begin () const noexcept
430 return iterator{ static_cast<iterator_pointer> (
431 doubly_list<N, L>::links_.next ()) };
442 template <class T, doubly_list_links_node N, N T::* MP,
443 doubly_list_links_node L, class U>
444 inline typename intrusive_list<T, N, MP, L, U>::iterator
445 intrusive_list<T, N, MP, L, U>::end () const noexcept
454 using links_type_ = typename doubly_list<N, L>::links_type;
455 return iterator{ reinterpret_cast<iterator_pointer> (
456 const_cast<links_type_*> (doubly_list<N, L>::links_pointer ())) };
465 template <class T, doubly_list_links_node N, N T::* MP,
466 doubly_list_links_node L, class U>
467 inline typename intrusive_list<T, N, MP, L, U>::reverse_iterator
468 intrusive_list<T, N, MP, L, U>::rbegin () const noexcept
470 return reverse_iterator{ end () };
479 template <class T, doubly_list_links_node N, N T::* MP,
480 doubly_list_links_node L, class U>
481 inline typename intrusive_list<T, N, MP, L, U>::reverse_iterator
482 intrusive_list<T, N, MP, L, U>::rend () const noexcept
484 return reverse_iterator{ begin () };
500 template <class T, doubly_list_links_node N, N T::* MP,
501 doubly_list_links_node L, class U>
502 inline typename intrusive_list<T, N, MP, L, U>::pointer
504 iterator_pointer node) const noexcept
512 const auto offset = reinterpret_cast<difference_type> (
517 return reinterpret_cast<pointer> (reinterpret_cast<difference_type> (node)
528 template <class T, doubly_list_links_node N, N T::* MP,
529 doubly_list_links_node L, class U>
530 [[nodiscard]] typename intrusive_list<T, N, MP, L, U>::pointer
531 intrusive_list<T, N, MP, L, U>::unlink_head (void) noexcept
537 if (empty ())
543 iterator_pointer it
544 = static_cast<iterator_pointer> (doubly_list<N, L>::links_.next ());
547 return get_pointer (it);
557 template <class T, doubly_list_links_node N, N T::* MP,
558 doubly_list_links_node L, class U>
559 [[nodiscard]] typename intrusive_list<T, N, MP, L, U>::pointer
560 intrusive_list<T, N, MP, L, U>::unlink_tail (void) noexcept
566 if (empty ())
572 iterator_pointer it = static_cast<iterator_pointer> (
573 doubly_list<N, L>::links_.previous ());
576 return get_pointer (it);
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.