ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
xAODRootAccess
Root
TPyStore.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Local include(s).
6
#include "
xAODRootAccess/TPyStore.h
"
7
8
#include "
xAODRootAccess/tools/ReturnCheck.h
"
9
10
// ROOT include(s).
11
#include <TClass.h>
12
#include <TError.h>
13
14
namespace
xAOD
{
15
28
bool
TPyStore::pyContains
(
const
std::string& key,
29
const
std::string&
type
)
const
{
30
31
// Try to access the dictionary of this type.
32
::TClass* cl = ::TClass::GetClass(
type
.c_str());
33
if
(cl ==
nullptr
) {
34
::Warning(
"xAOD::TPyStore::pyContains"
,
"Type name \"%s\" not known"
,
35
type
.c_str());
36
return
false
;
37
}
38
39
// Check if the dictionary can return a type_info.
40
const
std::type_info* ti = cl->GetTypeInfo();
41
if
(!ti) {
42
::Warning(
"xAOD::TPyStore::pyContains"
,
43
"Type \"%s\" doesn't have a proper dictionary"
,
type
.c_str());
44
return
false
;
45
}
46
47
// Use the base class to answer the question.
48
return
TStore::contains
(key, *ti);
49
}
50
63
bool
TPyStore::pyIsConst
(
const
std::string& key,
64
const
std::string&
type
)
const
{
65
66
// Try to access the dictionary of this type.
67
::TClass* cl = ::TClass::GetClass(
type
.c_str());
68
if
(cl ==
nullptr
) {
69
::Warning(
"xAOD::TPyStore::pyIsConst"
,
"Type name \"%s\" not known"
,
70
type
.c_str());
71
return
false
;
72
}
73
74
// Check if the dictionary can return a type_info.
75
const
std::type_info* ti = cl->GetTypeInfo();
76
if
(ti ==
nullptr
) {
77
::Warning(
"xAOD::TPyStore::pyIsConst"
,
78
"Type \"%s\" doesn't have a proper dictionary"
,
type
.c_str());
79
return
false
;
80
}
81
82
// Use the base class to answer the question.
83
return
TStore::isConst
(key, *ti);
84
}
85
103
StatusCode
TPyStore::pyRecord
(
void
* obj,
const
std::string& key,
104
const
std::string&
type
) {
105
106
// Simply forward the call to the appropriate function from the base
107
// class.
108
static
constexpr
bool
IS_OWNER =
false
;
109
static
constexpr
bool
IS_CONST =
false
;
110
RETURN_CHECK
(
"xAOD::TPyStore::pyRecord"
,
111
TStore::record
(obj, key,
type
, IS_OWNER, IS_CONST));
112
113
// Return gracefully:
114
return
StatusCode::SUCCESS;
115
}
116
121
void
TPyStore::dump
()
const
{
122
123
print
();
124
return
;
125
}
126
127
}
// namespace xAOD
ReturnCheck.h
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition
ReturnCheck.h:26
TPyStore.h
xAOD::TPyStore::dump
void dump() const
Print the contents of the store using a Python friendly function.
Definition
TPyStore.cxx:121
xAOD::TPyStore::pyRecord
StatusCode pyRecord(void *obj, const std::string &key, const std::string &type)
Record an object into the store in a typeless way.
Definition
TPyStore.cxx:103
xAOD::TPyStore::pyIsConst
bool pyIsConst(const std::string &key, const std::string &type) const
Function checking if an object with a given key and type is constant.
Definition
TPyStore.cxx:63
xAOD::TPyStore::pyContains
bool pyContains(const std::string &key, const std::string &type) const
Function checking if an object with a given key and type is available.
Definition
TPyStore.cxx:28
xAOD::TStore::print
void print() const
Print the current contents of the transient store.
Definition
TStore.cxx:124
xAOD::TStore::record
StatusCode record(T *obj, const std::string &key)
Add an object to the store.
xAOD::TStore::contains
::Bool_t contains(const std::string &key) const
Function checking if an object is available from the store.
xAOD::TStore::isConst
::Bool_t isConst(const std::string &key) const
Function checking if an object with a given type is constant.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
type
Generated on
for ATLAS Offline Software by
1.17.0