Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
15#include "ROOT/RDataSource.hxx"
16
17namespace ROOT {
18
19namespace RDF {
20
21class RTrivialDS final : public ROOT::RDF::RDataSource {
22private:
23 unsigned int fNSlots = 0U;
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
32protected:
33 std::string AsString() { return "trivial data source"; };
34
35public:
36 RTrivialDS(ULong64_t size, bool skipEvenEntries = false);
37 /// This ctor produces a data-source that returns infinite entries
38 RTrivialDS();
40 const std::vector<std::string> &GetColumnNames() const;
41 bool HasColumn(std::string_view colName) const;
42 std::string GetTypeName(std::string_view) const;
43 std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges();
44 bool SetEntry(unsigned int slot, ULong64_t entry);
45 void SetNSlots(unsigned int nSlots);
46 void Initialise();
47 std::string GetLabel();
48};
49
50// Make a RDF wrapping a RTrivialDS with the specified amount of entries
51RInterface<RDFDetail::RLoopManager, RTrivialDS> MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries = false);
52// Make a RDF wrapping a RTrivialDS with infinite entries
53RInterface<RDFDetail::RLoopManager, RTrivialDS> MakeTrivialDataFrame();
54
55} // ns RDF
56
57} // ns ROOT
58
59#endif
unsigned long long ULong64_t
Definition RtypesCore.h:74
char name[80]
Definition TGX11.cxx:110
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
std::string GetLabel()
Return a string representation of the datasource type.
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()
Return ranges of entries to distribute to tasks.
void Initialise()
Convenience method called before starting an event-loop.
std::vector< void * > GetColumnReadersImpl(std::string_view name, const std::type_info &)
type-erased vector of pointers to pointers to column values - one per slot
bool SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
std::vector< ULong64_t * > fCounterAddr
std::vector< ULong64_t > fCounter
std::vector< std::string > fColNames
RTrivialDS()
This ctor produces a data-source that returns infinite entries.
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset's column names.
void SetNSlots(unsigned int nSlots)
Inform RDataSource of the number of processing slots (i.e.
std::string GetTypeName(std::string_view) const
Type of a column as a string, e.g.
std::string AsString()
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...