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 <cstdint>
0020 #include <string>
0021 #include <vector>
0022 #include <unordered_set>
0023 
0024 #include <ROOT/RNTupleUtil.hxx>
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 
0054          kDefaults = kShowProgressBar
0055       };
0056 
0057       std::string fOutputPath;
0058       std::uint64_t fFlags;
0059 
0060       /// Optional filter that determines which columns are included or excluded from being exported.
0061       /// By default, export all columns. If you only want to include certain column types, add them
0062       /// to `fColumnTypeFilter.fSet` and change `fColumnTypeFilter.fType` to kWhitelist.
0063       RFilter<ENTupleColumnType> fColumnTypeFilter;
0064 
0065       RPagesOptions() : fOutputPath("."), fFlags(kDefaults) {}
0066    };
0067 
0068    struct RPagesResult {
0069       std::vector<std::string> fExportedFileNames;
0070    };
0071 
0072    /// Given a page source, writes all its pages to individual files (1 per page).
0073    /// If the source is not already attached, it will be attached by this process.
0074    static RPagesResult ExportPages(ROOT::Internal::RPageSource &source, const RPagesOptions &options = {});
0075 };
0076 
0077 } // namespace ROOT::Experimental::Internal
0078 
0079 #endif