ATLAS Offline Software
Public Types | Static Public Member Functions | List of all members
xAOD::AddDVProxy::Helper< T > Struct Template Reference

Helper structure implementing the resize(...) function. More...

Collaboration diagram for xAOD::AddDVProxy::Helper< T >:

Public Types

typedef T Cont_t
 Type of the DataVector container. More...
 
typedef Cont_t::base_value_type Value_t
 Type of the elements in the DataVector. More...
 

Static Public Member Functions

static void resize (void *obj, size_t size)
 Function taking care of resizing DataVector<T> objects in memory. More...
 

Detailed Description

template<class T>
struct xAOD::AddDVProxy::Helper< T >

Helper structure implementing the resize(...) function.

When reading a branch of DataVector<T>, one needs to use a non-generic version of the resize(...) function. This implementation should work fine for all DataVector<T> types.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 99 of file AddDVProxy.h.

Member Typedef Documentation

◆ Cont_t

template<class T >
typedef T xAOD::AddDVProxy::Helper< T >::Cont_t

Type of the DataVector container.

Definition at line 102 of file AddDVProxy.h.

◆ Value_t

template<class T >
typedef Cont_t::base_value_type xAOD::AddDVProxy::Helper< T >::Value_t

Type of the elements in the DataVector.

Definition at line 104 of file AddDVProxy.h.

Member Function Documentation

◆ resize()

template<class T >
static void xAOD::AddDVProxy::Helper< T >::resize ( void *  obj,
size_t  size 
)
inlinestatic

Function taking care of resizing DataVector<T> objects in memory.

when branches are read from a TTree.

Parameters
objA pointer to the full-blown DataVector object
sizeThe size to re-size the vector to

Definition at line 111 of file AddDVProxy.h.

111  {
112 
113  // Cast the container to the right type:
114  Cont_t* c = reinterpret_cast< Cont_t* >( obj );
115 
116  // Detach the DataVector from its auxiliary store:
117  c->setStore( ( SG::IAuxStore* ) 0 );
118 
119  // Resize the container:
120  c->resize( size );
121 
122  // Make sure that all elements exist and are usable:
123  for( size_t i = 0; i < size; ++i ) {
124 
125  // If the element already exists, we're done:
126  if( ( *c )[ i ] ) continue;
127 
128  // Create a new element:
129  ( *c )[ i ] = new Value_t();
130  }
131 
132  return;
133  }

The documentation for this struct was generated from the following file:
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::AddDVProxy::Helper::Cont_t
T Cont_t
Type of the DataVector container.
Definition: AddDVProxy.h:102
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
xAOD::AddDVProxy::Helper::Value_t
Cont_t::base_value_type Value_t
Type of the elements in the DataVector.
Definition: AddDVProxy.h:104
python.PyAthena.obj
obj
Definition: PyAthena.py:132
python.compressB64.c
def c
Definition: compressB64.py:93