|
zpp
Zephyr C++20 Framework
|
class wrapping an atomic_var_t More...
#include <atomic_var.hpp>
Public Types | |
| using | value_type = atomic_val_t |
| the type used to store the value More... | |
Public Member Functions | |
| constexpr | atomic_var () noexcept=default |
| default constructor that sets the value to 0 More... | |
| atomic_var (value_type v) noexcept | |
| constructor that sets the value to v More... | |
| atomic_var (const atomic_var &rhs) noexcept | |
| copy constructor More... | |
| atomic_var & | operator= (const atomic_var &rhs) noexcept |
| copy operator More... | |
| constexpr size_t | bit_count () const noexcept |
| the size in bits of value_type More... | |
| bool | cas (value_type old_val, value_type new_val) noexcept |
| Atomic compare-and-set. More... | |
| value_type | fetch_add (value_type val) noexcept |
| Atomic addition. More... | |
| value_type | fetch_sub (value_type val) noexcept |
| Atomic substraction. More... | |
| value_type | fetch_or (value_type val) noexcept |
| Atomic bitwise OR. More... | |
| value_type | fetch_xor (value_type val) noexcept |
| Atomic bitwise XOR. More... | |
| value_type | fetch_and (value_type val) noexcept |
| Atomic bitwise AND. More... | |
| value_type | fetch_nand (value_type val) noexcept |
| Atomic bitwise NAND. More... | |
| value_type | fetch_inc () noexcept |
| Atomic increment. More... | |
| value_type | fetch_dec () noexcept |
| Atomic decrement. More... | |
| value_type | load () const noexcept |
| Atomically loads and returns the current value of the atomic variable. More... | |
| value_type | store (value_type val) noexcept |
| Atomically replace current value of the atomic variable. More... | |
| value_type | clear () noexcept |
| Atomically clear the atomic variable. More... | |
| bool | load (size_t bit) const noexcept |
| atomically get a bit from the bitset More... | |
| void | store (size_t bit, bool val) noexcept |
| atomically set a bit a value More... | |
| void | set (size_t bit) noexcept |
| atomically set a bit to true/1 More... | |
| void | clear (size_t bit) noexcept |
| atomically set a bit to false/0 More... | |
| bool | fetch_and_clear (size_t bit) noexcept |
| atomically clear a bit while returning the previous value. More... | |
| bool | fetch_and_set (size_t bit) noexcept |
| atomically set a bit while returning the previous value. More... | |
| operator value_type () const noexcept | |
| Atomically loads and returns the current value of the atomic variable. More... | |
| value_type | operator= (value_type val) noexcept |
| Atomically replace current value of the atomic variable. More... | |
| value_type | operator++ () noexcept |
| Perform atomic pre-increment. More... | |
| value_type | operator++ (int) noexcept |
| Perform atomic post-increment. More... | |
| value_type | operator-- () noexcept |
| Perform atomic pre-decrement. More... | |
| value_type | operator-- (int) noexcept |
| Perform atomic post-decrement. More... | |
| value_type | operator+= (value_type val) noexcept |
| Perform atomic addition. More... | |
| value_type | operator-= (value_type val) noexcept |
| Perform atomic substraction. More... | |
| value_type | operator&= (value_type val) noexcept |
| Perform atomic bitwise AND. More... | |
| value_type | operator|= (value_type val) noexcept |
| Perform atomic bitwise OR. More... | |
| value_type | operator^= (value_type val) noexcept |
| Perform atomic bitwise XOR. More... | |
class wrapping an atomic_var_t
Definition at line 20 of file atomic_var.hpp.
| using zpp::atomic_var::value_type = atomic_val_t |
the type used to store the value
Definition at line 25 of file atomic_var.hpp.
|
constexprdefaultnoexcept |
default constructor that sets the value to 0
|
inlineexplicitnoexcept |
constructor that sets the value to v
| v | the value to initialize the atomic_var with |
Definition at line 37 of file atomic_var.hpp.
References store().
|
inlinenoexcept |
copy constructor
| rhs | the value to initialize the atomic_var with |
Definition at line 47 of file atomic_var.hpp.
References store().
|
inlineconstexprnoexcept |
the size in bits of value_type
Definition at line 70 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic compare-and-set.
This routine performs an atomic compare-and-set. If the current value equals old_val, the value is set to new_val. If the current value does not equal old_val, the value is unchanged.
| old_val | Original value to compare against. |
| new_val | New value to store. |
Definition at line 88 of file atomic_var.hpp.
|
inlinenoexcept |
Atomically clear the atomic variable.
Definition at line 237 of file atomic_var.hpp.
|
inlinenoexcept |
atomically set a bit to false/0
| bit | the index of the bit to set |
Definition at line 283 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic addition.
Atomically replace the current value with the result of the aritmetic addition of the value and val.
| val | The other argument of the arithmetic addition. |
Definition at line 103 of file atomic_var.hpp.
Referenced by operator++(), and operator+=().
|
inlinenoexcept |
Atomic bitwise AND.
Atomically replace the current value with the result of the bitwise AND of the value and val.
| val | The other argument of the bitwise AND. |
Definition at line 163 of file atomic_var.hpp.
Referenced by operator&=().
|
inlinenoexcept |
atomically clear a bit while returning the previous value.
| bit | the index of the bit to set |
Definition at line 296 of file atomic_var.hpp.
|
inlinenoexcept |
atomically set a bit while returning the previous value.
| bit | the index of the bit to set |
Definition at line 309 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic decrement.
Atomically replace the current value with the result of the aritmetic substraction of the value and 1.
Definition at line 204 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic increment.
Atomically replace the current value with the result of the aritmetic addition of the value and 1.
Definition at line 191 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic bitwise NAND.
Atomically replace the current value with the result of the bitwise NAND of the value and val.
| val | The other argument of the bitwise NAND. |
Definition at line 178 of file atomic_var.hpp.
|
inlinenoexcept |
Atomic bitwise OR.
Atomically replace the current value with the result of the bitwise OR of the value and val.
| val | The other argument of the bitwise OR. |
Definition at line 133 of file atomic_var.hpp.
Referenced by operator|=().
|
inlinenoexcept |
Atomic substraction.
Atomically replace the current value with the result of the aritmetic substraction of the value and val.
| val | The other argument of the arithmetic substraction. |
Definition at line 118 of file atomic_var.hpp.
Referenced by operator--(), and operator-=().
|
inlinenoexcept |
Atomic bitwise XOR.
Atomically replace the current value with the result of the bitwise XOR of the value and val.
| val | The other argument of the bitwise XOR. |
Definition at line 148 of file atomic_var.hpp.
Referenced by operator^=().
|
inlinenoexcept |
Atomically loads and returns the current value of the atomic variable.
Definition at line 215 of file atomic_var.hpp.
Referenced by operator value_type().
|
inlinenoexcept |
atomically get a bit from the bitset
| bit | the index of the bit to return |
Definition at line 249 of file atomic_var.hpp.
|
inlinenoexcept |
Atomically loads and returns the current value of the atomic variable.
Definition at line 321 of file atomic_var.hpp.
References load().
|
inlinenoexcept |
Perform atomic bitwise AND.
Perform atomic bitwise AND, equivalent to fetch_and(val) & val
| val | The argument for the arithmetic operation |
Definition at line 423 of file atomic_var.hpp.
References fetch_and().
|
inlinenoexcept |
Perform atomic pre-increment.
Perform atomic pre-increment, equivalent to fetch_add(1) + 1
Definition at line 345 of file atomic_var.hpp.
References fetch_add().
|
inlinenoexcept |
Perform atomic post-increment.
Perform atomic pre-increment, equivalent to fetch_add(1)
Definition at line 357 of file atomic_var.hpp.
References fetch_add().
|
inlinenoexcept |
Perform atomic addition.
Perform atomic addition, equivalent to fetch_add(val) + val
| val | The argument for the arithmetic operation |
Definition at line 395 of file atomic_var.hpp.
References fetch_add().
|
inlinenoexcept |
Perform atomic pre-decrement.
Perform atomic pre-decrement, equivalent to fetch_sub(1) - 1
Definition at line 369 of file atomic_var.hpp.
References fetch_sub().
|
inlinenoexcept |
Perform atomic post-decrement.
Perform atomic pre-decrement, equivalent to fetch_sub(1)
Definition at line 381 of file atomic_var.hpp.
References fetch_sub().
|
inlinenoexcept |
Perform atomic substraction.
Perform atomic addition, equivalent to fetch_sub(val) - val
| val | The argument for the arithmetic operation |
Definition at line 409 of file atomic_var.hpp.
References fetch_sub().
|
inlinenoexcept |
copy operator
| rhs | the value to initialize the atomic_var with |
Definition at line 59 of file atomic_var.hpp.
References store().
|
inlinenoexcept |
Atomically replace current value of the atomic variable.
| val | The value to store in the atomic variable |
Definition at line 333 of file atomic_var.hpp.
References store().
|
inlinenoexcept |
Perform atomic bitwise XOR.
Perform atomic bitwise XOR, equivalent to fetch_xor(val) ^ val
| val | The argument for the arithmetic operation |
Definition at line 451 of file atomic_var.hpp.
References fetch_xor().
|
inlinenoexcept |
Perform atomic bitwise OR.
Perform atomic bitwise OR, equivalent to fetch_or(val) | val
| val | The argument for the arithmetic operation |
Definition at line 437 of file atomic_var.hpp.
References fetch_or().
|
inlinenoexcept |
atomically set a bit to true/1
| bit | the index of the bit to set |
Definition at line 272 of file atomic_var.hpp.
|
inlinenoexcept |
atomically set a bit a value
| bit | the index of the bit to set |
| val | the value the bit should be set to |
Definition at line 261 of file atomic_var.hpp.
|
inlinenoexcept |
Atomically replace current value of the atomic variable.
| val | The value to store in the atomic variable |
Definition at line 227 of file atomic_var.hpp.
Referenced by atomic_var(), and operator=().