- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
qi::Atomic< T > Struct Template Reference

`#include <atomic.hpp>`

## Public Member Functions
| Atomic ()
| Atomic (T value)
| Atomic (const Atomic &other)
T | operator++ ()
| Atomic pre-increment of the value. More...
T | operator-- ()
| Atomic pre-decrement of the value. More...
T | operator++ (int)
| Atomic post-increment of the value. More...
T | operator-- (int)
| Atomic post-decrement of the value. More...
Atomic< T > & | operator= (T value)
Atomic< T > & | operator= (const Atomic< T > &value)
bool | setIfEquals (T testValue, T setValue)
T | swap (T value)
T | operator* () const
T | load () const

## Public Attributes
std::atomic< T > | _value

## Detailed Description

### template<typename T>
struct qi::Atomic< T >

Atomic operations on integrals.

This class allows to do operations on an integral value from multiple threads, with the guarantee that each operation will not lead to a data race.

Remarks
  This is a simplification layer over the standard atomic type. If you understand the standard atomic, it might be preferable to use it.

Definition at line 156 of file atomic.hpp.

## Constructor & Destructor Documentation

template<typename T>

qi::Atomic< T >::Atomic | ( |  | ) |
| inline

Definition at line 162 of file atomic.hpp.

template<typename T>

qi::Atomic< T >::Atomic | ( | T | value | ) |
| inline

Atomic constructor setting value to its parameter.

Parameters

  value | The default value of the atomic.

Definition at line 168 of file atomic.hpp.

template<typename T>

qi::Atomic< T >::Atomic | ( | const Atomic< T > & | other | ) |
| inline

Definition at line 174 of file atomic.hpp.

## Member Function Documentation

template<typename T>

T qi::Atomic< T >::load | ( |  | ) | const
| inline

Definition at line 221 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::operator* | ( |  | ) | const
| inline

Return the contained valu Deprecated since 2.5.0

Definition at line 218 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::operator++ | ( |  | ) |
| inline

Atomic pre-increment of the value.

Definition at line 179 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::operator++ | ( | int |  | ) |
| inline

Atomic post-increment of the value.

Definition at line 186 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::operator-- | ( |  | ) |
| inline

Atomic pre-decrement of the value.

Definition at line 182 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::operator-- | ( | int |  | ) |
| inline

Atomic post-decrement of the value.

Definition at line 191 of file atomic.hpp.

template<typename T>

Atomic<T>& qi::Atomic< T >::operator= | ( | T | value | ) |
| inline

Definition at line 196 of file atomic.hpp.

template<typename T>

Atomic<T>& qi::Atomic< T >::operator= | ( | const Atomic< T > & | value | ) |
| inline

Definition at line 198 of file atomic.hpp.

template<typename T>

bool qi::Atomic< T >::setIfEquals | ( | T | testValue,
|  | T | setValue
| ) |  |
| inline

If value is testValue, replace it with setValue.

Returns
  true if swap was performed

Definition at line 204 of file atomic.hpp.

template<typename T>

T qi::Atomic< T >::swap | ( | T | value | ) |
| inline

Swap the atomic value with value.

Returns
  the previously held value

Definition at line 210 of file atomic.hpp.

## Member Data Documentation

template<typename T>

std::atomic<T> qi::Atomic< T >::_value

Definition at line 158 of file atomic.hpp.

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

- /home/opennao/work/release-2.8/sdk/libqi/qi/atomic.hpp