An int value that may be updated atomically. More...
#include <src/main/decaf/util/concurrent/atomic/AtomicInteger.h>

Public Member Functions | |
| AtomicInteger () | |
| Create a new AtomicInteger with an initial value of 0. | |
| AtomicInteger (int initialValue) | |
| Create a new AtomicInteger with the given initial value. | |
| virtual | ~AtomicInteger () |
| int | get () const |
| Gets the current value. | |
| void | set (int newValue) |
| Sets to the given value. | |
| int | getAndSet (int newValue) |
| Atomically sets to the given value and returns the old value. | |
| bool | compareAndSet (int expect, int update) |
| Atomically sets the value to the given updated value if the current value == the expected value. | |
| int | getAndIncrement () |
| Atomically increments by one the current value. | |
| int | getAndDecrement () |
| Atomically decrements by one the current value. | |
| int | getAndAdd (int delta) |
| Atomically adds the given value to the current value. | |
| int | incrementAndGet () |
| Atomically increments by one the current value. | |
| int | decrementAndGet () |
| Atomically decrements by one the current value. | |
| int | addAndGet (int delta) |
| Atomically adds the given value to the current value. | |
| std::string | toString () const |
| Returns the String representation of the current value. | |
| int | intValue () const |
| Description copied from class: Number Returns the value of the specified number as an int. | |
| long long | longValue () const |
| Description copied from class: Number Returns the value of the specified number as a long. | |
| float | floatValue () const |
| Description copied from class: Number Returns the value of the specified number as a float. | |
| double | doubleValue () const |
| Description copied from class: Number Returns the value of the specified number as a double. | |
An int value that may be updated atomically.
An AtomicInteger is used in applications such as atomically incremented counters, and cannot be used as a replacement for an Integer. However, this class does extend Number to allow uniform access by tools and utilities that deal with numerically-based classes.
| decaf::util::concurrent::atomic::AtomicInteger::AtomicInteger | ( | ) |
Create a new AtomicInteger with an initial value of 0.
| decaf::util::concurrent::atomic::AtomicInteger::AtomicInteger | ( | int | initialValue | ) |
Create a new AtomicInteger with the given initial value.
| initialValue | - The initial value of this object. |
| virtual decaf::util::concurrent::atomic::AtomicInteger::~AtomicInteger | ( | ) | [inline, virtual] |
| int decaf::util::concurrent::atomic::AtomicInteger::addAndGet | ( | int | delta | ) |
Atomically adds the given value to the current value.
| delta | - the value to add. |
| bool decaf::util::concurrent::atomic::AtomicInteger::compareAndSet | ( | int | expect, | |
| int | update | |||
| ) |
Atomically sets the value to the given updated value if the current value == the expected value.
| expect | - the expected value | |
| update | - the new value |
| int decaf::util::concurrent::atomic::AtomicInteger::decrementAndGet | ( | ) |
Atomically decrements by one the current value.
Referenced by decaf::util::concurrent::atomic::AtomicRefCounter::release().
| double decaf::util::concurrent::atomic::AtomicInteger::doubleValue | ( | ) | const [virtual] |
Description copied from class: Number Returns the value of the specified number as a double.
This may involve rounding.
Implements decaf::lang::Number.
| float decaf::util::concurrent::atomic::AtomicInteger::floatValue | ( | ) | const [virtual] |
Description copied from class: Number Returns the value of the specified number as a float.
This may involve rounding.
Implements decaf::lang::Number.
| int decaf::util::concurrent::atomic::AtomicInteger::get | ( | ) | const [inline] |
Gets the current value.
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::drainTo(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::offer(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::peek(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::poll(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::put(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::remainingCapacity(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::size(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::take(), decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::toArray(), and decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::toString().
| int decaf::util::concurrent::atomic::AtomicInteger::getAndAdd | ( | int | delta | ) |
Atomically adds the given value to the current value.
| delta | - The value to add. |
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::drainTo().
| int decaf::util::concurrent::atomic::AtomicInteger::getAndDecrement | ( | ) |
Atomically decrements by one the current value.
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::poll(), and decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::take().
| int decaf::util::concurrent::atomic::AtomicInteger::getAndIncrement | ( | ) |
Atomically increments by one the current value.
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::offer(), and decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::put().
| int decaf::util::concurrent::atomic::AtomicInteger::getAndSet | ( | int | newValue | ) |
Atomically sets to the given value and returns the old value.
| newValue | - the new value. |
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::clear().
| int decaf::util::concurrent::atomic::AtomicInteger::incrementAndGet | ( | ) |
Atomically increments by one the current value.
Referenced by decaf::util::concurrent::atomic::AtomicRefCounter::AtomicRefCounter().
| int decaf::util::concurrent::atomic::AtomicInteger::intValue | ( | ) | const [virtual] |
Description copied from class: Number Returns the value of the specified number as an int.
This may involve rounding or truncation.
Implements decaf::lang::Number.
| long long decaf::util::concurrent::atomic::AtomicInteger::longValue | ( | ) | const [virtual] |
Description copied from class: Number Returns the value of the specified number as a long.
This may involve rounding or truncation.
Implements decaf::lang::Number.
| void decaf::util::concurrent::atomic::AtomicInteger::set | ( | int | newValue | ) | [inline] |
Sets to the given value.
| newValue | - the new value |
Referenced by decaf::util::concurrent::LinkedBlockingQueue< Pointer< Transport > >::clear().
| std::string decaf::util::concurrent::atomic::AtomicInteger::toString | ( | ) | const |
Returns the String representation of the current value.
1.6.1