activemq-cpp-3.9.0
decaf::util::concurrent::atomic::AtomicReference< T > Class Template Reference

An Pointer reference that may be updated atomically. More...

#include <src/main/decaf/util/concurrent/atomic/AtomicReference.h>

Public Member Functions

 AtomicReference ()
 
 AtomicReference (T *value)
 
virtual ~AtomicReference ()
 
T * get () const
 Gets the Current Value. More...
 
void set (T *newValue)
 Sets the Current value of this Reference. More...
 
bool compareAndSet (T *expect, T *update)
 Atomically sets the value to the given updated value if the current value == the expected value. More...
 
T * getAndSet (T *newValue)
 Atomically sets to the given value and returns the old value. More...
 
std::string toString () const
 Returns the String representation of the current value. More...
 

Detailed Description

template<typename T>
class decaf::util::concurrent::atomic::AtomicReference< T >

An Pointer reference that may be updated atomically.

Constructor & Destructor Documentation

template<typename T >
decaf::util::concurrent::atomic::AtomicReference< T >::AtomicReference ( )
inline
template<typename T >
decaf::util::concurrent::atomic::AtomicReference< T >::AtomicReference ( T *  value)
inline
template<typename T >
virtual decaf::util::concurrent::atomic::AtomicReference< T >::~AtomicReference ( )
inlinevirtual

Member Function Documentation

template<typename T >
bool decaf::util::concurrent::atomic::AtomicReference< T >::compareAndSet ( T *  expect,
T *  update 
)
inline

Atomically sets the value to the given updated value if the current value == the expected value.

Parameters
expect- the expected value
update- the new value
Returns
true if successful. False return indicates that the actual value was not equal to the expected value.

References decaf::internal::util::concurrent::Atomics::compareAndSet().

template<typename T >
T* decaf::util::concurrent::atomic::AtomicReference< T >::get ( ) const
inline

Gets the Current Value.

Returns
the current value of this Reference.
template<typename T >
T* decaf::util::concurrent::atomic::AtomicReference< T >::getAndSet ( T *  newValue)
inline

Atomically sets to the given value and returns the old value.

Parameters
newValue-the new value
Returns
the previous value.

References decaf::internal::util::concurrent::Atomics::getAndSet().

template<typename T >
void decaf::util::concurrent::atomic::AtomicReference< T >::set ( T *  newValue)
inline

Sets the Current value of this Reference.

Parameters
newValueThe new Value of this Reference.

References decaf::internal::util::concurrent::Atomics::getAndSet().

template<typename T >
std::string decaf::util::concurrent::atomic::AtomicReference< T >::toString ( ) const
inline

Returns the String representation of the current value.

Returns
string representation of the current value.

References decaf::lang::Long::toString().


The documentation for this class was generated from the following file: