|
||||
File indexing completed on 2025-01-18 10:10:45
0001 /// \file ROOT/RNTupleCollectionWriter.hxx 0002 /// \ingroup NTuple ROOT7 0003 /// \author Jakob Blomer <jblomer@cern.ch> 0004 /// \date 2024-02-22 0005 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback 0006 /// is welcome! 0007 0008 /************************************************************************* 0009 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. * 0010 * All rights reserved. * 0011 * * 0012 * For the licensing terms see $ROOTSYS/LICENSE. * 0013 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0014 *************************************************************************/ 0015 0016 #ifndef ROOT7_RNTupleCollectionWriter 0017 #define ROOT7_RNTupleCollectionWriter 0018 0019 #include <ROOT/REntry.hxx> 0020 #include <ROOT/RNTupleUtil.hxx> 0021 0022 #include <cstddef> 0023 #include <memory> 0024 #include <utility> 0025 0026 namespace ROOT { 0027 namespace Experimental { 0028 0029 // clang-format off 0030 /** 0031 \class ROOT::Experimental::RNTupleCollectionWriter 0032 \ingroup NTuple 0033 \brief A virtual ntuple used for writing untyped collections that can be used to some extent like an RNTupleWriter 0034 * 0035 * This class is between a field and a ntuple. It carries the offset column for the collection and the default entry 0036 * taken from the collection model. It does not, however, own an ntuple model because the collection model has been 0037 * merged into the larger ntuple model. 0038 */ 0039 // clang-format on 0040 class RNTupleCollectionWriter { 0041 friend class RCollectionField; 0042 0043 private: 0044 std::size_t fBytesWritten = 0; 0045 ClusterSize_t fOffset; 0046 std::unique_ptr<REntry> fDefaultEntry; 0047 0048 public: 0049 explicit RNTupleCollectionWriter(std::unique_ptr<REntry> defaultEntry) 0050 : fOffset(0), fDefaultEntry(std::move(defaultEntry)) 0051 { 0052 } 0053 RNTupleCollectionWriter(const RNTupleCollectionWriter &) = delete; 0054 RNTupleCollectionWriter &operator=(const RNTupleCollectionWriter &) = delete; 0055 ~RNTupleCollectionWriter() = default; 0056 0057 std::size_t Fill() { return Fill(*fDefaultEntry); } 0058 std::size_t Fill(REntry &entry) 0059 { 0060 const std::size_t bytesWritten = entry.Append(); 0061 fBytesWritten += bytesWritten; 0062 fOffset++; 0063 return bytesWritten; 0064 } 0065 0066 ClusterSize_t *GetOffsetPtr() { return &fOffset; } 0067 }; // class RNTupleCollectionWriter 0068 0069 } // namespace Experimental 0070 } // namespace ROOT 0071 0072 #endif // ROOT7_RNTupleCollectionWriter
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |