| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Private Member Functions | Private Attributes | List of all members
Gaudi::Hive::ContextSpecificData< T > Class Template Reference

Implementation of a context specific storage accessible as a sort of smart reference class. More...

`#include <GaudiKernel/ContextSpecificPtr.h>`

Collaboration diagram for Gaudi::Hive::ContextSpecificData< T >:
[legend]

## Public Member Functions
| ContextSpecificData (T proto={})
| Constructor with prototype value. More...
| ~ContextSpecificData ()
| Destructor. More...
| operator T & ()
| operator T & () const
T & | operator= (const T &other)
| Assignment operator. More...
T | accumulate (T init) const
| Return the sum of all the contained values using init as first value. More...
template<class T1 , class BinaryOperation >
T1 | accumulate (T1 init, BinaryOperation op) const
| Return the accumulated result, through the operation 'op', of all the contained values using init as first value. More...
template<class F >
void | for_each (F f) const
| Call a function on each contained value. More...
template<class F >
void | for_each (F f)
| Call a function on each contained value. (non-const version) More...
template<class F >
void | for_all (F f) const
| Call a function on each element, passing slot# as well. More...
template<class F >
void | for_all (F f)

## Private Member Functions
| ContextSpecificData (const ContextSpecificData &)=delete

## Private Attributes
T | m_proto = {}
| Prototype value. More...
ContextSpecificPtr< T > | m_ptr
| Internal implementation. More...

## Detailed Description

### template<typename T>
class Gaudi::Hive::ContextSpecificData< T >

Implementation of a context specific storage accessible as a sort of smart reference class.

New values are created from the prototype passed to the constructor.

Definition at line 138 of file ContextSpecificPtr.h.

## Constructor & Destructor Documentation

## ◆ ContextSpecificData() [1/2]

template<typename T>

Gaudi::Hive::ContextSpecificData< T >::ContextSpecificData | ( | T | proto = `{}` | ) |
| inline

Constructor with prototype value.

Definition at line 141 of file ContextSpecificPtr.h.

141 {} ) : m_proto( std::move( proto ) ) {}
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:196
std::move
T move(T... args)

## ◆ ~ContextSpecificData()

template<typename T>

Gaudi::Hive::ContextSpecificData< T >::~ContextSpecificData | ( |  | ) |
| inline

Destructor.

Definition at line 144 of file ContextSpecificPtr.h.

144 { m_ptr.deleteAll(); }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ ContextSpecificData() [2/2]

template<typename T>

Gaudi::Hive::ContextSpecificData< T >::ContextSpecificData | ( | const ContextSpecificData< T > & |  | ) |
| private delete

## Member Function Documentation

## ◆ accumulate() [1/2]

template<typename T>

T Gaudi::Hive::ContextSpecificData< T >::accumulate | ( | T | init | ) | const
| inline

Return the sum of all the contained values using init as first value.

Definition at line 160 of file ContextSpecificPtr.h.

160 { return accumulate( init, std::plus<>() ); }
std::plus
Gaudi::Hive::ContextSpecificData::accumulate
T accumulate(T init) const
Return the sum of all the contained values using init as first value.
Definition: ContextSpecificPtr.h:160

## ◆ accumulate() [2/2]

template<typename T>
template<class T1 , class BinaryOperation >

T1 Gaudi::Hive::ContextSpecificData< T >::accumulate | ( | T1 | init,
|  | BinaryOperation | op
| ) |  | const
| inline

Return the accumulated result, through the operation 'op', of all the contained values using init as first value.

Definition at line 165 of file ContextSpecificPtr.h.

165 {
166 return m_ptr.accumulate( []( const T* p ) { return *p; }, init, op );
167 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ for_all() [1/2]

template<typename T>
template<class F >

void Gaudi::Hive::ContextSpecificData< T >::for_all | ( | F | f | ) | const
| inline

Call a function on each element, passing slot# as well.

Definition at line 183 of file ContextSpecificPtr.h.

183 {
184 m_ptr.for_all( [&f]( size_t s, const T* p ) { f( s, *p ); } );
185 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ for_all() [2/2]

template<typename T>
template<class F >

void Gaudi::Hive::ContextSpecificData< T >::for_all | ( | F | f | ) |
| inline

Definition at line 187 of file ContextSpecificPtr.h.

187 {
188 m_ptr.for_all( [&f]( size_t s, T* p ) { f( s, *p ); } );
189 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ for_each() [1/2]

template<typename T>
template<class F >

void Gaudi::Hive::ContextSpecificData< T >::for_each | ( | F | f | ) | const
| inline

Call a function on each contained value.

Definition at line 171 of file ContextSpecificPtr.h.

171 {
172 m_ptr.for_each( [&f]( const T* p ) { f( *p ); } );
173 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ for_each() [2/2]

template<typename T>
template<class F >

void Gaudi::Hive::ContextSpecificData< T >::for_each | ( | F | f | ) |
| inline

Call a function on each contained value. (non-const version)

Definition at line 177 of file ContextSpecificPtr.h.

177 {
178 m_ptr.for_each( [&f]( T* p ) { f( *p ); } );
179 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ operator T &() [1/2]

template<typename T>

Gaudi::Hive::ContextSpecificData< T >::operator T & | ( |  | ) |
| inline

Definition at line 146 of file ContextSpecificPtr.h.

146 {
147 if ( !m_ptr ) m_ptr = new T( m_proto );
148 return *m_ptr;
149 }
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:196
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ operator T &() [2/2]

template<typename T>

Gaudi::Hive::ContextSpecificData< T >::operator T & | ( |  | ) | const
| inline

Definition at line 151 of file ContextSpecificPtr.h.

151 {
152 if ( !m_ptr ) m_ptr = new T( m_proto );
153 return *m_ptr;
154 }
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:196
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:198

## ◆ operator=()

template<typename T>

T& Gaudi::Hive::ContextSpecificData< T >::operator= | ( | const T & | other | ) |
| inline

Assignment operator.

Definition at line 157 of file ContextSpecificPtr.h.

157 { return (T&)( *this ) = other; }

## Member Data Documentation

## ◆ m_proto

template<typename T>

T Gaudi::Hive::ContextSpecificData< T >::m_proto = {}
| private

Prototype value.

Definition at line 196 of file ContextSpecificPtr.h.

## ◆ m_ptr

template<typename T>

ContextSpecificPtr<T> Gaudi::Hive::ContextSpecificData< T >::m_ptr
| mutable private

Internal implementation.

Definition at line 198 of file ContextSpecificPtr.h.

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

- GaudiKernel/GaudiKernel/ContextSpecificPtr.h