ATLAS Offline Software
Loading...
Searching...
No Matches
RNTCollection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef RNTCOLLECTION_H
6#define RNTCOLLECTION_H
7
11
12#include "POOLCore/DbPrint.h"
13
14#include "GaudiKernel/IFileMgr.h"
15#include "GaudiKernel/SmartIF.h"
16#include "Gaudi/PluginService.h"
17
18
19#include <string>
20#include <memory>
21
22#include "RVersion.h"
23
24class TFile;
25class IFileMgr;
26
27namespace ROOT {
28 class RNTupleModel;
29 class RNTupleWriter;
30 class RNTupleReader;
31}
32
33namespace pool {
34
35 class ISession;
36
37 namespace RootCollection {
38 class Attribute;
39 class AttributeSpecification;
40
41 static constexpr auto MODULE_NAME = "RootCollection";
42
46
47 class RNTCollection : public ICollection, public APRMessaging {
48
49 public:
50 typedef Gaudi::PluginService::Factory<ICollection*( const ICollectionDescription*, ICollection::OpenMode, ISession*)> Factory;
51
64
65
69
72
74 virtual ICollection::OpenMode openMode() const final override;
75
77 virtual void open() final override;
78
80 virtual bool isOpen() const final override;
81
83 virtual void insertRow( const pool::CollectionRowBuffer& inputRowBuffer ) final override;
84
86 virtual void commit( bool restartTransaction = false ) final override;
87
89 virtual void close() final override;
90
92 virtual const ICollectionDescription& description() const final override;
93
95 virtual ICollectionCursor& cursor() final override;
96
97 private:
100 RNTCollection & operator = (const RNTCollection &) = delete;
101
102 void delayedFileOpen(const std::string& method);
104 void addField(ROOT::RNTupleModel* model, const std::string& field_name, const std::string& field_type);
105
106 void cleanup();
107
109 std::unique_ptr<ROOT::RNTupleReader> m_reader;
111
112 std::string m_name;
115 TFile* m_file;
117 bool m_open;
118
119 SmartIF<IFileMgr> m_fileMgr;
120 };
121 }
122}
123#endif
APRMessaging(const std::string &name)
An implementation of the ICollectionDescription interface used to define the properties of a collecti...
A class that acts as a buffer to be filled with the event reference and associated metadata values of...
An interface used to navigate the result of a query on a collection.
An interface used to define the properties of a collection to be constructed and to retrieve these pr...
An interface to a storage technology specific collection of event references and attributes.
Definition ICollection.h:23
OpenMode
Enumeration of the possible open modes of the collection.
Definition ICollection.h:26
ISession is the interface class for user (macroscopic) sessions Every transaction and connection to a...
Definition ISession.h:32
virtual void open() final override
Explicitly re-opens the collection after it has been closed.
virtual ICollection::OpenMode openMode() const final override
Return openMode.
std::unique_ptr< ROOT::RNTupleWriter > m_rntupleWriter
virtual const ICollectionDescription & description() const final override
Returns an object used to describe the collection properties.
RNTCollection(const pool::ICollectionDescription *description, pool::ICollection::OpenMode mode, pool::ISession *)
Constructor.
virtual void close() final override
Explicitly closes the collection.
CollectionDescription m_description
std::unique_ptr< ROOT::RNTupleReader > getCollectionRNTuple()
void addField(ROOT::RNTupleModel *model, const std::string &field_name, const std::string &field_type)
std::unique_ptr< ROOT::RNTupleReader > m_reader
virtual void commit(bool restartTransaction=false) final override
Commits the last changes made to the collection.
virtual void insertRow(const pool::CollectionRowBuffer &inputRowBuffer) final override
Adds a new row of data to the collection.
virtual bool isOpen() const final override
Checks if the collection is open.
virtual ICollectionCursor & cursor() final override
Returns a cursor for the collection.
void delayedFileOpen(const std::string &method)
Gaudi::PluginService::Factory< ICollection *(const ICollectionDescription *, ICollection::OpenMode, ISession *)> Factory
STL class.
Selection rules: declare transient members.
Definition DataVector.h:581
static constexpr auto MODULE_NAME
pool namespace
Definition libname.h:15
STL namespace.
#define private