Logo ROOT  
Reference Guide
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);
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
48RInterface<RDFDetail::RLoopManager, RTrivialDS> MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries = false);
49
50} // ns RDF
51
52} // ns ROOT
53
54#endif
unsigned long long ULong64_t
Definition: RtypesCore.h:70
char name[80]
Definition: TGX11.cxx:109
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
std::string GetLabel()
Return a string representation of the datasource type.
Definition: RTrivialDS.cxx:87
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()
Return ranges of entries to distribute to tasks.
Definition: RTrivialDS.cxx:48
void Initialise()
Convenience method called before starting an event-loop.
Definition: RTrivialDS.cxx:72
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
Definition: RTrivialDS.cxx:11
bool SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
Definition: RTrivialDS.cxx:54
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
Definition: RTrivialDS.hxx:26
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
Definition: RTrivialDS.cxx:38
std::vector< ULong64_t * > fCounterAddr
Definition: RTrivialDS.hxx:29
std::vector< ULong64_t > fCounter
Definition: RTrivialDS.hxx:28
std::vector< std::string > fColNames
Definition: RTrivialDS.hxx:27
unsigned int fNSlots
Definition: RTrivialDS.hxx:23
RTrivialDS(ULong64_t size, bool skipEvenEntries=false)
Definition: RTrivialDS.cxx:25
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset's column names.
Definition: RTrivialDS.cxx:33
void SetNSlots(unsigned int nSlots)
Inform RDataSource of the number of processing slots (i.e.
Definition: RTrivialDS.cxx:63
std::string GetTypeName(std::string_view) const
Type of a column as a string, e.g.
Definition: RTrivialDS.cxx:43
std::string AsString()
Definition: RTrivialDS.hxx:33
basic_string_view< char > string_view
RInterface< RDFDetail::RLoopManager, RTrivialDS > MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries=false)
Definition: RTrivialDS.cxx:92
VSD Structures.
Definition: StringConv.hxx:21