ATLAS Offline Software
Loading...
Searching...
No Matches
RObjectManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Local include(s):
7
10
11// ROOT include(s).
12#include <TError.h>
13
14namespace xAOD::Experimental {
15
16RObjectManager::RObjectManager(ROOT::RNTupleView<void> field,
17 const ::Long64_t& entry,
18 std::unique_ptr<THolder> holder)
19 : IObjectManager(std::move(holder)),
20 m_field(std::move(field)),
21 m_entryToLoad(entry),
22 m_entry(-1),
23 m_isSet(kTRUE) {}
24
26
27ROOT::RNTupleView<void>& RObjectManager::field() {
28
29 return m_field;
30}
31
32const ROOT::RNTupleView<void>& RObjectManager::field() const {
33
34 return m_field;
35}
36
45::Int_t RObjectManager::getEntry(::Int_t) {
46
47 // Must be valid entry value
48 if (m_entryToLoad < 0) {
49 // Raise error as a negative entry is incorrect
50 Error("xAOD::RObjectManager::getEntry",
52 "Entry to read must be larger than or equal to 0. entry=%lld"),
53 m_entryToLoad.get());
54 return -1;
55 }
56
57 // Check if anything needs to be done:
58 if (m_entryToLoad == m_entry) {
59 return 0;
60 }
61
62 // Load the entry.
64
65 // If successful, save entry number
67
68 // We don't know how to get the number of bytes read, so we just return 1.
69 return 1;
70}
71
77const void* RObjectManager::object() const {
78
79 return holder()->get();
80}
81
83
84 return holder()->get();
85}
86
92
93 holder()->set(obj);
94 m_isSet = kTRUE;
95 return;
96}
97
101
102 return m_isSet;
103}
104
108::Bool_t RObjectManager::isSet() const {
109
110 return m_isSet;
111}
112
118
119 m_isSet = kFALSE;
120 return;
121}
122
123} // namespace xAOD::Experimental
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
IObjectManager(std::unique_ptr< THolder > holder)
Constructor.
const THolder * holder() const
Accessor to the Holder object.
std::reference_wrapper< const ::Long64_t > m_entryToLoad
Entry number to load next.
virtual::Int_t getEntry(::Int_t getall=0) override
Function for updating the object in memory if needed.
virtual::Bool_t create() override
Create the object for the current event.
RObjectManager(ROOT::RNTupleView< void > field, const ::Long64_t &entry, std::unique_ptr< THolder > holder)
Constructor.
::Bool_t m_isSet
Was the object set for the current event?
ROOT::RNTupleView< void > m_field
The typeless object taking care of reading the field.
virtual void reset() override
Reset the object at the end of processing of an event.
::Long64_t m_entry
The last entry that was loaded for this field.
virtual void setObject(void *obj) override
Function replacing the object being handled.
virtual const void * object() const override
Function getting a const pointer to the object being handled.
virtual::Bool_t isSet() const override
Check if the object was set for the current event.
ROOT::RNTupleView< void > & field()
Accessor to the field (non-const)
virtual void set(void *obj)
Replace the managed object.
Definition THolder.cxx:231
const void * get() const
Return a typeless const pointer to the held object.
Definition THolder.cxx:216
STL namespace.