libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
A "good enough for PPD" implementation of a singly-linked, hybrid, intrusive, pointer-based stack. More...
#include <intrusive.hpp>
Public Types | |
using | lock_traits = typename node_details_t::lock_traits |
typedef std::size_t | size_type |
typedef shared_ptr< V, LkT > | value_type |
typedef lock_traits::template atomic_counter_type< unsigned long > | size_ctr_t |
typedef private_::slist_iterator_internal< V, LkT > | iterator |
typedef private_::slist_iterator_internal< V const, LkT > | const_iterator |
typedef iterator::difference_type | difference_type |
typedef iterator::pointer | pointer |
typedef iterator::reference | reference |
typedef const_iterator::const_pointer | const_pointer |
typedef const_iterator::const_reference | const_reference |
typedef value_type::deleter_t | deleter_t |
typedef value_type::ctr_type | ctr_type |
typedef value_type::exception_type | exception_type |
Public Member Functions | |
BOOST_MPL_ASSERT ((std::is_base_of< typename node_details_t::base_t, typename value_type::value_type >)) | |
__stdcall | stack () noexcept(true) FORCE_INLINE |
stack (stack const &)=delete | |
stack (stack &&) noexcept(true) FORCE_INLINE | |
virtual __stdcall | ~stack () noexcept(true) FORCE_INLINE |
iterator __fastcall | begin () noexcept(true) FORCE_INLINE |
const_iterator __fastcall | begin () const noexcept(true) FORCE_INLINE |
iterator __fastcall | end () noexcept(true) FORCE_INLINE |
const_iterator __fastcall | end () const noexcept(true) FORCE_INLINE |
bool __fastcall | empty () const noexcept(true) FORCE_INLINE |
Return true if the container is empty, false otherwise. More... | |
size_type __fastcall | size () const noexcept(true) FORCE_INLINE |
Atomically return the number of elements in the container. More... | |
size_type __fastcall | size_n () const noexcept(true) FORCE_INLINE |
Non-atomically return the number of elements in the container. More... | |
void __fastcall | erase (iterator v) noexcept(true) FORCE_INLINE |
Remove the element from the container. More... | |
size_type __fastcall | erase (const_reference v) noexcept(true) FORCE_INLINE |
Non-atomically remove the element from the container. More... | |
void __fastcall | clear () noexcept(true) FORCE_INLINE |
Remove all of the elements from the container. More... | |
value_type __fastcall | top () noexcept(true) FORCE_INLINE |
value_type __fastcall | top () const noexcept(true) FORCE_INLINE |
void __fastcall | push (value_type const &v) noexcept(true) FORCE_INLINE |
void __fastcall | push (value_type &&v) noexcept(true) FORCE_INLINE |
void __fastcall | push_front (value_type const &v) noexcept(true) FORCE_INLINE |
void __fastcall | push_front (value_type &&v) noexcept(true) FORCE_INLINE |
void __fastcall | pop () noexcept(true) FORCE_INLINE |
void __fastcall | pop_front () noexcept(true) FORCE_INLINE |
value_type __fastcall | pop_top_nochk () noexcept(true) FORCE_INLINE |
Static Public Attributes | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode |
Protected Types | |
using | node_details_t = private_::node_details< LkT > |
using | atomic_ptr_t = typename node_details_t::base_t::atomic_ptr_t |
Protected Member Functions | |
node_details_t::base_t::atomic_ptr_t | unlink_node (typename node_details_t::base_t::atomic_ptr_t &node) noexcept(true) FORCE_INLINE |
void | insert (value_type v) noexcept(true) FORCE_INLINE |
Static Protected Member Functions | |
static void | insert (typename node_details_t::base_t::atomic_ptr_t i, value_type v) noexcept(true) FORCE_INLINE |
Protected Attributes | |
node_details_t | prefront_ |
size_ctr_t | size_ctr |
A "good enough for PPD" implementation of a singly-linked, hybrid, intrusive, pointer-based stack.
When inserting a node, no memory allocations are required, which is good in a multi-threading environment as it reduces calls to any memory allocator. If you don't like the cut-down interface of this container, blame YAGNI & TDD.
Definition at line 309 of file intrusive.hpp.
|
protected |
Definition at line 312 of file intrusive.hpp.
typedef private_::slist_iterator_internal<V const, LkT> jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::const_iterator |
Definition at line 320 of file intrusive.hpp.
typedef const_iterator::const_pointer jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::const_pointer |
Definition at line 324 of file intrusive.hpp.
typedef const_iterator::const_reference jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::const_reference |
Definition at line 325 of file intrusive.hpp.
typedef value_type::ctr_type jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::ctr_type |
Definition at line 328 of file intrusive.hpp.
typedef value_type::deleter_t jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::deleter_t |
Definition at line 327 of file intrusive.hpp.
typedef iterator::difference_type jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::difference_type |
Definition at line 321 of file intrusive.hpp.
typedef value_type::exception_type jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::exception_type |
Definition at line 329 of file intrusive.hpp.
typedef private_::slist_iterator_internal<V, LkT> jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::iterator |
Definition at line 319 of file intrusive.hpp.
using jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::lock_traits = typename node_details_t::lock_traits |
Definition at line 315 of file intrusive.hpp.
|
protected |
Definition at line 311 of file intrusive.hpp.
typedef iterator::pointer jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::pointer |
Definition at line 322 of file intrusive.hpp.
typedef iterator::reference jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::reference |
Definition at line 323 of file intrusive.hpp.
typedef lock_traits::template atomic_counter_type<unsigned long> jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr_t |
Definition at line 318 of file intrusive.hpp.
typedef std::size_t jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_type |
Definition at line 316 of file intrusive.hpp.
typedef shared_ptr<V, LkT> jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::value_type |
Definition at line 317 of file intrusive.hpp.
|
inlinenoexcept |
Definition at line 46 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr.
|
delete |
|
inlinenoexcept |
Definition at line 55 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr.
|
inlinevirtualnoexcept |
Algorithmic complexity: O(n)
Definition at line 176 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 85 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 79 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_.
jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::BOOST_MPL_ASSERT | ( | (std::is_base_of< typename node_details_t::base_t, typename value_type::value_type >) | ) |
|
inlinenoexcept |
Remove all of the elements from the container.
Calls the dtor for each element within the container. Algorithmic complexity: O(n)
Definition at line 167 of file intrusive_impl.hpp.
|
inlinenoexcept |
Return true if the container is empty, false otherwise.
Algorithmic complexity: O(1)
Definition at line 23 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 97 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 91 of file intrusive_impl.hpp.
|
inlinenoexcept |
Non-atomically remove the element from the container.
Algorithmic complexity: O(n).
v | The value equivalent to the element to be removed. |
Definition at line 146 of file intrusive_impl.hpp.
|
inlinenoexcept |
Remove the element from the container.
Algorithmic complexity: O(1)
v | Iterator to the element to be removed. |
Definition at line 129 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::unlink_node().
|
inlinestaticprotectednoexcept |
Algorithmic complexity: O(1)
i | The iterator immediately after which the element should be added. |
v | The element to be added. |
Definition at line 182 of file intrusive_impl.hpp.
|
inlineprotectednoexcept |
Definition at line 202 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 111 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::unlink_node().
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 161 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1) This method assumes that only one thread is popping at a time, and that the container is not empty.
Definition at line 246 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_, and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::unlink_node().
|
inlinenoexcept |
Algorithmic complexity: O(1)
v | The element to be added. |
Definition at line 228 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
v | The element to be added. |
Definition at line 222 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
v | The element to be added. |
Definition at line 240 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
v | The element to be added. |
Definition at line 234 of file intrusive_impl.hpp.
|
inlinenoexcept |
Atomically return the number of elements in the container.
Algorithmic complexity: O(1)
Definition at line 30 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size_ctr.
|
inlinenoexcept |
Non-atomically return the number of elements in the container.
Algorithmic complexity: O(n) Mainly used for verifying list integrity in testing. Not much use for anything else.
Definition at line 36 of file intrusive_impl.hpp.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 71 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_.
|
inlinenoexcept |
Algorithmic complexity: O(1)
Definition at line 63 of file intrusive_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::prefront_.
|
inlineprotectednoexcept |
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 333 of file intrusive.hpp.
|
mutableprotected |
Definition at line 460 of file intrusive.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::begin(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::insert(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::pop(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::pop_top_nochk(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::stack(), and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::top().
|
protected |
Definition at line 461 of file intrusive.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::empty(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::erase(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::insert(), jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::size(), and jmmcg::LIBJMMCG_VER_NAMESPACE::intrusive::stack< V, LkT >::stack().