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

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

Collaboration diagram for 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 156 of file TDVCollectionProxy.cxx.

Member Typedef Documentation

◆ Cont_t

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

The container type.

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

Definition at line 162 of file TDVCollectionProxy.cxx.

◆ Env_t

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

The Root proxy environment structure.

Definition at line 194 of file TDVCollectionProxy.cxx.

Member Function Documentation

◆ clear()

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

Erase the container.

Parameters
envThe proxy environment.

Definition at line 262 of file TDVCollectionProxy.cxx.

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

◆ collect()

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

Not implemented for xAOD.

Definition at line 316 of file TDVCollectionProxy.cxx.

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

◆ construct()

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

Not implemented for xAOD.

Definition at line 285 of file TDVCollectionProxy.cxx.

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

◆ cont()

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

Fetch the container from a proxy environment.

Parameters
envThe proxy environment.

Definition at line 199 of file TDVCollectionProxy.cxx.

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

◆ create_env()

void * TDVCollectionFuncs::create_env ( )
inlinestatic

Return a new environment structure.

Definition at line 269 of file TDVCollectionProxy.cxx.

269 {
270
271 return new Env_t;
272 }

◆ destruct()

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

Not implemented for xAOD.

Definition at line 291 of file TDVCollectionProxy.cxx.

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

◆ feed()

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

Definition at line 296 of file TDVCollectionProxy.cxx.

297 {
298 DataVector<char> *dv = reinterpret_cast<DataVector<char>*>(to);
299 // find out vector element typeinfo and get RootUtils::Type for it
300 const std::type_info &elem_typeinfo = dv->dvlinfo_v().elt_tinfo();
301 auto ru_type = RootUtils::Type( SG::normalizedTypeinfoName(elem_typeinfo) );
302 // copy vector elements into DataVector
303 if(mn) cout << "PROX: feed, typename=" << ru_type.getTypeName() << " typesize=" << ru_type.getSize() <<endl;
304
305 //char *src = reinterpret_cast<char*>( from );
306 for(size_t i=0; i<size; i++) {
307 void *obj = ru_type.create();
308 // ru_type.assign(obj, src); //MN: this may crash, so for now we do not copy data (bad only for CaloCluster
309 dv->dvlinfo_v().push(dv,obj);
310 //src += ru_type.getSize();
311 }
312 return nullptr;
313 }
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 * 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 212 of file TDVCollectionProxy.cxx.

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

◆ next()

void * 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 234 of file TDVCollectionProxy.cxx.

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

◆ resize()

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

Not implemented for xAOD.

Definition at line 280 of file TDVCollectionProxy.cxx.

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

◆ size()

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

Return the size of the container.

Parameters
envThe proxy environment.

Definition at line 252 of file TDVCollectionProxy.cxx.

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

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