| The Gaudi Framework v30r0 (c919700c)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 ()
| Constructor with default initialization. More...
| ContextSpecificData (const 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 154 of file ContextSpecificPtr.h.

## Constructor & Destructor Documentation

template<typename T>

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

Constructor with default initialization.

Definition at line 158 of file ContextSpecificPtr.h.

158 : m_proto() {}
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:226
template<typename T>

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

Constructor with prototype value.

Definition at line 160 of file ContextSpecificPtr.h.

160 : m_proto( proto ) {}
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:226
template<typename T>

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

Destructor.

Definition at line 163 of file ContextSpecificPtr.h.

163 { m_ptr.deleteAll(); }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
template<typename T>

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

## Member Function Documentation

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 185 of file ContextSpecificPtr.h.

185 { return accumulate( init, std::plus<T>() ); }
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:185
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 190 of file ContextSpecificPtr.h.

191 {
192 return m_ptr.accumulate( []( const T* p ) -> T { return *p; }, init, op );
193 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
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 211 of file ContextSpecificPtr.h.

212 {
213 m_ptr.for_all( [&f]( size_t s, const T* p ) { f( s, *p ); } );
214 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
gaudirun.s
string s
Definition: gaudirun.py:253
template<typename T>
template<class F >

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

Definition at line 216 of file ContextSpecificPtr.h.

217 {
218 m_ptr.for_all( [&f]( size_t s, T* p ) { f( s, *p ); } );
219 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
gaudirun.s
string s
Definition: gaudirun.py:253
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 197 of file ContextSpecificPtr.h.

198 {
199 m_ptr.for_each( [&f]( const T* p ) { f( *p ); } );
200 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
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 204 of file ContextSpecificPtr.h.

205 {
206 m_ptr.for_each( [&f]( T* p ) { f( *p ); } );
207 }
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
template<typename T>

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

Definition at line 165 of file ContextSpecificPtr.h.

166 {
167 if ( m_ptr )
168 return *m_ptr;
169 else
170 return *( m_ptr = new T( m_proto ) );
171 }
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:226
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
template<typename T>

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

Definition at line 173 of file ContextSpecificPtr.h.

174 {
175 if ( m_ptr )
176 return *m_ptr;
177 else
178 return *( m_ptr = new T( m_proto ) );
179 }
Gaudi::Hive::ContextSpecificData::m_proto
T m_proto
Prototype value.
Definition: ContextSpecificPtr.h:226
Gaudi::Hive::ContextSpecificData::m_ptr
ContextSpecificPtr< T > m_ptr
Internal implementation.
Definition: ContextSpecificPtr.h:228
template<typename T>

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

Assignment operator.

Definition at line 182 of file ContextSpecificPtr.h.

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

## Member Data Documentation

template<typename T>

T Gaudi::Hive::ContextSpecificData< T >::m_proto
| private

Prototype value.

Definition at line 226 of file ContextSpecificPtr.h.

template<typename T>

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

Internal implementation.

Definition at line 228 of file ContextSpecificPtr.h.

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

- GaudiKernel/GaudiKernel/ContextSpecificPtr.h