ATLAS Offline Software
Loading...
Searching...
No Matches
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
18namespace 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
Abstract interface for manipulating vectors of arbitrary types.
static Double_t sz
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:48
Abstract interface for manipulating vectors of arbitrary types.
auxid_t auxid() const
Return the auxid of the variable this vector represents.
IAuxTypeVector(auxid_t auxid, bool isLinked)
Constructor.
virtual void * toPtr() override
Return a pointer to the start of the vector's data.
Definition AuxPersInfo.h:46
AuxPersInfo(SG::auxid_t auxid, info_type info, SG::IAuxStore *)
Constructor.
Definition AuxPersInfo.h:39
T & info_type
Convenience type definition.
Definition AuxPersInfo.h:36
virtual size_t size() const override
Return the size of the vector.
Definition AuxPersInfo.h:55
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
virtual const std::type_info * objType() const override
Return the type of the complete object to be saved.
Definition AuxPersInfo.h:82
virtual bool resize(size_t sz) override
Change the size of the vector.
Definition AuxPersInfo.h:58
virtual SG::AuxDataSpanBase getDataSpanImpl() const override final
Return a span object describing the current vector.
Definition AuxPersInfo.h:86
virtual void * toVector() override
Return a pointer to the STL vector itself.
Definition AuxPersInfo.h:52
virtual std::unique_ptr< SG::IAuxTypeVector > clone() const override
Make a copy of this vector.
Definition AuxPersInfo.h:42
info_type m_info
Reference to the info being handled.
Definition AuxPersInfo.h:94
virtual const void * toPtr() const override
Return a pointer to the start of the vector's data.
Definition AuxPersInfo.h:49
virtual bool shift(size_t, ptrdiff_t) override
Shift the elements of the vector.
Definition AuxPersInfo.h:71
virtual void reserve(size_t sz) override
Change the capacity of the vector.
Definition AuxPersInfo.h:65
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Minimal span-like object describing the range of an auxiliary variable.
Definition AuxDataSpan.h:40