ATLAS Offline Software
AuxStoreInternal.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 */
13 #ifndef ATHCONTAINERS_AUXSTOREINTERNAL_H
14 #define ATHCONTAINERS_AUXSTOREINTERNAL_H
15 
16 
20 #include <vector>
21 #include <memory>
22 
23 
24 namespace SG {
25 
26 
27 class IAuxTypeVector;
28 
29 
42  : public IAuxStore, public IAuxStoreIO
43 {
44 public:
49  AuxStoreInternal (bool standalone = false);
50 
51 
57  virtual ~AuxStoreInternal();
58 
59 
63  AuxStoreInternal (const AuxStoreInternal& orig);
64 
65 
68 
69 
73  bool standalone() const;
74 
75 
86  virtual const void* getData (SG::auxid_t auxid) const override;
87 
88 
95  virtual const IAuxTypeVector* getVector (SG::auxid_t auxid) const override;
96 
97 
114  virtual void* getData (SG::auxid_t auxid, size_t size, size_t capacity)
115  override;
116 
117 
139  virtual void* getDecoration (auxid_t auxid, size_t size, size_t capacity)
140  override;
141 
142 
158  virtual bool resize (size_t sz) override;
159 
160 
169  virtual void reserve (size_t sz) override;
170 
171 
194  virtual void shift (size_t pos, ptrdiff_t offs) override;
195 
196 
216  virtual bool insertMove (size_t pos,
217  IAuxStore& other,
218  const SG::auxid_set_t& ignore = SG::auxid_set_t(0)) override;
219 
220 
228  virtual const SG::auxid_set_t& getAuxIDs() const override;
229 
230 
234  virtual const SG::auxid_set_t& getDecorIDs() const override;
235 
236 
241  virtual bool isDecoration (auxid_t auxid) const override;
242 
243 
250  virtual const SG::auxid_set_t& getWritableAuxIDs() const override;
251 
252 
263  virtual const void* getIOData (SG::auxid_t auxid) const override;
264 
265 
277  virtual const std::type_info* getIOType (SG::auxid_t auxid) const override;
278 
279 
283  virtual const SG::auxid_set_t& getDynamicAuxIDs() const override;
284 
285 
292  virtual void lock() override;
293 
294 
305  virtual bool clearDecorations() override;
306 
307 
313  virtual size_t size() const override;
314 
315 
325  virtual bool setOption (auxid_t id, const AuxDataOption& option) override;
326 
327 
336  virtual void lockDecoration (SG::auxid_t auxid) override;
337 
338 
348  virtual IAuxTypeVector* linkedVector (SG::auxid_t auxid) override;
349 
350 
360  virtual const IAuxTypeVector* linkedVector (SG::auxid_t auxid) const override;
361 
362 
363 protected:
375  const void* getIODataInternal (auxid_t auxid, bool quiet) const;
376 
377 
389  void* getIODataInternal (auxid_t auxid, bool quiet);
390 
391 
396  void addAuxID (auxid_t auxid);
397 
398 
416  virtual void* getDataInternal (SG::auxid_t auxid,
417  size_t size,
418  size_t capacity,
419  bool no_lock_check);
420 
421 
429  void addVector (std::unique_ptr<IAuxTypeVector> vec,
430  bool isDecoration);
431 
432 
433 private:
436  size_t size,
437  size_t capacity,
438  bool no_lock_check);
439 
441  size_t size_noLock() const;
442 
445 
448  std::vector<std::unique_ptr<IAuxTypeVector> > m_vecs;
449 
452 
455 
457  bool m_locked;
458 
461  typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
462  mutable mutex_t m_mutex;
463 };
464 
465 
466 } // namespace SG
467 
468 
469 
470 #ifndef XAOD_STANDALONE
471 
472 #include "AthenaKernel/BaseInfo.h"
473 #include "AthenaKernel/CLASS_DEF.h"
475 CLASS_DEF( SG::AuxStoreInternal , 16428258 , 1 )
476 
477 #endif // not XAOD_STANDALONE
478 
479 
480 #endif // not ATHCONTAINERS_AUXSTOREINTERNAL_H
SG::AuxStoreInternal::reserve
virtual void reserve(size_t sz) override
Change the capacity of all aux data vectors.
Definition: AuxStoreInternal.cxx:267
SG::AuxStoreInternal::addVector
void addVector(std::unique_ptr< IAuxTypeVector > vec, bool isDecoration)
Explicitly add a vector to the store.
Definition: AuxStoreInternal.cxx:144
SG::AuxStoreInternal::addAuxID
void addAuxID(auxid_t auxid)
Add a new auxid to the set of those being managed by this store.
Definition: AuxStoreInternal.cxx:676
fitman.sz
sz
Definition: fitman.py:527
SG::AuxStoreInternal::size_noLock
size_t size_noLock() const
Return the number of elements in the store; no locking.
Definition: AuxStoreInternal.cxx:614
SG::AuxStoreInternal::getDecoration
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Return the data vector for one aux data decoration item.
Definition: AuxStoreInternal.cxx:198
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::AuxStoreInternal::getData
virtual const void * getData(SG::auxid_t auxid) const override
Return the data vector for one aux data item.
Definition: AuxStoreInternal.cxx:83
SG::AuxStoreInternal::m_auxids
SG::auxid_set_t m_auxids
Set of auxid's for which we've created a vector.
Definition: AuxStoreInternal.h:454
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
SG::AuxStoreInternal::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition: AuxStoreInternal.h:461
SG::AuxStoreInternal::m_mutex
mutex_t m_mutex
Definition: AuxStoreInternal.h:462
SG::AuxStoreInternal::standalone
bool standalone() const
Return the standalone flag.
Definition: AuxStoreInternal.cxx:67
SG::AuxStoreInternal::~AuxStoreInternal
virtual ~AuxStoreInternal()
Destructor.
Definition: AuxStoreInternal.cxx:41
SG::AuxStoreInternal::m_decorations
SG::auxid_set_t m_decorations
Record which variables are decorations.
Definition: AuxStoreInternal.h:451
SG::AuxStoreInternal::mutex_t
AthContainers_detail::mutex mutex_t
Mutex used to synchronize modifications to the cache vector.
Definition: AuxStoreInternal.h:460
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
SG::AuxStoreInternal::AuxStoreInternal
AuxStoreInternal(bool standalone=false)
Constructor.
Definition: AuxStoreInternal.cxx:29
SG::AuxStoreInternal::m_locked
bool m_locked
Has this container been locked?
Definition: AuxStoreInternal.h:457
SG::AuxStoreInternal::getDynamicAuxIDs
virtual const SG::auxid_set_t & getDynamicAuxIDs() const override
Get the list of all variables that need to be handled.
Definition: AuxStoreInternal.cxx:552
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
SG::AuxStoreInternal::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const override
Return a set of identifiers for existing data items in this store.
Definition: AuxStoreInternal.cxx:400
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
SG::AuxStoreInternal::m_vecs
std::vector< std::unique_ptr< IAuxTypeVector > > m_vecs
The collection of vectors of aux data that we're managing, indexed by auxid.
Definition: AuxStoreInternal.h:448
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
BaseInfo.h
Provide an interface for finding inheritance information at run time.
IAuxStoreIO.h
Interface providing I/O for a generic auxiliary store.
SG::AuxStoreInternal::clearDecorations
virtual bool clearDecorations() override
Clear all decorations.
Definition: AuxStoreInternal.cxx:581
SG::AuxStoreInternal::lock
virtual void lock() override
Lock the container.
Definition: AuxStoreInternal.cxx:564
SG::AuxStoreInternal::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Definition: AuxStoreInternal.cxx:753
SG::AuxStoreInternal::getIODataInternal
const void * getIODataInternal(auxid_t auxid, bool quiet) const
Return a pointer to the data to be stored for one aux data item.
Definition: AuxStoreInternal.cxx:450
SG::AuxStoreInternal::shift
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.
Definition: AuxStoreInternal.cxx:301
SG::AuxStoreInternal::insertMove
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t(0)) override
Move all elements from other to this store.
Definition: AuxStoreInternal.cxx:332
SG::AuxStoreInternal::getVectorInternal_noLock
virtual IAuxTypeVector * getVectorInternal_noLock(SG::auxid_t auxid, size_t size, size_t capacity, bool no_lock_check)
Implementation of getVectorInternal; no locking.
Definition: AuxStoreInternal.cxx:684
SG::AuxStoreInternal::setOption
virtual bool setOption(auxid_t id, const AuxDataOption &option) override
Set an option for an auxiliary data variable.
Definition: AuxStoreInternal.cxx:636
SG::AuxStoreInternal::getDataInternal
virtual void * getDataInternal(SG::auxid_t auxid, size_t size, size_t capacity, bool no_lock_check)
Return the data vector for one aux data item.
Definition: AuxStoreInternal.cxx:735
SG::AuxStoreInternal::getIOType
virtual const std::type_info * getIOType(SG::auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
Definition: AuxStoreInternal.cxx:532
SG::AuxStoreInternal::size
virtual size_t size() const override
Return the number of elements in the store.
Definition: AuxStoreInternal.cxx:602
SG::AuxStoreInternal::linkedVector
virtual IAuxTypeVector * linkedVector(SG::auxid_t auxid) override
Return interface for a linked variable.
Definition: AuxStoreInternal.cxx:769
SG::AuxStoreInternal::getIOData
virtual const void * getIOData(SG::auxid_t auxid) const override
Return a pointer to the data to be stored for one aux data item.
Definition: AuxStoreInternal.cxx:515
SG::AuxDataOption
Hold information about an option setting request.
Definition: AuxDataOption.h:37
threading.h
Threading definitions.
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
SG::AuxStoreInternal
An auxiliary data store that holds data internally.
Definition: AuxStoreInternal.h:43
SG::AuxStoreInternal::m_standalone
bool m_standalone
Are we being written in standalone mode?
Definition: AuxStoreInternal.h:444
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::AuxStoreInternal::getVector
virtual const IAuxTypeVector * getVector(SG::auxid_t auxid) const override
Return vector interface for one aux data item.
Definition: AuxStoreInternal.cxx:99
SG::AuxStoreInternal::isDecoration
virtual bool isDecoration(auxid_t auxid) const override
Test if a particular variable is tagged as a decoration.
Definition: AuxStoreInternal.cxx:420
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
SG_BASE
SG_BASE(SG::AuxStoreInternal, SG::IAuxStore)
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
IAuxStore.h
Interface for non-const operations on an auxiliary store.
SG::AuxStoreInternal::resize
virtual bool resize(size_t sz) override
Change the size of all aux data vectors.
Definition: AuxStoreInternal.cxx:243
SG::AuxStoreInternal::getDecorIDs
virtual const SG::auxid_set_t & getDecorIDs() const override
Return a set of identifiers for decorations in this store.
Definition: AuxStoreInternal.cxx:410
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
SG::AuxStoreInternal::getWritableAuxIDs
virtual const SG::auxid_set_t & getWritableAuxIDs() const override
Return a set of identifiers for writable data items in this store.
Definition: AuxStoreInternal.cxx:433
SG::AuxStoreInternal::operator=
AuxStoreInternal & operator=(const AuxStoreInternal &)=delete
Don't allow assignment.
CLASS_DEF.h
macros to associate a CLID to a type