ATLAS Offline Software
Loading...
Searching...
No Matches
IAuxTypeVector.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*/
11
12
13#ifndef ATHCONTAINERSINTERFACES_IAUXTYPEVECTOR_H
14#define ATHCONTAINERSINTERFACES_IAUXTYPEVECTOR_H
15
16
21#include <cstddef>
22#include <memory>
23#include <typeinfo>
24
25
26namespace SG {
27
28
29class AuxDataOption;
30
31
42{
43public:
54
55
57 virtual ~IAuxTypeVector() = default;
58
59
63 virtual std::unique_ptr<IAuxTypeVector> clone() const = 0;
64
65
69 virtual void* toPtr() = 0;
70
71
75 virtual const void* toPtr() const = 0;
76
77
81 virtual void* toVector() = 0;
82
83
87 virtual size_t size() const = 0;
88
89
97 virtual bool resize (size_t sz) = 0;
98
99
104 virtual void reserve (size_t sz) = 0;
105
106
133 virtual bool shift (size_t pos, ptrdiff_t offs) = 0;
134
135
158 virtual bool insertMove (size_t pos,
159 void* src, size_t src_pos, size_t src_n,
160 IAuxStore& srcStore) = 0;
161
162
172 virtual bool setOption (const AuxDataOption& /*option*/)
173 { return false; }
174
175
188 virtual std::unique_ptr<IAuxTypeVector> toPacked() { return 0; }
189
190
202 virtual const std::type_info* objType() const { return 0; }
203
204
217 virtual std::unique_ptr<IAuxTypeVector> linkedVector() { return nullptr; }
218
219
226 bool isLinked() const { return m_isLinked; }
227
228
233 {
234 return m_auxid;
235 }
236
237
262 {
263 if (!m_span.isValid()) {
264 m_span.set (this->getDataSpanImpl());
265 }
266 return *m_span.ptr();
267 }
268
269
270protected:
276 virtual AuxDataSpanBase getDataSpanImpl() const = 0;
277
278
284 void storeDataSpan (void* beg, size_t size)
285 {
286 // Only do this if the span is already valid, so that it doesn't
287 // get marked valid before ROOT I/O.
288 if (m_span.isValid()) {
289 m_span.store (AuxDataSpanBase (beg, size));
290 }
291 }
292
293
298 {
299 m_span.reset();
300 }
301
302
303private:
306
309
312};
313
314
315} // namespace SG
316
317
318#endif // not ATHCONTAINERSINTERFACES_IAUXTYPEVECTOR_H
Describe a range over an auxiliary variable, for low-overhead access.
Basic definitions for auxiliary types.
Cached value with atomic update.
Interface for non-const operations on an auxiliary store.
static Double_t sz
Cached value with atomic update.
Definition CachedValue.h:55
Hold information about an option setting request.
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:48
virtual const void * toPtr() const =0
Return a pointer to the start of the vector's data.
bool isLinked() const
Return true if this variable is linked from another one.
auxid_t auxid() const
Return the auxid of the variable this vector represents.
virtual std::unique_ptr< IAuxTypeVector > clone() const =0
Make a copy of this vector.
void storeDataSpan(void *beg, size_t size)
Update the stored span.
virtual AuxDataSpanBase getDataSpanImpl() const =0
Return a span object describing the current vector.
virtual ~IAuxTypeVector()=default
Destructor.
virtual void * toVector()=0
Return a pointer to the STL vector itself.
virtual bool setOption(const AuxDataOption &)
Set an option for this variable.
virtual std::unique_ptr< IAuxTypeVector > toPacked()
Make a packed version of the variable.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual bool resize(size_t sz)=0
Change the size of the vector.
virtual size_t size() const =0
Return the size of the vector.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
void resetDataSpan()
Invalidate the stored span.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
bool m_isLinked
True if this variable is linked from another one.
virtual std::unique_ptr< IAuxTypeVector > linkedVector()
Return IAuxTypeVector of a linked variable, if there is one.
auxid_t m_auxid
The auxid of the variable this vector represents.
const AuxDataSpanBase & getDataSpan() const
Return a reference to a description of this vector's start+size.
CxxUtils::CachedValue< AuxDataSpanBase > m_span
Description of the vector start+size.
virtual const std::type_info * objType() const
Return the type of the complete object to be saved.
IAuxTypeVector(auxid_t auxid, bool isLinked)
Constructor.
virtual void reserve(size_t sz)=0
Change the capacity of the vector.
Forward declaration.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
Minimal span-like object describing the range of an auxiliary variable.
Definition AuxDataSpan.h:40