Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide default implementation of virtual method #18033

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tree/dataframe/inc/ROOT/RDataSource.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "TString.h"

#include <algorithm> // std::transform
#include <cassert>
#include <string>
#include <typeinfo>
#include <vector>
Expand Down Expand Up @@ -130,7 +131,12 @@ public:
/// Slots numbers are used to simplify parallel execution: RDataFrame guarantees that different threads will always
/// pass different slot values when calling methods concurrently.
// clang-format on
virtual void SetNSlots(unsigned int nSlots) = 0;
virtual void SetNSlots(unsigned int nSlots)
{
assert(fNSlots == 0);
assert(nSlots > 0);
fNSlots = nSlots;
};

/// \brief Returns the number of files from which the dataset is constructed
virtual std::size_t GetNFiles() const { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion tree/dataframe/inc/ROOT/RVecDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public:
return true;
}

void SetNSlots(unsigned int nSlots)
void SetNSlots(unsigned int nSlots) final
{
fNSlots = nSlots;
const auto nCols = fColNames.size();
Expand Down
2 changes: 0 additions & 2 deletions tree/dataframe/test/RArraysDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ public:
RArraysDS &operator=(RArraysDS &&) = delete;
~RArraysDS() final = default;

void SetNSlots(unsigned int) final { }

const std::vector<std::string> &GetColumnNames() const final { return fColumnNames; }

bool HasColumn(std::string_view name) const final
Expand Down
3 changes: 1 addition & 2 deletions tree/dataframe/test/RNonCopiableColumnDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public:
auto entryRanges(std::move(fEntryRanges)); // empty fEntryRanges
return entryRanges;
};
bool SetEntry(unsigned int, ULong64_t) final { return true;};
void SetNSlots(unsigned int) final {};
bool SetEntry(unsigned int, ULong64_t) final { return true; };
std::string GetLabel() final {
return "NonCopiableColumnDS";
}
Expand Down
1 change: 0 additions & 1 deletion tree/dataframe/test/RStreamingDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public:
RStreamingDS &operator=(RStreamingDS &&) = delete;
~RStreamingDS() final = default;

void SetNSlots(unsigned int nSlots) final { fNSlots = nSlots; }
const std::vector<std::string> &GetColumnNames() const final { return fColumnNames; }
bool HasColumn(std::string_view name) const final { return std::string(name) == "ans" ? true : false; }
std::string GetTypeName(std::string_view) const final { return "int"; }
Expand Down
Loading