libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
|
An atomic counter class for integer types, 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 base_t::value_type | value_type |
typedef std::atomic< value_type > | atomic_t |
![]() | |
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 __stdcall | atomic_ctr_opt () noexcept(true) FORCE_INLINE |
constexpr __stdcall | atomic_ctr_opt (const value_type) noexcept(true) FORCE_INLINE |
constexpr | atomic_ctr_opt (const atomic_ctr_opt &) noexcept(true) FORCE_INLINE |
template<class V1 > | |
constexpr | atomic_ctr_opt (const atomic_ctr_opt< V1, LkT > &) noexcept(true) FORCE_INLINE |
template<class V1 > | |
atomic_ctr_opt (atomic_ctr_opt< V1, LkT > &&) noexcept(true) FORCE_INLINE | |
~atomic_ctr_opt () 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_opt< V1, LkT > &v) noexcept(true) FORCE_INLINE |
void __fastcall | operator= (const atomic_ctr_opt &) noexcept(true) FORCE_INLINE |
void __fastcall | operator= (const value_type &) noexcept(true) FORCE_INLINE |
void | swap (atomic_ctr_opt &) noexcept(true) FORCE_INLINE |
template<class V1 , class V2 = V1> | |
std::enable_if< std::is_pointer< V2 >::value, void >::type | swap (atomic_ctr_opt< V1, LkT > &rhs) noexcept(true) FORCE_INLINE |
constexpr bool | sp_noop_ctr () const noexcept(true) override __attribute__((const)) |
constexpr value_type __fastcall | get () const noexcept(true) FORCE_INLINE |
constexpr | operator bool () const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator== (const value_type) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator== (const atomic_ctr_opt &) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator!= (const value_type) const noexcept(true) FORCE_INLINE |
constexpr bool __fastcall | operator!= (const atomic_ctr_opt &) 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_opt &) 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 override |
constexpr bool __fastcall | operator> (const atomic_ctr_opt &) 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_opt &) 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_opt &) 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_opt &) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-= (const value_type) noexcept(true) FORCE_INLINE |
value_type __fastcall | operator-= (const atomic_ctr_opt &) 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_opt | 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_opt< V1, LkT > &a) noexcept(true) |
template<class BinOp > | |
atomic_ctr_opt< 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_opt< V, LkT >::value_type | apply (V1 const &a, std::plus< V1 > const &) noexcept(true) |
template<class V1 > | |
atomic_ctr_opt< V, LkT >::value_type | apply (V1 const &a, std::minus< V1 > const &) noexcept(true) |
template<class Op > | |
atomic_ctr_opt< 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::crew_memory_access |
![]() | |
static constexpr ppd::generic_traits::memory_access_modes | memory_access_mode =ppd::generic_traits::memory_access_modes::crew_memory_access |
Protected Attributes | |
atomic_t | count |
Friends | |
template<class V1 , class LkT1 > | |
class | atomic_ctr_opt |
Additional Inherited Members | |
![]() | |
constexpr | sp_counter_itf_type () noexcept(true) |
An atomic counter class for integer types, 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 401 of file atomic_counter.hpp.
typedef std::atomic<value_type> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::atomic_t |
Definition at line 406 of file atomic_counter.hpp.
typedef sp_counter_itf_type<V> jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::base_t |
Definition at line 403 of file atomic_counter.hpp.
typedef LkT jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::lock_traits |
Definition at line 404 of file atomic_counter.hpp.
typedef base_t::value_type jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::value_type |
Definition at line 405 of file atomic_counter.hpp.
|
inlineconstexprnoexcept |
Definition at line 299 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineexplicitconstexprnoexcept |
Definition at line 304 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 309 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 316 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 324 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 331 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 535 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
noexcept |
|
inlinenoexcept |
Definition at line 558 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 549 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 566 of file atomic_counter_impl.hpp.
|
noexcept |
|
inlinenoexcept |
Definition at line 526 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 518 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 373 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineexplicitconstexprnoexcept |
Definition at line 403 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 397 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 391 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 469 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 475 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 499 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 493 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 481 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 487 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 511 of file atomic_counter_impl.hpp.
|
inlinenoexcept |
Definition at line 505 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 487 of file atomic_counter.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 420 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 414 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 408 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 450 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 444 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 361 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 354 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
noexcept |
|
inlinenoexcept |
Definition at line 367 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 385 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 379 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 439 of file atomic_counter_impl.hpp.
|
inlineconstexprnoexcept |
Definition at line 433 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 427 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexprnoexcept |
Definition at line 457 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlineconstexproverridevirtualnoexcept |
Reimplemented from jmmcg::LIBJMMCG_VER_NAMESPACE::sp_counter_itf_type< V >.
Definition at line 463 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< 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 444 of file atomic_counter.hpp.
|
inlinenoexcept |
Definition at line 336 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
|
inlinenoexcept |
Definition at line 344 of file atomic_counter_impl.hpp.
References jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::count.
Definition at line 501 of file atomic_counter.hpp.
|
protected |
Definition at line 503 of file atomic_counter.hpp.
Referenced by jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::apply(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::atomic_ctr_opt(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::compare_exchange_strong(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::get(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator bool(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator++(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator+=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator--(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator-=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator->(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator<(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator<=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator=(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator==(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator>(), jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::operator>=(), and jmmcg::LIBJMMCG_VER_NAMESPACE::ppd::atomic_ctr_opt< V, LkT >::swap().
|
staticconstexpr |
To assist in allowing compile-time computation of the algorithmic order of the threading model. \todo Consider using to define this, equals 0 (never lockfree) or 2 (always lockfree):
ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE
ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
ATOMIC_INT_LOCK_FREE
ATOMIC_LONG_LOCK_FREE
ATOMIC_LLONG_LOCK_FREE
ATOMIC_POINTER_LOCK_FREE
Definition at line 421 of file atomic_counter.hpp.