The Pedigree Project 0.1
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
Atomic< T, true > Class Template Reference

#include <Atomic.h>

+ Collaboration diagram for Atomic< T, true >:

Public Types

typedef T Type
 

Public Member Functions

 Atomic (T value=T())
 
 Atomic (const Atomic &x)
 
Atomic & operator= (const Atomic &x)
 
Atomic & operator= (T x)
 
virtual ~Atomic ()
 
T operator+= (T x)
 
T operator-= (T x)
 
T operator|= (T x)
 
T operator&= (T x)
 
T operator^= (T x)
 
bool compareAndSwap (T oldVal, T newVal)
 
 operator T () const
 
T value () const
 

Private Attributes

volatile T m_Atom
 

Friends

class PerProcessorScheduler
 

Detailed Description

template<typename T>
class Atomic< T, true >

Wrapper around gcc's builtin atomic operations

Definition at line 39 of file Atomic.h.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Atomic< T, true >::Type

Definition at line 111 of file Atomic.h.

Constructor & Destructor Documentation

◆ Atomic() [1/2]

template<typename T >
Atomic< T, true >::Atomic ( T  value = T())
inline

The constructor

Parameters
[in]valueinitial value

Definition at line 45 of file Atomic.h.

◆ Atomic() [2/2]

template<typename T >
Atomic< T, true >::Atomic ( const Atomic< T, true > &  x)
inline

The copy-constructor

Parameters
[in]xreference object

Definition at line 48 of file Atomic.h.

◆ ~Atomic()

template<typename T >
virtual Atomic< T, true >::~Atomic ( )
inlinevirtual

The destructor does nothing

Definition at line 60 of file Atomic.h.

Member Function Documentation

◆ compareAndSwap()

template<typename T >
bool Atomic< T, true >::compareAndSwap ( T  oldVal,
T  newVal 
)
inline

Compare and swap

Parameters
[in]oldValthe comparision value
[in]newValthe new value
Returns
true, if the Atomic had the value oldVal and the value was changed to newVal, false otherwise

Definition at line 97 of file Atomic.h.

◆ operator T()

template<typename T >
Atomic< T, true >::operator T ( ) const
inline

Get the value

Returns
the value of the Atomic

Definition at line 102 of file Atomic.h.

◆ operator&=()

template<typename T >
T Atomic< T, true >::operator&= ( T  x)
inline

Bitwise and

Parameters
[in]xthe operand
Returns
the value after the bitwise and

Definition at line 83 of file Atomic.h.

◆ operator+=()

template<typename T >
T Atomic< T, true >::operator+= ( T  x)
inline

Addition

Parameters
[in]xvalue to add
Returns
the value after the addition

Definition at line 65 of file Atomic.h.

◆ operator-=()

template<typename T >
T Atomic< T, true >::operator-= ( T  x)
inline

Subtraction

Parameters
[in]xvalue to subtract
Returns
the value after the subtraction

Definition at line 71 of file Atomic.h.

◆ operator=() [1/2]

template<typename T >
Atomic & Atomic< T, true >::operator= ( const Atomic< T, true > &  x)
inline

The assignment operator

Parameters
[in]xreference object

Definition at line 51 of file Atomic.h.

◆ operator=() [2/2]

template<typename T >
Atomic & Atomic< T, true >::operator= ( T  x)
inline

Atomically stores a value.

Definition at line 55 of file Atomic.h.

◆ operator^=()

template<typename T >
T Atomic< T, true >::operator^= ( T  x)
inline

Bitwise xor

Parameters
[in]xthe operand
Returns
the value after the bitwise xor

Definition at line 89 of file Atomic.h.

◆ operator|=()

template<typename T >
T Atomic< T, true >::operator|= ( T  x)
inline

Bitwise or

Parameters
[in]xthe operand
Returns
the value after the bitwise or

Definition at line 77 of file Atomic.h.

◆ value()

template<typename T >
T Atomic< T, true >::value ( ) const
inline

Atomically loads the value without exposing the backing storage.

Definition at line 107 of file Atomic.h.

Friends And Related Symbol Documentation

◆ PerProcessorScheduler

template<typename T >
friend class PerProcessorScheduler
friend

Definition at line 40 of file Atomic.h.

Member Data Documentation

◆ m_Atom

template<typename T >
volatile T Atomic< T, true >::m_Atom
private

The atomic value

Definition at line 115 of file Atomic.h.


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