ATLAS Offline Software
Loading...
Searching...
No Matches
IRootAuxDynIO.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef IROOTAUXDYN_IO_H
5#define IROOTAUXDYN_IO_H
6
7#include "GaudiKernel/StatusCode.h"
8
10
11#include <string>
12#include <memory>
13#include <vector>
14#include <mutex>
15#include <tuple>
16
17#include "RVersion.h"
18
19class TBranch;
20class TTree;
21class TFile;
22class TClass;
23
25class IAthenaIPCTool;
26
27// Forward declarations
28namespace ROOT { class RNTupleReader; }
29
30namespace RootAuxDynIO
31{
32 // The convention for the tuple is <name, type, data>
33 typedef std::tuple<std::string, std::string, void*> attrDataTuple;
34
36 {
37 public:
46 virtual void addReaderToObject(void* object, size_t row, std::recursive_mutex* iomtx = nullptr) = 0;
47
48 virtual size_t getBytesRead() const = 0;
49
50 virtual void resetBytesRead() = 0;
51
52 virtual ~IRootAuxDynReader() {}
53 };
54
55
58 public:
59 virtual ~IRootAuxDynWriter() = default;
60
63 // may throw exceptions
64 virtual int writeAuxAttributes(const std::string& base_branch, void* object, size_t rows_written ) = 0;
65
67 virtual bool needsCommit() = 0;
68
70 virtual int commit() = 0;
71
73 virtual void setBranchFillMode(bool) = 0;
74 };
75
79 public:
81 virtual ~IRNTupleAuxDynWriter() = default;
82
84 virtual std::vector<attrDataTuple> collectAuxAttributes( const std::string& base_branch, void* object ) = 0;
85 };
86
87
89 public:
91 virtual ~IAuxDynShare() = default;
92
94 virtual StatusCode receiveStore(TClass* cl, void* obj, int num = 0) = 0;
95
97 virtual StatusCode sendStore(TClass* cl, const void* obj, const std::string& classId, const std::string& contName, int num = 0) = 0;
98 };
99
100
102 {
103 public:
104 virtual ~IFactoryTool() = default;
105
106 virtual std::unique_ptr<IRootAuxDynReader>
107 getBranchAuxDynReader(TTree*, TBranch*) const = 0;
108
109 virtual std::unique_ptr<IRootAuxDynWriter>
110 getBranchAuxDynWriter(TTree&, TClass&, int bufferSize, int splitLevel,
111 int offsettab_len, bool do_branch_fill) const = 0;
112
113 virtual std::unique_ptr<IRNTupleAuxDynWriter>
114 getNTupleAuxDynWriter(TClass &tc) const = 0;
115
116 virtual std::unique_ptr<IRootAuxDynReader>
117 getNTupleAuxDynReader(const std::string& field_name, const std::string& field_type,
118 ROOT::RNTupleReader* reader) const = 0;
119
120 virtual std::unique_ptr<IAuxDynShare> getAuxDynShare(const IAthenaSerializeSvc* serSvc, IAthenaIPCTool* ipcTool) const = 0;
121
123 virtual bool hasAuxStore(std::string_view fieldname, TClass *tc) const = 0;
124
126 virtual bool hasAuxStoreIO(TClass *tc) const = 0;
127
132 virtual bool isAuxDynBranch(TBranch *branch) const = 0;
133 };
134
135} // namespace
136
137#endif
138
static Double_t tc
virtual ~IAuxDynShare()=default
Default Destructor.
virtual StatusCode sendStore(TClass *cl, const void *obj, const std::string &classId, const std::string &contName, int num=0)=0
Send dynamic aux store variables to streaming tool.
virtual StatusCode receiveStore(TClass *cl, void *obj, int num=0)=0
Receive dynamic aux store variables from streaming tool.
virtual std::unique_ptr< IRNTupleAuxDynWriter > getNTupleAuxDynWriter(TClass &tc) const =0
virtual std::unique_ptr< IRootAuxDynReader > getNTupleAuxDynReader(const std::string &field_name, const std::string &field_type, ROOT::RNTupleReader *reader) const =0
virtual std::unique_ptr< IRootAuxDynWriter > getBranchAuxDynWriter(TTree &, TClass &, int bufferSize, int splitLevel, int offsettab_len, bool do_branch_fill) const =0
virtual std::unique_ptr< IAuxDynShare > getAuxDynShare(const IAthenaSerializeSvc *serSvc, IAthenaIPCTool *ipcTool) const =0
virtual std::unique_ptr< IRootAuxDynReader > getBranchAuxDynReader(TTree *, TBranch *) const =0
virtual bool hasAuxStoreIO(TClass *tc) const =0
check if the type tc has IAuxStoreIO interface
virtual bool isAuxDynBranch(TBranch *branch) const =0
Check is a branch holds AuxStore objects.
virtual ~IFactoryTool()=default
virtual bool hasAuxStore(std::string_view fieldname, TClass *tc) const =0
check if a field/branch with fieldname and type tc has IAuxStore interface
Interface for a RNTuple-based Writer that handles AuxDyn attributes Works in conjuction with the gene...
virtual std::vector< attrDataTuple > collectAuxAttributes(const std::string &base_branch, void *object)=0
Collect Aux data information to be writting out.
virtual ~IRNTupleAuxDynWriter()=default
Default Destructor.
virtual void addReaderToObject(void *object, size_t row, std::recursive_mutex *iomtx=nullptr)=0
Attach specialized AuxStore for reading dynamic attributes.
virtual size_t getBytesRead() const =0
Interface for an AuxDyn Writer - TTree based.
virtual bool needsCommit()=0
is there a need to call commit()?
virtual ~IRootAuxDynWriter()=default
virtual void setBranchFillMode(bool)=0
set per-branch independent commit/fill mode
virtual int writeAuxAttributes(const std::string &base_branch, void *object, size_t rows_written)=0
handle writing of dynamic xAOD attributes of an AuxContainer - called from RootTreeContainer::writeOb...
virtual int commit()=0
Call Fill() on the ROOT object used by this writer.
Selection rules: declare transient members.
Definition DataVector.h:581
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
std::tuple< std::string, std::string, void * > attrDataTuple