ATLAS Offline Software
AuxPersInfo.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: AuxPersInfo.h 793737 2017-01-24 20:11:10Z ssnyder $
8 #ifndef XAODCORE_TOOLS_AUXPERSINFO_H
9 #define XAODCORE_TOOLS_AUXPERSINFO_H
10 
11 // System include(s):
12 #include <stdexcept>
13 
14 // EDM include(s):
17 
18 namespace xAOD {
19 
31  template< class T >
33 
34  public:
36  typedef T& info_type;
37 
40  IAuxTypeVector( auxid, false ), m_info( info ) {}
41 
42  virtual std::unique_ptr<SG::IAuxTypeVector> clone() const override {
43  return std::make_unique<AuxPersInfo<T> >(*this);
44  }
45 
46  virtual void* toPtr() override {
47  return &m_info;
48  }
49  virtual const void* toPtr() const override {
50  return &m_info;
51  }
52  virtual void* toVector() override {
53  return &m_info;
54  }
55  virtual size_t size() const override {
56  return 1;
57  }
58  virtual bool resize( size_t sz ) override {
59  if( sz != 1 ) {
60  throw std::runtime_error( "Calling resize with != 1 on a "
61  "non-vector" );
62  }
63  return true;
64  }
65  virtual void reserve( size_t sz ) override {
66  if( sz != 1 ) {
67  throw std::runtime_error( "Calling reserve with != 1 on a "
68  "non-vector" );
69  }
70  }
71  virtual bool shift( size_t /*pos*/, ptrdiff_t /*offs*/ ) override {
72  throw std::runtime_error( "Calling shift on a non-vector" );
73  }
74 
75  virtual bool insertMove (size_t /*pos*/,
76  void* /*src*/, size_t /*src_pos*/, size_t /*src_n*/,
77  SG::IAuxStore& /*srcStore*/) override
78  {
79  throw std::runtime_error( "Calling insertMove on a non-vector" );
80  }
81 
82  virtual const std::type_info* objType() const override {
83  return &typeid(T);
84  }
85 
86  virtual SG::AuxDataSpanBase getDataSpanImpl() const override final
87  {
88  void* beg ATLAS_THREAD_SAFE = &m_info;
89  return SG::AuxDataSpanBase( const_cast<void*> (beg), 1 );
90  }
91 
92  private:
95  }; // class AuxPersInfo
96 
97 } // namespace xAOD
98 
99 #endif // XAODCORE_TOOLS_AUXPERSINFO_H
grepfile.info
info
Definition: grepfile.py:38
xAOD::AuxPersInfo::toPtr
virtual void * toPtr() override
Return a pointer to the start of the vector's data.
Definition: AuxPersInfo.h:46
xAOD::AuxPersInfo::m_info
info_type m_info
Reference to the info being handled.
Definition: AuxPersInfo.h:94
fitman.sz
sz
Definition: fitman.py:527
xAOD::AuxPersInfo::AuxPersInfo
AuxPersInfo(SG::auxid_t auxid, info_type info, SG::IAuxStore *)
Constructor.
Definition: AuxPersInfo.h:39
xAOD::AuxPersInfo::toVector
virtual void * toVector() override
Return a pointer to the STL vector itself.
Definition: AuxPersInfo.h:52
xAOD::AuxPersInfo
Class managing concrete persistent variables.
Definition: AuxPersInfo.h:32
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
xAOD::AuxPersInfo::size
virtual size_t size() const override
Return the size of the vector.
Definition: AuxPersInfo.h:55
IAuxTypeVector.h
Abstract interface for manipulating vectors of arbitrary types.
xAOD::AuxPersInfo::getDataSpanImpl
virtual SG::AuxDataSpanBase getDataSpanImpl() const override final
Return a span object describing the current vector.
Definition: AuxPersInfo.h:86
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
xAOD::AuxPersInfo::objType
virtual const std::type_info * objType() const override
Return the type of the complete object to be saved.
Definition: AuxPersInfo.h:82
SG::IAuxTypeVector::IAuxTypeVector
IAuxTypeVector(auxid_t auxid, bool isLinked)
Constructor.
Definition: IAuxTypeVector.h:49
SG::AuxDataSpanBase
Minimal span-like object describing the range of an auxiliary variable.
Definition: AuxDataSpan.h:39
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
SG::IAuxTypeVector::auxid
auxid_t auxid() const
Return the auxid of the variable this vector represents.
Definition: IAuxTypeVector.h:232
xAOD::AuxPersInfo::info_type
T & info_type
Convenience type definition.
Definition: AuxPersInfo.h:36
xAOD::AuxPersInfo::insertMove
virtual bool insertMove(size_t, void *, size_t, size_t, SG::IAuxStore &) override
Insert elements into the vector via move semantics.
Definition: AuxPersInfo.h:75
xAOD::AuxPersInfo::shift
virtual bool shift(size_t, ptrdiff_t) override
Shift the elements of the vector.
Definition: AuxPersInfo.h:71
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
xAOD::AuxPersInfo::resize
virtual bool resize(size_t sz) override
Change the size of the vector.
Definition: AuxPersInfo.h:58
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
xAOD::AuxPersInfo::reserve
virtual void reserve(size_t sz) override
Change the capacity of the vector.
Definition: AuxPersInfo.h:65
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
xAOD::AuxPersInfo::toPtr
virtual const void * toPtr() const override
Return a pointer to the start of the vector's data.
Definition: AuxPersInfo.h:49
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::AuxPersInfo::clone
virtual std::unique_ptr< SG::IAuxTypeVector > clone() const override
Make a copy of this vector.
Definition: AuxPersInfo.h:42