ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::TDVCollectionFuncs Class Reference

Helper functions for accessing the container data via the proxy. More...

Collaboration diagram for xAOD::TDVCollectionFuncs:

Classes

struct  TEnvBuff
 Proxy environment buffer. More...

Public Types

typedef std::vector< char * > Cont_t
 The container type.
using Env_t = ROOT::TCollectionProxyInfo::Environ<TEnvBuff>
 The Root proxy environment structure.

Static Public Member Functions

static Cont_tcont (void *env)
 Fetch the container from a proxy environment.
static void * first (void *env)
 Return the first element of the container.
static void * next (void *env)
 Return a following element of the container.
static void * size (void *env)
 Return the size of the container.
static void * clear (void *env)
 Erase the container.
static void * create_env ()
 Return a new environment structure.
static void resize (void *, size_t)
 Not implemented for xAOD.
static void * construct (void *, size_t)
 Not implemented for xAOD.
static void destruct (void *, size_t)
 Not implemented for xAOD.
static void * feed (void *, void *to, size_t size)
static void * collect (void *, void *)
 Not implemented for xAOD.

Detailed Description

Helper functions for accessing the container data via the proxy.

Definition at line 155 of file TDVCollectionProxy.cxx.

Member Typedef Documentation

◆ Cont_t

typedef std::vector< char* > xAOD::TDVCollectionFuncs::Cont_t

The container type.

We alias this with the real vector that lives inside the DataVector.

Definition at line 161 of file TDVCollectionProxy.cxx.

◆ Env_t

using xAOD::TDVCollectionFuncs::Env_t = ROOT::TCollectionProxyInfo::Environ<TEnvBuff>

The Root proxy environment structure.

Definition at line 193 of file TDVCollectionProxy.cxx.

Member Function Documentation

◆ clear()

void * xAOD::TDVCollectionFuncs::clear ( void * env)
inlinestatic

Erase the container.

Parameters
envThe proxy environment.

Definition at line 261 of file TDVCollectionProxy.cxx.

261 {
262
263 cont( env )->clear();
264 return nullptr;
265 }
static Cont_t * cont(void *env)
Fetch the container from a proxy environment.

◆ collect()

void * xAOD::TDVCollectionFuncs::collect ( void * ,
void *  )
inlinestatic

Not implemented for xAOD.

Definition at line 315 of file TDVCollectionProxy.cxx.

315 {
316 ::Fatal( "xAOD::TDVCollectionProxy", "collect not implemented" );
317 return nullptr;
318 }

◆ construct()

void * xAOD::TDVCollectionFuncs::construct ( void * ,
size_t  )
inlinestatic

Not implemented for xAOD.

Definition at line 284 of file TDVCollectionProxy.cxx.

284 {
285 ::Fatal( "xAOD::TDVCollectionProxy", "construct not implemented" );
286 return nullptr;
287 }

◆ cont()

Cont_t * xAOD::TDVCollectionFuncs::cont ( void * env)
inlinestatic

Fetch the container from a proxy environment.

Parameters
envThe proxy environment.

Definition at line 198 of file TDVCollectionProxy.cxx.

198 {
199
200 Env_t& e = *reinterpret_cast< Env_t* >( env );
201 TEnvBuff& buff = e.fIterator;
202 return buff.fCont;
203 }
ROOT::TCollectionProxyInfo::Environ< TEnvBuff > Env_t
The Root proxy environment structure.

◆ create_env()

void * xAOD::TDVCollectionFuncs::create_env ( )
inlinestatic

Return a new environment structure.

Definition at line 268 of file TDVCollectionProxy.cxx.

268 {
269
270 return new Env_t;
271 }

◆ destruct()

void xAOD::TDVCollectionFuncs::destruct ( void * ,
size_t  )
inlinestatic

Not implemented for xAOD.

Definition at line 290 of file TDVCollectionProxy.cxx.

