Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RTrivialDS.hxx
Go to the documentation of this file.
1 // Author: Enrico Guiraud, Danilo Piparo CERN 9/2017
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_RTRIVIALTDS
12 #define ROOT_RTRIVIALTDS
13 
14 #include "ROOT/RDF/RInterface.hxx"
15 #include "ROOT/RDataSource.hxx"
16 
17 namespace ROOT {
18 
19 namespace RDF {
20 
21 class RTrivialDS final : public ROOT::RDF::RDataSource {
22 private:
23  unsigned int fNSlots = 0U;
24  ULong64_t fSize = 0ULL;
25  bool fSkipEvenEntries = false;
26  std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
27  std::vector<std::string> fColNames{"col0"};
28  std::vector<ULong64_t> fCounter;
29  std::vector<ULong64_t *> fCounterAddr;
30  std::vector<void *> GetColumnReadersImpl(std::string_view name, const std::type_info &);
31 
32 protected:
33  std::string AsString() { return "trivial data source"; };
34 
35 public:
36  RTrivialDS(ULong64_t size, bool skipEvenEntries = false);
37  ~RTrivialDS();
38  const std::vector<std::string> &GetColumnNames() const;
39  bool HasColumn(std::string_view colName) const;
40  std::string GetTypeName(std::string_view) const;
41  std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges();
42  bool SetEntry(unsigned int slot, ULong64_t entry);
43  void SetNSlots(unsigned int nSlots);
44  void Initialise();
45  std::string GetLabel();
46 };
47 
48 RInterface<RDFDetail::RLoopManager, RTrivialDS> MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries = false);
49 
50 } // ns RDF
51 
52 } // ns ROOT
53 
54 #endif