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-2024 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
205 virtual bool insertMove (size_t pos,
206 void* src, size_t src_pos, size_t src_n,
207 SG::IAuxStore& srcStore) override;
208
209
221 virtual const std::type_info* objType() const override;
222
223
224protected:
230 virtual AuxDataSpanBase getDataSpanImpl() const override final;
231
232
233private:
237 void storeDataSpan();
238
239
242
247 std::unique_ptr<TVirtualCollectionProxy> m_proxy;
248
250 void* m_obj;
251
253 void* m_vec;
254
257};
258
259
278 : public SG::IAuxTypeVectorFactory
279{
280public:
285 RootAuxVectorFactory (TClass* objClass);
286
287
291 virtual ~RootAuxVectorFactory() override;
292
293
297 const RootUtils::Type& rootType() const { return m_type; }
298
299
305 TClass* objClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_objClass; }
306
307
313 TClass* vecClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_vecClass; }
314
315
319 size_t offset() const { return m_offset; }
320
321
331 virtual
332 std::unique_ptr<SG::IAuxTypeVector> create (SG::auxid_t auxid,
333 size_t size,
334 size_t capacity,
335 bool isLinked) const
336 override;
337
338
359 virtual std::unique_ptr<SG::IAuxTypeVector> createFromData (SG::auxid_t auxid,
360 void* data,
362 bool isPacked,
363 bool ownFlag,
364 bool isLinked) const
365 override;
366
367
379 virtual void copy (SG::auxid_t auxid,
380 AuxVectorData& dst, size_t dst_index,
381 const AuxVectorData& src, size_t src_index,
382 size_t n) const override;
383
384
397 virtual void copyForOutput (SG::auxid_t auxid,
398 AuxVectorData& dst, size_t dst_index,
399 const AuxVectorData& src, size_t src_index,
400 size_t n) const override;
401
402
415 virtual void swap (SG::auxid_t auxid,
416 AuxVectorData& a, size_t aindex,
417 AuxVectorData& b, size_t bindex,
418 size_t n) const override;
419
420
428 virtual void clear (SG::auxid_t auxid,
429 AuxVectorData& dst, size_t dst_index,
430 size_t n) const override;
431
432
436 virtual size_t getEltSize() const override;
437
438
442 virtual const std::type_info* tiVec() const override;
443
444
450 virtual bool isDynamic() const override;
451
452
458 virtual const std::type_info* tiAlloc() const override;
459
460
464 virtual std::string tiAllocName() const override;
465
466
467private:
470 char* copyImpl (SG::auxid_t auxid,
471 AuxVectorData& dst, size_t dst_index,
472 const AuxVectorData& src, size_t src_index,
473 size_t n) const;
474
475
477 TClass* m_objClass;
478
480 TClass* m_vecClass;
481
483 size_t m_offset;
484
487
490};
491
492
493} // namespace SG
494
495
496#endif // not ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
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
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.
virtual std::unique_ptr< IAuxTypeVector > linkedVector()
Return IAuxTypeVector of a linked variable, if there is one.
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.
const RootAuxVectorFactory * m_factory
Pointer back to the factory class for this type.
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.
void swap(ArenaSharedHeapSTLAllocator< T > &a, ArenaSharedHeapSTLAllocator< T > &b)
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