Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/ROOT/RNTupleExporter.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /// \file ROOT/RNTupleExporter.hxx
0002 /// \ingroup NTuple ROOT7
0003 /// \author Giacomo Parolini <giacomo.parolini@cern.ch>
0004 /// \date 2024-12-10
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_RNTupleExporter
0017 #define ROOT7_RNTupleExporter
0018 
0019 #include <ROOT/RNTupleTypes.hxx>
0020 
0021 #include <cstdint>
0022 #include <string>
0023 #include <vector>
0024 #include <unordered_set>
0025 
0026 namespace ROOT::Internal {
0027 class RPageSource;
0028 }
0029 
0030 namespace ROOT::Experimental::Internal {
0031 
0032 class RNTupleExporter {
0033 public:
0034    enum class EFilterType {
0035       /// Don't export items contained in the filter's set
0036       kBlacklist,
0037       /// Export only items contained in the filter's set
0038       kWhitelist
0039    };
0040 
0041    template <typename T>
0042    struct RFilter {
0043       std::unordered_set<T> fSet;
0044       EFilterType fType = EFilterType::kBlacklist;
0045    };
0046 
0047    struct RPagesOptions {
0048       enum RExportPageFlags {
0049          kNone = 0x0,
0050          kIncludeChecksums = 0x1,
0051          /// If enabled, the exporter will report the current progress on the stderr
0052          kShowProgressBar = 0x2,
0053          /// If enabled, uncompress (but don't unpack) the page (mutually exclusive with kIncludeChecksums)
0054          kDecompress = 0x04,
0055 
0056          kDefaults = kShowProgressBar
0057       };
0058 
0059       std::string fOutputPath;
0060       std::uint64_t fFlags;
0061 
0062       /// Optional filter that determines which columns are included or excluded from being exported.
0063       /// By default, export all columns. If you only want to include certain column types, add them
0064       /// to `fColumnTypeFilter.fSet` and change `fColumnTypeFilter.fType` to kWhitelist.
0065       RFilter<ENTupleColumnType> fColumnTypeFilter;
0066 
0067       RPagesOptions() : fOutputPath("."), fFlags(kDefaults) {}
0068    };
0069 
0070    struct RPagesResult {
0071       std::vector<std::string> fExportedFileNames;
0072    };
0073 
0074    /// Given a page source, writes all its pages to individual files (1 per page).
0075    /// If the source is not already attached, it will be attached by this process.
0076    static RPagesResult ExportPages(ROOT::Internal::RPageSource &source, const RPagesOptions &options = {});
0077 };
0078 
0079 } // namespace ROOT::Experimental::Internal
0080 
0081 #endif