libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
A general-purpose, atomic counter class, similar to the atomic integer types in C++11 ch 29. More...
#include <atomic_counter.hpp>
Public Types | |
typedef sp_counter_itf_type< V > | base_t |
typedef LkT | lock_traits |
typedef lock_traits::recursive_critical_section_type | atomic_t |
typedef base_t::value_type | value_type |
![]() | |
typedef V | value_type |
typedef default_delete< sp_counter_itf_type > | deleter_t |
The default deletion method for objects that inherit from this intrusively-counted type, which is just heap-deletion, if the objects are heap-allocated. More... | |
Public Member Functions | |
constexpr | atomic_ctr_gen () noexcept(noexcept(value_type()) &&noexcept(atomic_t())) FORCE_INLINE |
constexpr | atomic_ctr_gen (const value_type v) noexcept(noexcept(value_type(std::declval< value_type >())) &&noexcept(atomic_t())) FORCE_INLINE |
constexpr | atomic_ctr_gen (const atomic_ctr_gen &) noexcept(false) FORCE_INLINE |
template<class V1 > | |
constexpr | atomic_ctr_gen (const atomic_ctr_gen< V1, LkT > &) noexcept(false) FORCE_INLINE |
template<class V1 > | |
atomic_ctr_gen (atomic_ctr_gen< V1, LkT > &&) noexcept(true) FORCE_INLINE | |
~atomic_ctr_gen () noexcept(true) | |
void | swap (atomic_ctr_gen &rhs) noexcept(true) FORCE_INLINE |
template<class V1 , class V2 = V1> | |
std::enable_if< std::is_pointer< V2 >::value, void >::type | swap (atomic_ctr_gen< V1, LkT > &rhs) noexcept(true) FORCE_INLINE |
template<class V1 , class V2 = V1> | |
std::enable_if< std::is_pointer< V2 >::value, void >::type __fastcall | operator= (const atomic_ctr_gen< V1, LkT > &v) noexcept(true) FORCE_INLINE |
void __fastcall | operator= (const atomic_ctr_gen &) noexcept(true) FORCE_INLINE |
void __fastcall | operator= (const value_type &) noexcept(true) FORCE_INLINE |
constexpr bool FORCE_INLINE | sp_noop_ctr () const noexcept(true) override |
constexpr value_type const &__fastcall | get () const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator! () const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator== (const value_type) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator== (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator!= (const value_type) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator!= (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator< (const value_type) const noexcept(true) FORCE_INLINE override |
constexpr bool __fastcall | operator< (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator< (base_t const &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator> (const value_type) const noexcept(true) override |
constexpr bool __fastcall | operator> (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator> (base_t const &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator<= (const value_type) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator<= (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator>= (const value_type) const noexcept(true) override |
constexpr bool __fastcall | operator>= (const atomic_ctr_gen &) const noexcept(true) FORCE_INLINE |
value_type __fastcall | operator++ () noexcept(true) FORCE_INLINE |
value_type __fastcall | operator++ (int) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-- () noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-- (int) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator+= (const value_type) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator+= (const atomic_ctr_gen &) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-= (const value_type) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-= (const atomic_ctr_gen &) noexcept(true) FORCE_INLINE |
template<class V1 = value_type> | |
std::enable_if< std::is_pointer< V1 >::value, V1 >::type FORCE_INLINE | operator-> () const noexcept(true) |
template<class BinOp > | |
value_type __fastcall | apply (typename BinOp::second_argument_type const &a, BinOp const &op) noexcept(noexcept(op.operator()(std::declval< value_type >(), std::declval< typename BinOp::second_argument_type >()))) FORCE_INLINE |
template<class V1 > | |
value_type __fastcall | apply (V1 const &a, std::plus< V1 > const &) noexcept(true) FORCE_INLINE |
template<class V1 > | |
value_type __fastcall | apply (V1 const &a, std::minus< V1 > const &) noexcept(true) FORCE_INLINE |
bool | compare_exchange_strong (value_type expected, value_type desired) noexcept(true) FORCE_INLINE |
template<class V1 , class V2 = V1> | |
std::enable_if< std::is_pointer< V2 >::value, bool >::type | compare_exchange_strong (value_type expected, V1 desired) noexcept(true) FORCE_INLINE |
template<class Op > | |
atomic_ctr_gen | assign (Op &&op) noexcept(true) FORCE_INLINE |
template<class V1 , class V2 > | |
std::enable_if< std::is_pointer< V2 >::value, void >::type | operator= (const atomic_ctr_gen< V1, LkT > &a) noexcept(true) |
template<class BinOp > | |
atomic_ctr_gen< V, LkT >::value_type | apply (typename BinOp::second_argument_type const &a, BinOp const &op) noexcept(noexcept(op.operator()(std::declval< value_type >(), std::declval< typename BinOp::second_argument_type >()))) |
template<class V1 > | |
atomic_ctr_gen< V, LkT >::value_type | apply (V1 const &a, std::plus< V1 > const &) noexcept(true) |
template<class V1 > | |
atomic_ctr_gen< V, LkT >::value_type | apply (V1 const &a, std::minus< V1 > const &) noexcept(true) |
template<class Op > | |
atomic_ctr_gen< V, LkT > | assign (Op &&op) noexcept(true) |
![]() | |
virtual | ~sp_counter_itf_type () |
virtual value_type | sp_count () const noexcept(true) |
virtual value_type | sp_acquire () noexcept(true) |
virtual bool | sp_release () noexcept(true) |
constexpr bool FORCE_INLINE | operator== (const value_type v) const noexcept(true) |
virtual void | deleter () |
Call the correct deleter_t object to delete the object. More... | |
virtual tstring | sp_to_string () const noexcept(false) |
Static Public Attributes | |
static constexpr generic_traits::memory_access_modes | memory_access_mode =generic_traits::memory_access_modes::erew_memory_access |
![]() | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode =ppd::generic_traits::memory_access_modes::crew_memory_access |
Protected Attributes | |
value_type | count |
atomic_t | locker |
Friends | |
template<class V1 , class LkT1 > | |
class | atomic_ctr_gen |
Additional Inherited Members | |
![]() | |
constexpr | sp_counter_itf_type () noexcept(true) |
A general-purpose, atomic counter class, similar to the atomic integer types in C++11 ch 29.
Note that this class is a valid value-type. Also note that this class reduces to a simple V-type, if it is single threaded, so costs nothing.
Definition at line 125 of file atomic_counter.hpp.
typedef lock_traits::recursive_critical_section_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::atomic_t |
Definition at line 129 of file atomic_counter.hpp.
typedef sp_counter_itf_type<V> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::base_t |
Definition at line 127 of file atomic_counter.hpp.
typedef LkT jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::lock_traits |
Definition at line 128 of file atomic_counter.hpp.
typedef base_t::value_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::value_type |
Definition at line 130 of file atomic_counter.hpp.
|
inlineconstexprnoexcept |
Definition at line 22 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlineexplicitconstexprnoexcept |
Definition at line 27 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlineconstexprnoexcept |
Definition at line 32 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlineconstexprnoexcept |
Definition at line 39 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 47 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 54 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 239 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
noexcept |
|
inlinenoexcept |
Definition at line 257 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 249 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 290 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 276 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 263 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlineconstexprnoexcept |
Definition at line 98 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 123 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 118 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 113 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 178 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 185 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlinenoexcept |
Definition at line 213 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 206 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 192 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 199 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlinenoexcept |
Definition at line 228 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 221 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 196 of file atomic_counter.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 137 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 132 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 127 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 162 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 157 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlinenoexcept |
Definition at line 75 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 84 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
noexcept |
|
inlinenoexcept |
Definition at line 92 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlineconstexprnoexcept |
Definition at line 108 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 103 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 153 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 148 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 143 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 168 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 173 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
This is a hack: we could use a dynamic_cast to check this, but in GCC dynamic_casts involve strcmps which may be slowish, so use a virtual thunk instead, which should be faster.
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 153 of file atomic_counter.hpp.
|
inlinenoexcept |
Definition at line 58 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
|
inlinenoexcept |
Definition at line 67 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::count, and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::locker.
Definition at line 210 of file atomic_counter.hpp.
|
protected |
Definition at line 212 of file atomic_counter.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::apply(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::atomic_ctr_gen(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::compare_exchange_strong(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::get(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator++(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator+=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator--(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator-=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator->(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator<(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator<=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator==(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator>(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator>=(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::swap().
|
mutableprotected |
Definition at line 213 of file atomic_counter.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::apply(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::atomic_ctr_gen(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::compare_exchange_strong(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator++(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator+=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator--(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator-=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::operator=(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_gen< V, LkT >::swap().
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model.
Definition at line 134 of file atomic_counter.hpp.