Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:08:33

0001 /// \file ROOT/RNTupleFillStatus.hxx
0002 /// \ingroup NTuple
0003 /// \author Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
0004 /// \date 2024-04-15
0005 
0006 /*************************************************************************
0007  * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers.               *
0008  * All rights reserved.                                                  *
0009  *                                                                       *
0010  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0011  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0012  *************************************************************************/
0013 
0014 #ifndef ROOT_RNTupleFillStatus
0015 #define ROOT_RNTupleFillStatus
0016 
0017 #include <ROOT/RNTupleUtil.hxx>
0018 
0019 #include <cstddef>
0020 
0021 namespace ROOT {
0022 
0023 namespace Experimental {
0024 class RNTupleFillContext;
0025 }
0026 
0027 // clang-format off
0028 /**
0029 \class ROOT::RNTupleFillStatus
0030 \ingroup NTuple
0031 \brief A status object after filling an entry
0032 
0033 After passing an instance to RNTupleWriter::FillNoFlush or RNTupleFillContext::FillNoFlush, the caller must check
0034 ShouldFlushCluster and call RNTupleWriter::FlushCluster or RNTupleFillContext::FlushCluster if necessary.
0035 */
0036 // clang-format on
0037 class RNTupleFillStatus {
0038    friend class Experimental::RNTupleFillContext;
0039 
0040 private:
0041    /// Number of entries written into the current cluster
0042    ROOT::NTupleSize_t fNEntriesSinceLastFlush = 0;
0043    /// Number of bytes written into the current cluster
0044    std::size_t fUnzippedClusterSize = 0;
0045    /// Number of bytes written for the last entry
0046    std::size_t fLastEntrySize = 0;
0047    bool fShouldFlushCluster = false;
0048 
0049 public:
0050    /// Return the number of entries written into the current cluster.
0051    ROOT::NTupleSize_t GetNEntries() const { return fNEntriesSinceLastFlush; }
0052    /// Return the number of bytes written into the current cluster.
0053    std::size_t GetUnzippedClusterSize() const { return fUnzippedClusterSize; }
0054    /// Return the number of bytes for the last entry.
0055    std::size_t GetLastEntrySize() const { return fLastEntrySize; }
0056    /// Return true if the caller should call FlushCluster.
0057    bool ShouldFlushCluster() const { return fShouldFlushCluster; }
0058 }; // class RNTupleFillContext
0059 
0060 } // namespace ROOT
0061 
0062 #endif // ROOT_RNTupleFillStatus