ATLAS Offline Software
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 */
14 #ifndef ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
15 #define ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
16 
17 
20 #include "RootUtils/Type.h"
22 
23 
24 class TClass;
25 class TVirtualCollectionProxy;
26 
27 
28 namespace SG {
29 
30 
31 class RootAuxVectorFactory;
32 
33 
47  : public SG::IAuxTypeVector
48 {
49 public:
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 
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 
204  virtual bool insertMove (size_t pos, void* beg, void* end,
205  SG::IAuxStore& srcStore) override;
206 
207 
219  virtual const std::type_info* objType() const override;
220 
221 
222 private:
225 
230  std::unique_ptr<TVirtualCollectionProxy> m_proxy;
231 
233  void* m_obj;
234 
236  void* m_vec;
237 
239  bool m_ownFlag;
240 };
241 
242 
262 {
263 public:
268  RootAuxVectorFactory (TClass* objClass);
269 
270 
274  virtual ~RootAuxVectorFactory() override;
275 
276 
280  const RootUtils::Type& rootType() const { return m_type; }
281 
282 
288  TClass* objClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_objClass; }
289 
290 
296  TClass* vecClass ATLAS_NOT_CONST_THREAD_SAFE () const { return m_vecClass; }
297 
298 
302  size_t offset() const { return m_offset; }
303 
304 
314  virtual
315  std::unique_ptr<SG::IAuxTypeVector> create (SG::auxid_t auxid,
316  size_t size,
317  size_t capacity,
318  bool isLinked) const
319  override;
320 
321 
342  virtual std::unique_ptr<SG::IAuxTypeVector> createFromData (SG::auxid_t auxid,
343  void* data,
344  IAuxTypeVector* linkedVector,
345  bool isPacked,
346  bool ownFlag,
347  bool isLinked) const
348  override;
349 
350 
362  virtual void copy (SG::auxid_t auxid,
363  AuxVectorData& dst, size_t dst_index,
364  const AuxVectorData& src, size_t src_index,
365  size_t n) const override;
366 
367 
380  virtual void copyForOutput (SG::auxid_t auxid,
381  AuxVectorData& dst, size_t dst_index,
382  const AuxVectorData& src, size_t src_index,
383  size_t n) const override;
384 
385 
398  virtual void swap (SG::auxid_t auxid,
399  AuxVectorData& a, size_t aindex,
400  AuxVectorData& b, size_t bindex,
401  size_t n) const override;
402 
403 
411  virtual void clear (SG::auxid_t auxid,
412  AuxVectorData& dst, size_t dst_index,
413  size_t n) const override;
414 
415 
419  virtual size_t getEltSize() const override;
420 
421 
425  virtual const std::type_info* tiVec() const override;
426 
427 
433  virtual bool isDynamic() const override;
434 
435 
441  virtual const std::type_info* tiAlloc() const override;
442 
443 
447  virtual std::string tiAllocName() const override;
448 
449 
450 private:
453  char* copyImpl (SG::auxid_t auxid,
454  AuxVectorData& dst, size_t dst_index,
455  const AuxVectorData& src, size_t src_index,
456  size_t n) const;
457 
458 
460  TClass* m_objClass;
461 
463  TClass* m_vecClass;
464 
466  size_t m_offset;
467 
470 
473 };
474 
475 
476 } // namespace SG
477 
478 
479 #endif // not ATHCONTAINERSROOT_ROOTAUXVECTORFACTORY_H
SG::RootAuxVector::toPtr
virtual void * toPtr() override
Return a pointer to the start of the vector's data.
Definition: RootAuxVectorFactory.cxx:162
SG::IAuxTypeVector::isLinked
bool isLinked() const
Return true if this variable is linked from another one.
Definition: IAuxTypeVector.h:221
SG::RootAuxVector::toVector
virtual void * toVector() override
Return a pointer to the overall object.
Definition: RootAuxVectorFactory.cxx:185
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SG::RootAuxVector::reserve
virtual void reserve(size_t sz) override
Change the capacity of the vector.
Definition: RootAuxVectorFactory.cxx:218
SG::RootAuxVector::m_ownFlag
bool m_ownFlag
Should be delete the vector object?
Definition: RootAuxVectorFactory.h:239
fitman.sz
sz
Definition: fitman.py:527
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::RootAuxVector::clone
virtual std::unique_ptr< SG::IAuxTypeVector > clone() const override
Make a copy of this vector.
Definition: RootAuxVectorFactory.cxx:153
SG::RootAuxVectorFactory::isDynamic
virtual bool isDynamic() const override
True if the vectors created by this factory work by dynamic emulation (via TVirtualCollectionProxy or...
Definition: RootAuxVectorFactory.cxx:642
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
SG::RootAuxVectorFactory::m_isEL
enum SG::RootAuxVectorFactory::@28 m_isEL
Flag to tell whether we need to do thinning.
SG::RootAuxVector::shift
virtual bool shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the vector.
Definition: RootAuxVectorFactory.cxx:249
SG::RootAuxVectorFactory::m_type
RootUtils::Type m_type
Wrapper for the ROOT type of the element.
Definition: RootAuxVectorFactory.h:469
SG::RootAuxVector::m_obj
void * m_obj
Pointer to the overall object itself.
Definition: RootAuxVectorFactory.h:233
SG::RootAuxVectorFactory::NONE
@ NONE
Definition: RootAuxVectorFactory.h:472
SG::RootAuxVectorFactory::clear
virtual void clear(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, size_t n) const override
Clear a range of elements within a vector.
Definition: RootAuxVectorFactory.cxx:610
SG::RootAuxVectorFactory::tiAllocName
virtual std::string tiAllocName() const override
Return the (demangled) name of the vector allocator.
Definition: RootAuxVectorFactory.cxx:662
IAuxTypeVector.h
Abstract interface for manipulating vectors of arbitrary types.
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::RootAuxVectorFactory::m_offset
size_t m_offset
Offset of the STL vector within the overall object.
Definition: RootAuxVectorFactory.h:466
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
SG::RootAuxVector::m_factory
const RootAuxVectorFactory * m_factory
Pointer back to the factory class for this type.
Definition: RootAuxVectorFactory.h:224
SG::RootAuxVectorFactory::RootAuxVectorFactory
RootAuxVectorFactory(TClass *objClass)
Constructor.
Definition: RootAuxVectorFactory.cxx:345
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::RootAuxVectorFactory::rootType
const RootUtils::Type & rootType() const
Return the ROOT type wrapper.
Definition: RootAuxVectorFactory.h:280
SG::RootAuxVector::size
virtual size_t size() const override
Return the size of the vector.
Definition: RootAuxVectorFactory.cxx:194
SG::RootAuxVector::insertMove
virtual bool insertMove(size_t pos, void *beg, void *end, SG::IAuxStore &srcStore) override
Insert elements into the vector via move semantics.
Definition: RootAuxVectorFactory.cxx:300
Type.h
Wrapper for ROOT types.
beamspotman.n
n
Definition: beamspotman.py:731
SG::RootAuxVectorFactory::offset
size_t offset() const
Return the offset of the vector within the object.
Definition: RootAuxVectorFactory.h:302
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
SG::RootAuxVectorFactory::tiVec
virtual const std::type_info * tiVec() const override
Return the type_info of the overall object.
Definition: RootAuxVectorFactory.cxx:631
SG::RootAuxVectorFactory::ELEMENT_LINK_VECTOR
@ ELEMENT_LINK_VECTOR
Definition: RootAuxVectorFactory.h:472
SG::RootAuxVectorFactory::m_objClass
TClass * m_objClass
The TClass for the overall object.
Definition: RootAuxVectorFactory.h:460
SG::RootAuxVector::operator=
RootAuxVector & operator=(const RootAuxVector &)=delete
SG::RootAuxVector::m_vec
void * m_vec
Pointer to the vector object itself.
Definition: RootAuxVectorFactory.h:236
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
SG::RootAuxVectorFactory::tiAlloc
virtual const std::type_info * tiAlloc() const override
Return the type_info of the vector allocator.
Definition: RootAuxVectorFactory.cxx:653
SG::RootAuxVectorFactory::getEltSize
virtual size_t getEltSize() const override
Return the size of an element of this vector type.
Definition: RootAuxVectorFactory.cxx:622
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SG::RootAuxVector::objType
virtual const std::type_info * objType() const override
Return the type of the complete object to be saved.
Definition: RootAuxVectorFactory.cxx:332
SG::RootAuxVectorFactory::m_vecClass
TClass * m_vecClass
The TClass for the std::vector.
Definition: RootAuxVectorFactory.h:463
SG::IAuxTypeVector::auxid
auxid_t auxid() const
Return the auxid of the variable this vector represents.
Definition: IAuxTypeVector.h:227
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::RootAuxVectorFactory::copyForOutput
virtual void copyForOutput(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const override
Copy elements between vectors, possibly applying thinning.
Definition: RootAuxVectorFactory.cxx:548
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
SG::RootAuxVectorFactory::create
virtual std::unique_ptr< SG::IAuxTypeVector > create(SG::auxid_t auxid, size_t size, size_t capacity, bool isLinked) const override
Create a vector object of this type.
Definition: RootAuxVectorFactory.cxx:437
SG::RootAuxVectorFactory
Dynamic implementation of IAuxVectorFactory, relying on root's vector proxy.
Definition: RootAuxVectorFactory.h:262
SG::RootAuxVector
Dynamic implementation of IAuxTypeVector, relying on root vector proxy.
Definition: RootAuxVectorFactory.h:48
SG::RootAuxVectorFactory::ELEMENT_LINK
@ ELEMENT_LINK
Definition: RootAuxVectorFactory.h:472
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::RootAuxVectorFactory::swap
virtual void swap(SG::auxid_t auxid, AuxVectorData &a, size_t aindex, AuxVectorData &b, size_t bindex, size_t n) const override
Swap elements between vectors.
Definition: RootAuxVectorFactory.cxx:591
IAuxTypeVectorFactory.h
Interface for factory objects that create vectors.
SG::RootAuxVectorFactory::copy
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const override
Copy elements between vectors.
Definition: RootAuxVectorFactory.cxx:525
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:40
RootUtils::Type
Wrapper for ROOT types.
Definition: Type.h:40
SG::RootAuxVectorFactory::ATLAS_NOT_CONST_THREAD_SAFE
TClass *vecClass ATLAS_NOT_CONST_THREAD_SAFE() const
Return the TClass for the std::vector.
Definition: RootAuxVectorFactory.h:296
SG::RootAuxVector::m_proxy
std::unique_ptr< TVirtualCollectionProxy > m_proxy
The collection proxy for the vector.
Definition: RootAuxVectorFactory.h:230
SG::RootAuxVector::RootAuxVector
RootAuxVector(const RootAuxVectorFactory *factory, SG::auxid_t auxid, size_t size, size_t capacity, bool isLinked)
Constructor.
Definition: RootAuxVectorFactory.cxx:63
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
SG::RootAuxVectorFactory::~RootAuxVectorFactory
virtual ~RootAuxVectorFactory() override
Destructor.
Definition: RootAuxVectorFactory.cxx:424
SG::RootAuxVectorFactory::ELEMENT_LINK_NONPOINTER
@ ELEMENT_LINK_NONPOINTER
Definition: RootAuxVectorFactory.h:472
SG::RootAuxVectorFactory::createFromData
virtual std::unique_ptr< SG::IAuxTypeVector > createFromData(SG::auxid_t auxid, void *data, IAuxTypeVector *linkedVector, bool isPacked, bool ownFlag, bool isLinked) const override
Create a vector object of this type from a data blob.
Definition: RootAuxVectorFactory.cxx:468
checker_macros.h
Define macros for attributes used to control the static checker.
SG::RootAuxVectorFactory::ATLAS_NOT_CONST_THREAD_SAFE
TClass *objClass ATLAS_NOT_CONST_THREAD_SAFE() const
Return the TClass for the overall object.
Definition: RootAuxVectorFactory.h:288
SG::RootAuxVector::~RootAuxVector
virtual ~RootAuxVector() override
Destructor.
Definition: RootAuxVectorFactory.cxx:143
SG::RootAuxVectorFactory::copyImpl
char * copyImpl(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const
Helper for copy; returns a pointer to the first destination object, or nullptr if the destination was...
Definition: RootAuxVectorFactory.cxx:483
SG::RootAuxVector::resize
virtual bool resize(size_t sz) override
Change the size of the vector.
Definition: RootAuxVectorFactory.cxx:206