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
17class TBranch;
18class TTree;
19class TFile;
20class TClass;
21
23class IAthenaIPCTool;
24
25// Forward declarations
26namespace ROOT { class RNTupleReader; }
27
28namespace RootAuxDynIO
29{
30 // The convention for the tuple is <name, type, data>
31 typedef std::tuple<std::string, std::string, void*> attrDataTuple;
32
34 {
35 public:
44 virtual void addReaderToObject(void* object, size_t row, std::recursive_mutex* iomtx = nullptr) = 0;
45
46 virtual size_t getBytesRead() const = 0;
47
48 virtual void resetBytesRead() = 0;
49
50 virtual ~IRootAuxDynReader() {}
51 };
52
53
56 public:
57 virtual ~IRootAuxDynWriter() = default;
58
61 // may throw exceptions
62 virtual int writeAuxAttributes(const std::string& base_branch, void* object, size_t rows_written ) = 0;
63
65 virtual bool needsCommit() = 0;
66
68 virtual int commit() = 0;
69
71 virtual void setBranchFillMode(bool) = 0;
72 };
73
77 public:
79 virtual ~IRNTupleAuxDynWriter() = default;
80
82 virtual std::vector<attrDataTuple> collectAuxAttributes( const std::string& base_branch, void* object ) = 0;
83 };
84
85
87 public:
89 virtual ~IAuxDynShare() = default;
90
92 virtual StatusCode receiveStore(TClass* cl, void* obj, int num = 0) = 0;
93
95 virtual StatusCode sendStore(TClass* cl, const void* obj, const std::string& classId, const std::string& contName, int num = 0) = 0;
96 };
97
98
100 {
101 public:
102 virtual ~IFactoryTool() = default;
103
104 virtual std::unique_ptr<IRootAuxDynReader>
105 getBranchAuxDynReader(TTree*, TBranch*) const = 0;
106
107 virtual std::unique_ptr<IRootAuxDynWriter>
108 getBranchAuxDynWriter(TTree&, TClass&, int bufferSize, int splitLevel,
109 int offsettab_len, bool do_branch_fill) const = 0;
110
111 virtual std::unique_ptr<IRNTupleAuxDynWriter>
112 getNTupleAuxDynWriter(TClass &tc) const = 0;
113
114 virtual std::unique_ptr<IRootAuxDynReader>
115 getNTupleAuxDynReader(const std::string& field_name, const std::string& field_type,
116 ROOT::RNTupleReader* reader) const = 0;
117
118 virtual std::unique_ptr<IAuxDynShare> getAuxDynShare(const IAthenaSerializeSvc* serSvc, IAthenaIPCTool* ipcTool) const = 0;
119
121 virtual bool hasAuxStore(std::string_view fieldname, TClass *tc) const = 0;
122
124 virtual bool hasAuxStoreIO(TClass *tc) const = 0;
125
130 virtual bool isAuxDynBranch(TBranch *branch) const = 0;
131 };
132
133} // namespace
134
135#endif
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:583
Specialization of RootAuxDynStore for reading Aux Dynamic attributes from RNTuple.
std::tuple< std::string, std::string, void * > attrDataTuple