11#ifndef ROOT_RDATASOURCE
12#define ROOT_RDATASOURCE
67 const auto typedPtr =
static_cast<T *
>(
fPointer);
117 bool fDeprecatedBaseCalled =
false;
124 virtual std::string
AsString() {
return "generic data source"; };
143 virtual bool HasColumn(std::string_view colName)
const = 0;
149 virtual std::string
GetTypeName(std::string_view colName)
const = 0;
159 template <
typename T>
163 std::vector<T **> typedVec(typeErasedVec.size());
164 std::transform(typeErasedVec.begin(), typeErasedVec.end(), typedVec.begin(),
165 [](
void *
p) { return static_cast<T **>(p); });
174 virtual std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
214 "Use Initialize, Finalize and FinalizeSlot instead of the corresponding british spellings.")
215 NeverUsedJustAReminder {
218 virtual void Initialise() { fDeprecatedBaseCalled =
true; }
220 void CallInitialize()
222 fDeprecatedBaseCalled =
false;
224 if (!fDeprecatedBaseCalled) {
225 Warning(
"RDataSource::Initialise",
"Initialise is deprecated. Please rename it to \"Initialize\" (with a z).");
250 virtual void FinaliseSlot(
unsigned int) { fDeprecatedBaseCalled =
true; }
252 void CallFinalizeSlot(
unsigned int slot)
254 fDeprecatedBaseCalled =
false;
256 if (!fDeprecatedBaseCalled) {
257 Warning(
"RDataSource::FinaliseSlot",
258 "FinaliseSlot is deprecated. Please implement FinalizeSlot (with a z) instead of FinaliseSlot.");
273 virtual void Finalise() { fDeprecatedBaseCalled =
true; }
277 fDeprecatedBaseCalled =
false;
279 if (!fDeprecatedBaseCalled) {
280 Warning(
"RDataSource::FinaliseSlot",
281 "Finalise is deprecated. Please implement Finalize (with a z) instead of Finalise.");
293 virtual std::string
GetLabel() {
return "Custom Datasource"; }
#define R__DEPRECATED(MAJOR, MINOR, REASON)
unsigned long long ULong64_t
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
winID h TVirtualViewer3D TVirtualGLPainter p
Mother class of TTypedPointerHolder.
virtual ~TPointerHolder()
virtual TPointerHolder * GetDeepCopy()=0
TPointerHolder(void *ptr)
Class to wrap a pointer and delete the memory associated to it correctly.
TTypedPointerHolder(T *ptr)
TPointerHolder * GetDeepCopy() final
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
virtual bool HasColumn(std::string_view colName) const =0
Checks if the dataset has a certain column.
virtual void Finalize()
Convenience method called after concluding an event-loop.
virtual void InitSlot(unsigned int, ULong64_t)
Convenience method called at the start of the data processing associated to a slot.
virtual void FinalizeSlot(unsigned int)
Convenience method called at the end of the data processing associated to a slot.
virtual ~RDataSource()=default
virtual std::string AsString()
virtual bool SetEntry(unsigned int slot, ULong64_t entry)=0
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
std::vector< void * > Record_t
virtual std::string GetLabel()
Return a string representation of the datasource type.
virtual void SetNSlots(unsigned int nSlots)=0
Inform RDataSource of the number of processing slots (i.e.
virtual const std::vector< std::string > & GetColumnNames() const =0
Returns a reference to the collection of the dataset's column names.
virtual std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()=0
Return ranges of entries to distribute to tasks.
virtual Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &)=0
type-erased vector of pointers to pointers to column values - one per slot
virtual std::string GetTypeName(std::string_view colName) const =0
Type of a column as a string, e.g.
std::vector< T ** > GetColumnReaders(std::string_view columnName)
Called at most once per column by RDF.
virtual std::unique_ptr< ROOT::Detail::RDF::RColumnReaderBase > GetColumnReaders(unsigned int, std::string_view, const std::type_info &)
If the other GetColumnReaders overload returns an empty vector, this overload will be called instead.
virtual void Initialize()
Convenience method called before starting an event-loop.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.