ATLAS Offline Software
Loading...
Searching...
No Matches
IOUtils.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3// Local include(s).
4#include "IOUtils.h"
5
6// Framework include(s).
13
14// System include(s).
15#include <stdexcept>
16
17namespace {
18
21class ForceTrackIndices : public SG::AuxVectorBase {
22 public:
24}; // class ForceTrackIndices
25
26} // anonymous namespace
27
28namespace xAOD::Details {
29
31
32 // Treat the received object like it would be of type @c ForceTrackIndices
33 ForceTrackIndices& xvec = static_cast<ForceTrackIndices&>(vec);
34
35 // Which would allow us to call a protected function on it.
36 xvec.initAuxVectorBase<DataVector<SG::IAuxElement> >(
38}
39
40bool hasAuxStore(const TClass& cl) {
41
42 // The classes whose children can have an auxiliary store attached
43 // to them.
44 static const TClass* const dvClass =
45 ::TClass::GetClass(typeid(SG::AuxVectorBase));
46 static const TClass* const aeClass =
47 ::TClass::GetClass(typeid(SG::AuxElement));
48
49 // Do the check.
50 return (cl.InheritsFrom(dvClass) || cl.InheritsFrom(aeClass));
51}
52
53bool isAuxStore(const TClass& cl) {
54
55 // The classes whose children are considered auxiliary stores.
56 static const TClass* const storeClass =
57 ::TClass::GetClass(typeid(SG::IConstAuxStore));
58 static const TClass* const storeHolderClass =
59 ::TClass::GetClass(typeid(SG::IAuxStoreHolder));
60
61 // Do the check.
62 return (cl.InheritsFrom(storeClass) || cl.InheritsFrom(storeHolderClass));
63}
64
65bool isStandalone(const TClass& cl) {
66
67 // The classes whose children can have an auxiliary store attached
68 // to them:
69 static const TClass* const dvClass =
70 TClass::GetClass(typeid(SG::AuxVectorBase));
71 static const TClass* const aeClass = TClass::GetClass(typeid(SG::AuxElement));
72
73 // Do the check:
74 if (cl.InheritsFrom(aeClass)) {
75 return kTRUE;
76 } else if (cl.InheritsFrom(dvClass)) {
77 return kFALSE;
78 }
79
80 // Some logic error happened.
81 throw std::runtime_error("A logic error happened in the code");
82}
83
84} // namespace xAOD::Details
Base class for elements of a container that can have aux data.
Manage index tracking and synchronization of auxiliary data.
std::vector< size_t > vec
An STL vector of pointers that by default owns its pointed-to elements.
Flag that a class may have auxiliary data associated with it.
Interface for const operations on an auxiliary store.
Derived DataVector<T>.
Definition DataVector.h:795
Base class for elements of a container that can have aux data.
Definition AuxElement.h:483
Manage index tracking and synchronization of auxiliary data.
void initAuxVectorBase(SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy indexTrackingPolicy)
Initialize index tracking mode.
Interface for objects taking part in direct ROOT I/O.
Interface for const operations on an auxiliary store.
@ ALWAYS_TRACK_INDICES
Always track indices, regardless of the setting of the ownership policy.
@ OWN_ELEMENTS
this data object owns its elements
bool hasAuxStore(const TClass &cl)
Helper function deciding if a given type "has an auxiliary store".
Definition IOUtils.cxx:40
bool isAuxStore(const TClass &cl)
Helper function deciding if a given type "is an auxiliary store".
Definition IOUtils.cxx:53
bool isStandalone(const TClass &cl)
Helper function deciding if a given type "is a standalone object".
Definition IOUtils.cxx:65
#define NO_SANITIZE_UNDEFINED