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 
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 
224 protected:
230  virtual AuxDataSpanBase getDataSpanImpl() const override final;
231 
232 
233 private:
237  void storeDataSpan();
238 
239 
242 
247  std::unique_ptr<TVirtualCollectionProxy> m_proxy;
248 
250  void* m_obj;
251 
253  void* m_vec;
254 
256  bool m_ownFlag;
257 };
258 
259 
278  : public SG::IAuxTypeVectorFactory
279 {
280 public:
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 
467 private:
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 
489  enum { NONE, ELEMENT_LINK, ELEMENT_LINK_VECTOR, ELEMENT_LINK_NONPOINTER} m_isEL;
490 };
491 
492 
493 } // namespace SG
494 
495 
496 #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:226
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:219
SG::RootAuxVector::m_ownFlag
bool m_ownFlag
Should be delete the vector object?
Definition: RootAuxVectorFactory.h:256
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
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
SG::RootAuxVector::shift
virtual bool shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the vector.
Definition: RootAuxVectorFactory.cxx:250
SG::RootAuxVectorFactory::m_type
RootUtils::Type m_type
Wrapper for the ROOT type of the element.
Definition: RootAuxVectorFactory.h:486
SG::RootAuxVector::m_obj
void * m_obj
Pointer to the overall object itself.
Definition: RootAuxVectorFactory.h:250
SG::RootAuxVectorFactory::NONE
@ NONE
Definition: RootAuxVectorFactory.h:489
SG::RootAuxVector::insertMove
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.
Definition: RootAuxVectorFactory.cxx:304
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
IAuxTypeVector.h
Abstract interface for manipulating vectors of arbitrary types.
SG::RootAuxVectorFactory::m_offset
size_t m_offset
Offset of the STL vector within the overall object.
Definition: RootAuxVectorFactory.h:483
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
SG::RootAuxVector::m_factory
const RootAuxVectorFactory * m_factory
Pointer back to the factory class for this type.
Definition: RootAuxVectorFactory.h:241
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:297
SG::RootAuxVector::size
virtual size_t size() const override
Return the size of the vector.
Definition: RootAuxVectorFactory.cxx:194
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:319
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
SG::RootAuxVector::storeDataSpan
void storeDataSpan()
Update the stored span.
Definition: RootAuxVectorFactory.cxx:358
SG::IAuxTypeVector::linkedVector
virtual std::unique_ptr< IAuxTypeVector > linkedVector()
Return IAuxTypeVector of a linked variable, if there is one.
Definition: IAuxTypeVector.h:217
SG::RootAuxVectorFactory::m_objClass
TClass * m_objClass
The TClass for the overall object.
Definition: RootAuxVectorFactory.h:477
SG::RootAuxVector::operator=
RootAuxVector & operator=(const RootAuxVector &)=delete
SG::RootAuxVector::m_vec
void * m_vec
Pointer to the vector object itself.
Definition: RootAuxVectorFactory.h:253
SG::AuxDataSpanBase
Minimal span-like object describing the range of an auxiliary variable.
Definition: AuxDataSpan.h:39
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
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:337
SG::RootAuxVectorFactory::m_vecClass
TClass * m_vecClass
The TClass for the std::vector.
Definition: RootAuxVectorFactory.h:480
SG::IAuxTypeVector::auxid
auxid_t auxid() const
Return the auxid of the variable this vector represents.
Definition: IAuxTypeVector.h:232
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
SG::RootAuxVectorFactory
Dynamic implementation of IAuxVectorFactory, relying on root's vector proxy.
Definition: RootAuxVectorFactory.h:279
SG::RootAuxVector
Dynamic implementation of IAuxTypeVector, relying on root vector proxy.
Definition: RootAuxVectorFactory.h:48
a
TList * a
Definition: liststreamerinfos.cxx:10
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
SG::RootAuxVector::getDataSpanImpl
virtual AuxDataSpanBase getDataSpanImpl() const override final
Return a span object describing the current vector.
Definition: RootAuxVectorFactory.cxx:348
IAuxTypeVectorFactory.h
Interface for factory objects that create vectors.
SG::swap
void swap(ArenaSharedHeapSTLAllocator< T > &a, ArenaSharedHeapSTLAllocator< T > &b)
Definition: ArenaSharedHeapSTLAllocator.h:481
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
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:313
SG::RootAuxVector::m_proxy
std::unique_ptr< TVirtualCollectionProxy > m_proxy
The collection proxy for the vector.
Definition: RootAuxVectorFactory.h:247
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:168
calibdata.copy
bool copy
Definition: calibdata.py:27
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:305
SG::RootAuxVector::~RootAuxVector
virtual ~RootAuxVector() override
Destructor.
Definition: RootAuxVectorFactory.cxx:143
SG::RootAuxVector::resize
virtual bool resize(size_t sz) override
Change the size of the vector.
Definition: RootAuxVectorFactory.cxx:206