| The Gaudi Framework v32r1 (f65d50dc)

Static Public Member Functions | List of all members
Gaudi::Accumulators::Adder< Arithmetic, atomicity::full > Struct Template Reference

Adder specialization in the case of atomicity full. More...

`#include <GaudiKernel/Counters.h>`

Inheritance diagram for Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >:
[legend]
Collaboration diagram for Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >:
[legend]

## Static Public Member Functions
static constexpr OutputType | DefaultValue ()
static void | merge (InternalType &a, Arithmetic b) noexcept
Static Public Member Functions inherited from Gaudi::Accumulators::BaseValueHandler< Arithmetic, atomicity::full >
static constexpr OutputType | getValue (const InternalType &v) noexcept
static Arithmetic | exchange (InternalType &v, Arithmetic newv) noexcept

## Additional Inherited Members
Public Types inherited from Gaudi::Accumulators::BaseValueHandler< Arithmetic, atomicity::full >
using | OutputType = Arithmetic
using | InternalType = std::atomic< Arithmetic >

## Detailed Description

### template<typename Arithmetic>
struct Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >

Adder specialization in the case of atomicity full.

Definition at line 252 of file Counters.h.

## Member Function Documentation

## ◆ DefaultValue()

template<typename Arithmetic >

static constexpr OutputType Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >::DefaultValue | ( |  | ) |
| inline static

Definition at line 255 of file Counters.h.

255 { return Arithmetic{}; }

## ◆ merge()

template<typename Arithmetic >

static void Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >::merge | ( | InternalType & | a,
|  | Arithmetic | b
| ) |  |
| inline static noexcept

Definition at line 256 of file Counters.h.

256 {
257 if ( DefaultValue() == b ) return; // avoid atomic operation if b is "0"
258 if constexpr ( has_fetch_add_v<InternalType> ) {
259 a.fetch_add( b, std::memory_order_relaxed );
260 } else {
261 auto current = BaseValueHandler<Arithmetic, atomicity::full>::getValue( a );
262 while ( !a.compare_exchange_weak( current, current + b ) )
263 ;
264 }
265 };
Gaudi::Accumulators::BaseValueHandler< Arithmetic, atomicity::full >::getValue
static constexpr OutputType getValue(const InternalType &v) noexcept
Definition: Counters.h:224
Gaudi::Accumulators::Adder< Arithmetic, atomicity::full >::DefaultValue
static constexpr OutputType DefaultValue()
Definition: Counters.h:255

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

- GaudiKernel/GaudiKernel/Counters.h