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)
 
Atomicoperator= (const Atomic &x)
 
Atomicoperator= (T x)
 
virtual ~Atomic ()
 
operator+= (T x)
 
operator-= (T x)
 
operator|= (T x)
 
operator&= (T x)
 
operator^= (T x)
 
bool compareAndSwap (T oldVal, T newVal)
 
 operator T () const
 
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 152 of file Atomic.h.

Constructor & Destructor Documentation

◆ Atomic() [1/2]

template<typename T >
Atomic< T, true >::Atomic ( 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 64 of file Atomic.h.

Member Function Documentation

◆ compareAndSwap()

template<typename T >
bool Atomic< T, true >::compareAndSwap ( oldVal,
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 126 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 139 of file Atomic.h.

◆ operator&=()

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

Bitwise and

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

Definition at line 102 of file Atomic.h.

◆ operator+=()

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

Addition

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

Definition at line 69 of file Atomic.h.

◆ operator-=()

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

Subtraction

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

Definition at line 80 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= ( x)
inline

Atomically stores a value.

Definition at line 55 of file Atomic.h.

◆ operator^=()

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

Bitwise xor

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

Definition at line 113 of file Atomic.h.

◆ operator|=()

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

Bitwise or

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

Definition at line 91 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 148 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 156 of file Atomic.h.


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