290 {
291 ::Fatal( "xAOD::TDVCollectionProxy", "destruct not implemented" );
292 }

◆ feed()

void * xAOD::TDVCollectionFuncs::feed ( void * ,
void * to,
size_t size )
inlinestatic

Definition at line 295 of file TDVCollectionProxy.cxx.

296 {
297 DataVector<char> *dv = reinterpret_cast<DataVector<char>*>(to);
298 // find out vector element typeinfo and get RootUtils::Type for it
299 const std::type_info &elem_typeinfo = dv->dvlinfo_v().elt_tinfo();
300 auto ru_type = RootUtils::Type( SG::normalizedTypeinfoName(elem_typeinfo) );
301 // copy vector elements into DataVector
302 if(mn) cout << "PROX: feed, typename=" << ru_type.getTypeName() << " typesize=" << ru_type.getSize() <<endl;
303
304 //char *src = reinterpret_cast<char*>( from );
305 for(size_t i=0; i<size; i++) {
306 void *obj = ru_type.create();
307 // ru_type.assign(obj, src); //MN: this may crash, so for now we do not copy data (bad only for CaloCluster
308 dv->dvlinfo_v().push(dv,obj);
309 //src += ru_type.getSize();
310 }
311 return nullptr;
312 }
const bool mn
static void * size(void *env)
Return the size of the container.
CONT to(RANGE &&r)
Definition ranges.h:39
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...

◆ first()

void * xAOD::TDVCollectionFuncs::first ( void * env)
inlinestatic

Return the first element of the container.

This resets the internal pointer to 0.

Parameters
envThe proxy environment.
Returns
A pointer to the first element, or 0 if the container is empty.

Definition at line 211 of file TDVCollectionProxy.cxx.

211 {
212 Env_t& e = *reinterpret_cast< Env_t* >( env );
213 Cont_t& c = *cont( env );
214 TEnvBuff& buff = e.fIterator;
215 buff.fIndex = 0;
216 e.fSize = c.size();
217 if( 0 == e.fSize ) {
218 return nullptr;
219 }
220 char* start = c[ 0 ];
221 buff.fEltPtr = start + buff.fOffset;
222 return buff.fEltPtr;
223 }
std::vector< char * > Cont_t
The container type.

◆ next()

void * xAOD::TDVCollectionFuncs::next ( void * env)
inlinestatic

Return a following element of the container.

The internal pointer will be advanced by the value of e.idx (after which e.idx will be reset to 0). A pointer to the element referenced by this new index will be returned.

Parameters
envThe proxy environment.
Returns
A pointer to the following element, or 0 if we're past the end.

Definition at line 233 of file TDVCollectionProxy.cxx.

233 {
234
235 Env_t& e = *reinterpret_cast< Env_t* >( env );
236 Cont_t& c = *cont( env );
237 TEnvBuff& buff = e.fIterator;
238 buff.fIndex += e.fIdx;
239 e.fIdx = 0;
240 if( buff.fIndex >= e.fSize ) {
241 return nullptr;
242 }
243 char* ptr = c[ buff.fIndex ];
244 buff.fEltPtr = ptr + buff.fOffset;
245 return buff.fEltPtr;
246 }
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ resize()

void xAOD::TDVCollectionFuncs::resize ( void * ,
size_t  )
inlinestatic

Not implemented for xAOD.

Definition at line 279 of file TDVCollectionProxy.cxx.

279 {
280 ::Fatal( "xAOD::TDVCollectionProxy", "resize function not specified!" );
281 }

◆ size()

void * xAOD::TDVCollectionFuncs::size ( void * env)
inlinestatic

Return the size of the container.

Parameters
envThe proxy environment.

Definition at line 251 of file TDVCollectionProxy.cxx.

251 {
252
253 Env_t* e = reinterpret_cast< Env_t* >( env );
254 e->fSize = cont( env )->size();
255 return &( e->fSize );
256 }

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