ATLAS Offline Software
Loading...
Searching...
No Matches
RootAuxVectorFactory.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
12
13
14#ifndef ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
15#define ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
16
17
20#include "RootUtils/Type.h"
22
23
24class TClass;
25class TVirtualCollectionProxy;
26
27
28namespace SG {
29
30
32
33
47 : public SG::IAuxTypeVector
48{
49public:
58 RootAuxVector (const RootAuxVectorFactory* factory,
60 size_t size,
61 size_t capacity,
62 bool isLinked);
63
64
80 RootAuxVector (const RootAuxVectorFactory* factory,
82 void* data,
83 bool isPacked,
84 bool ownFlag,
85 bool isLinked);
86
87
92 RootAuxVector (const RootAuxVector& other);
93
94
95 // Disallow assignment.
97
98
104 virtual ~RootAuxVector() override;
105
106
110 virtual std::unique_ptr<SG::IAuxTypeVector> clone() const override;
111
112
116 virtual void* toPtr() override;
117
118
122 virtual const void* toPtr() const override;
123
124
128 virtual void* toVector() override;
129
130
131
135 virtual size_t size() const override;
136
137
144 virtual bool resize (size_t sz) override;
145
146
151 virtual void reserve (size_t sz) override;
152
153
180 virtual bool shift (size_t pos, ptrdiff_t offs) override;
181
182
201 virtual bool insertMove (size_t pos,
202 void* src, size_t src_pos, size_t src_n,
203 SG::IAuxStore& srcStore) override;
204
205
217 virtual const std::type_info* objType() const override;
218
219
229 virtual void toTransient (const EventContext& ctx) override;
230
231
232protected:
238 virtual AuxDataSpanBase getDataSpanImpl() const override final;
239
240
241private:
245 void storeDataSpan();
246
247
250
255 std::unique_ptr<TVirtualCollectionProxy> m_proxy;
256
258 void* m_obj;
259
261 void* m_vec;
262
265};
266
267
286 : public SG::IAuxTypeVectorFactory
287{
288public:
293 RootAuxVectorFactory (TClass* objClass);
294
295
299 virtual ~RootAuxVectorFactory() override;
300
301
305 const RootUtils::Type& rootType() const { return m_type; }
306
307
313 TClass* objClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_objClass; }
314
315
321 TClass* vecClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_vecClass; }
322
323
327 size_t offset() const { return m_offset; }
328
329
339 virtual
340 std::unique_ptr<SG::IAuxTypeVector> create (SG::auxid_t auxid,
341 size_t size,
342 size_t capacity,
343 bool isLinked) const
344 override;
345
346
367 virtual std::unique_ptr<SG::IAuxTypeVector> createFromData (SG::auxid_t auxid,
368 void* data,
370 bool isPacked,
371 bool ownFlag,
372 bool isLinked) const
373 override;
374
375
387 virtual void copy (SG::auxid_t auxid,
388 AuxVectorData& dst, size_t dst_index,
389 const AuxVectorData& src, size_t src_index,
390 size_t n) const override;
391
392
405 virtual void copyForOutput (SG::auxid_t auxid,
406 AuxVectorData& dst, size_t dst_index,
407 const AuxVectorData& src, size_t src_index,
408 size_t n) const override;
409
410
423 virtual void swap (SG::auxid_t auxid,
424 AuxVectorData& a, size_t aindex,
425 AuxVectorData& b, size_t bindex,
426 size_t n) const override;
427
428
436 virtual void clear (SG::auxid_t auxid,
437 AuxVectorData& dst, size_t dst_index,
438 size_t n) const override;
439
440
444 virtual size_t getEltSize() const override;
445
446
450 virtual const std::type_info* tiVec() const override;
451
452
458 virtual bool isDynamic() const override;
459
460
466 virtual const std::type_info* tiAlloc() const override;
467
468
472 virtual std::string tiAllocName() const override;
473
474
485 void toTransient (const EventContext& ctx, RootAuxVector& vec) const;
486
487
488private:
491 char* copyImpl (SG::auxid_t auxid,
492 AuxVectorData& dst, size_t dst_index,
493 const AuxVectorData& src, size_t src_index,
494 size_t n) const;
495
496
498 TClass* m_objClass;
499
501 TClass* m_vecClass;
502
504 size_t m_offset;
505
508
510 enum { NONE,
513 } m_isEL;
514};
515
516
517} // namespace SG
518
519
520#endif // not ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
std::vector< size_t > vec
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Interface for factory objects that create vectors.
Abstract interface for manipulating vectors of arbitrary types.
static Double_t sz
static Double_t a
void clear()
Empty the pool.
Wrapper for ROOT types.
Define macros for attributes used to control the static checker.
Wrapper for ROOT types.
Definition Type.h:40
Manage lookup of vectors of auxiliary data.
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:48
Interface for factory objects that create vectors.
Abstract interface for manipulating vectors of arbitrary types.
bool isLinked() const
Return true if this variable is linked from another one.
auxid_t auxid() const
Return the auxid of the variable this vector represents.
Dynamic implementation of IAuxVectorFactory, relying on root's vector proxy.
RootAuxVectorFactory(TClass *objClass)
Constructor.
size_t offset() const
Return the offset of the vector within the object.
TClass *objClass ATLAS_NOT_CONST_THREAD_SAFE() const
Return the TClass for the overall object.
RootUtils::Type m_type
Wrapper for the ROOT type of the element.
size_t m_offset
Offset of the STL vector within the overall object.
TClass * m_objClass
The TClass for the overall object.
TClass * m_vecClass
The TClass for the std::vector.
const RootUtils::Type & rootType() const
Return the ROOT type wrapper.
TClass *vecClass ATLAS_NOT_CONST_THREAD_SAFE() const
Return the TClass for the std::vector.
Dynamic implementation of IAuxTypeVector, relying on root vector proxy.
const RootAuxVectorFactory * m_factory
Pointer back to the factory class for this type.
virtual void toTransient(const EventContext &ctx) override
Perform post-read processing on this auxiliary variable.
void * m_vec
Pointer to the vector object itself.
virtual void * toPtr() override
Return a pointer to the start of the vector's data.
std::unique_ptr< TVirtualCollectionProxy > m_proxy
The collection proxy for the vector.
bool m_ownFlag
Should be delete the vector object?
RootAuxVector & operator=(const RootAuxVector &)=delete
RootAuxVector(const RootAuxVectorFactory *factory, SG::auxid_t auxid, size_t size, size_t capacity, bool isLinked)
Constructor.
virtual AuxDataSpanBase getDataSpanImpl() const override final
Return a span object describing the current vector.
virtual std::unique_ptr< SG::IAuxTypeVector > clone() const override
Make a copy of this vector.
virtual void * toVector() override
Return a pointer to the overall object.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, SG::IAuxStore &srcStore) override
Insert elements into the vector via move semantics.
void storeDataSpan()
Update the stored span.
virtual ~RootAuxVector() override
Destructor.
void * m_obj
Pointer to the overall object itself.
virtual bool resize(size_t sz) override
Change the size of the vector.
virtual bool shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the vector.
virtual const std::type_info * objType() const override
Return the type of the complete object to be saved.
virtual void reserve(size_t sz) override
Change the capacity of the vector.
virtual size_t size() const override
Return the size of the vector.
STL class.
Forward declaration.
SG::auxid_t auxid() const
Return the aux id for this variable.
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
virtual size_t size() const override
Return the number of elements in the store.
void swap(ArenaHeapAllocator &other)
Swap.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
STL namespace.
Minimal span-like object describing the range of an auxiliary variable.
Definition AuxDataSpan.h:40
#define private