Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleCollectionWriter.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleCollectionWriter.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2024-02-22
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RNTupleCollectionWriter
17#define ROOT7_RNTupleCollectionWriter
18
19#include <ROOT/REntry.hxx>
20#include <ROOT/RNTupleUtil.hxx>
21
22#include <cstddef>
23#include <memory>
24#include <utility>
25
26namespace ROOT {
27namespace Experimental {
28
29// clang-format off
30/**
31\class ROOT::Experimental::RNTupleCollectionWriter
32\ingroup NTuple
33\brief A virtual ntuple used for writing untyped collections that can be used to some extent like an RNTupleWriter
34*
35* This class is between a field and a ntuple. It carries the offset column for the collection and the default entry
36* taken from the collection model. It does not, however, own an ntuple model because the collection model has been
37* merged into the larger ntuple model.
38*/
39// clang-format on
41 friend class RCollectionField;
42
43private:
44 std::size_t fBytesWritten = 0;
46 std::unique_ptr<REntry> fDefaultEntry;
47
48public:
49 explicit RNTupleCollectionWriter(std::unique_ptr<REntry> defaultEntry)
50 : fOffset(0), fDefaultEntry(std::move(defaultEntry))
51 {
52 }
56
57 std::size_t Fill() { return Fill(*fDefaultEntry); }
58 std::size_t Fill(REntry &entry)
59 {
60 const std::size_t bytesWritten = entry.Append();
61 fBytesWritten += bytesWritten;
62 fOffset++;
63 return bytesWritten;
64 }
65
67}; // class RNTupleCollectionWriter
68
69} // namespace Experimental
70} // namespace ROOT
71
72#endif // ROOT7_RNTupleCollectionWriter
The collection field is only used for writing; when reading, untyped collections are projected to an ...
Definition RField.hxx:1619
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Definition REntry.hxx:45
A virtual ntuple used for writing untyped collections that can be used to some extent like an RNTuple...
RNTupleCollectionWriter(const RNTupleCollectionWriter &)=delete
RNTupleCollectionWriter(std::unique_ptr< REntry > defaultEntry)
RNTupleCollectionWriter & operator=(const RNTupleCollectionWriter &)=delete
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.