Skip to content

Commit

Permalink
[dataset] rename RForest RDataSet root-project#3 (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
jblomer committed May 12, 2019
1 parent e5f1507 commit 1124e26
Show file tree
Hide file tree
Showing 27 changed files with 89 additions and 89 deletions.
10 changes: 5 additions & 5 deletions tree/dataframe/inc/ROOT/RDataSetDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ namespace ROOT {
namespace Experimental {

class RInputForest;
class RForestEntry;
class REntry;


class RDataSetDS final : public ROOT::RDF::RDataSource {
std::unique_ptr<ROOT::Experimental::RInputForest> fForest;
std::unique_ptr<ROOT::Experimental::RForestEntry> fEntry;
std::unique_ptr<ROOT::Experimental::RInputForest> fDataSet;
std::unique_ptr<ROOT::Experimental::REntry> fEntry;
unsigned fNSlots;
bool fHasSeenAllRanges;
std::vector<std::string> fColumnNames;
std::vector<std::string> fColumnTypes;
std::vector<void*> fValuePtrs;

public:
RDataSetDS(std::unique_ptr<ROOT::Experimental::RInputForest> forest);
RDataSetDS(std::unique_ptr<ROOT::Experimental::RInputForest> dataSet);
~RDataSetDS();
void SetNSlots(unsigned int nSlots) final;
const std::vector<std::string> &GetColumnNames() const final;
Expand All @@ -58,7 +58,7 @@ protected:
Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &) final;
};

RDataFrame MakeDataSetDataFrame(std::string_view forestName, std::string_view fileName);
RDataFrame MakeDataSetDataFrame(std::string_view dsName, std::string_view fileName);

} // ns Experimental
} // ns ROOT
Expand Down
16 changes: 8 additions & 8 deletions tree/dataframe/src/RDataSetDS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
namespace ROOT {
namespace Experimental {

RDataSetDS::RDataSetDS(std::unique_ptr<ROOT::Experimental::RInputForest> forest)
: fForest(std::move(forest)), fEntry(fForest->GetModel()->CreateEntry()), fNSlots(1), fHasSeenAllRanges(false)
RDataSetDS::RDataSetDS(std::unique_ptr<ROOT::Experimental::RInputForest> dataSet)
: fDataSet(std::move(dataSet)), fEntry(fDataSet->GetModel()->CreateEntry()), fNSlots(1), fHasSeenAllRanges(false)
{
auto rootField = fForest->GetModel()->GetRootField();
auto rootField = fDataSet->GetModel()->GetRootField();
for (auto& f : *rootField) {
if (f.GetParent() != rootField)
continue;
Expand Down Expand Up @@ -67,7 +67,7 @@ RDF::RDataSource::Record_t RDataSetDS::GetColumnReadersImpl(std::string_view nam
}

bool RDataSetDS::SetEntry(unsigned int /*slot*/, ULong64_t entryIndex) {
fForest->LoadEntry(entryIndex, fEntry.get());
fDataSet->LoadEntry(entryIndex, fEntry.get());
return true;
}

Expand All @@ -76,7 +76,7 @@ std::vector<std::pair<ULong64_t, ULong64_t>> RDataSetDS::GetEntryRanges()
std::vector<std::pair<ULong64_t, ULong64_t>> ranges;
if (fHasSeenAllRanges) return ranges;

auto nEntries = fForest->GetNEntries();
auto nEntries = fDataSet->GetNEntries();
const auto chunkSize = nEntries / fNSlots;
const auto reminder = 1U == fNSlots ? 0 : nEntries % fNSlots;
auto start = 0UL;
Expand Down Expand Up @@ -120,9 +120,9 @@ void RDataSetDS::SetNSlots(unsigned int nSlots)
}


RDataFrame MakeDataSetDataFrame(std::string_view forestName, std::string_view fileName) {
auto forest = RInputForest::Open(forestName, fileName);
ROOT::RDataFrame rdf(std::make_unique<RDataSetDS>(std::move(forest)));
RDataFrame MakeDataSetDataFrame(std::string_view dsName, std::string_view fileName) {
auto ds = RInputForest::Open(dsName, fileName);
ROOT::RDataFrame rdf(std::make_unique<RDataSetDS>(std::move(ds)));
return rdf;
}

Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RColumn.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RColumn.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RColumnElement.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RColumnElement.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RColumnModel.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RColumnModel.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
20 changes: 10 additions & 10 deletions tree/dataset/v7/inc/ROOT/RDataSet.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForest.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/RDataSet.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-04
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForest
#define ROOT7_RForest
#ifndef ROOT7_RDataSet
#define ROOT7_RDataSet

#include <ROOT/RDataSetModel.hxx>
#include <ROOT/RDataSetUtil.hxx>
Expand All @@ -28,7 +28,7 @@
namespace ROOT {
namespace Experimental {

class RForestEntry;
class REntry;
class RForestModel;

namespace Detail {
Expand Down Expand Up @@ -134,7 +134,7 @@ public:
/// On I/O errors, raises an expection.
void LoadEntry(ForestSize_t index) { LoadEntry(index, fModel->GetDefaultEntry()); }
/// Fills a user provided entry after checking that the entry has been instantiated from the forest model
void LoadEntry(ForestSize_t index, RForestEntry* entry) {
void LoadEntry(ForestSize_t index, REntry* entry) {
for (auto& value : *entry) {
value.GetField()->Read(index, &value);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public:
void Fill() { Fill(fModel->GetDefaultEntry()); }
/// Multiple entries can have been instantiated from the forest model. This method will perform
/// a light check whether the entry comes from the forest's own model
void Fill(RForestEntry *entry) {
void Fill(REntry *entry) {
for (auto& treeValue : *entry) {
treeValue.GetField()->Append(treeValue);
}
Expand All @@ -212,15 +212,15 @@ public:
class RCollectionForest {
private:
ClusterSize_t fOffset;
std::unique_ptr<RForestEntry> fDefaultEntry;
std::unique_ptr<REntry> fDefaultEntry;
public:
explicit RCollectionForest(std::unique_ptr<RForestEntry> defaultEntry);
explicit RCollectionForest(std::unique_ptr<REntry> defaultEntry);
RCollectionForest(const RCollectionForest&) = delete;
RCollectionForest& operator=(const RCollectionForest&) = delete;
~RCollectionForest() = default;

void Fill() { Fill(fDefaultEntry.get()); }
void Fill(RForestEntry *entry) {
void Fill(REntry *entry) {
for (auto& treeValue : *entry) {
treeValue.GetField()->Append(treeValue);
}
Expand Down
8 changes: 4 additions & 4 deletions tree/dataset/v7/inc/ROOT/RDataSetDescriptor.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForestDescriptor.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/RDataSetDescriptor.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-07-19
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForestDescriptor
#define ROOT7_RForestDescriptor
#ifndef ROOT7_RDataSetDescriptor
#define ROOT7_RDataSetDescriptor

#include <ROOT/RColumnModel.hxx>
#include <ROOT/RDataSetUtil.hxx>
Expand Down
14 changes: 7 additions & 7 deletions tree/dataset/v7/inc/ROOT/RDataSetModel.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForestModel.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/RDataSetModel.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-04
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForestModel
#define ROOT7_RForestModel
#ifndef ROOT7_RDataSetModel
#define ROOT7_RDataSetModel

#include <ROOT/REntry.hxx>
#include <ROOT/RField.hxx>
Expand Down Expand Up @@ -47,7 +47,7 @@ class RForestModel {
/// Hierarchy of fields consisting of simple types and collections (sub trees)
std::unique_ptr<RFieldRoot> fRootField;
/// Contains field values corresponding to the created top-level fields
std::unique_ptr<RForestEntry> fDefaultEntry;
std::unique_ptr<REntry> fDefaultEntry;

public:
RForestModel();
Expand Down Expand Up @@ -88,8 +88,8 @@ public:
std::unique_ptr<RForestModel> collectionModel);

RFieldRoot* GetRootField() { return fRootField.get(); }
RForestEntry* GetDefaultEntry() { return fDefaultEntry.get(); }
std::unique_ptr<RForestEntry> CreateEntry();
REntry* GetDefaultEntry() { return fDefaultEntry.get(); }
std::unique_ptr<REntry> CreateEntry();
};

} // namespace Exerimental
Expand Down
8 changes: 4 additions & 4 deletions tree/dataset/v7/inc/ROOT/RDataSetUtil.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForestUtil.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/RDataSetUtil.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-04
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForestUtil
#define ROOT7_RForestUtil
#ifndef ROOT7_RDataSetUtil
#define ROOT7_RDataSetUtil

#include <cstdint>

Expand Down
8 changes: 4 additions & 4 deletions tree/dataset/v7/inc/ROOT/RDataSetView.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForestView.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/RDataSetView.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-05
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForestView
#define ROOT7_RForestView
#ifndef ROOT7_RDataSetView
#define ROOT7_RDataSetView

#include <ROOT/RDataSetUtil.hxx>
#include <ROOT/RField.hxx>
Expand Down
22 changes: 11 additions & 11 deletions tree/dataset/v7/inc/ROOT/REntry.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RForestEntry.hxx
/// \ingroup Forest ROOT7
/// \file ROOT/REntry.hxx
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-07-19
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand All @@ -13,8 +13,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/

#ifndef ROOT7_RForestEntry
#define ROOT7_RForestEntry
#ifndef ROOT7_REntry
#define ROOT7_REntry

#include <ROOT/RField.hxx>
#include <ROOT/RFieldValue.hxx>
Expand All @@ -31,15 +31,15 @@ namespace Experimental {

// clang-format off
/**
\class ROOT::Experimental::RForestEntry
\class ROOT::Experimental::REntry
\ingroup Forest
\brief The RForestEntry is a collection of values in a forest corresponding to a complete row in the data set
\brief The REntry is a collection of values in a forest corresponding to a complete row in the data set
The entry provides a memory-managed binder for a set of values. Through shared pointers, the memory locations
that are associated to values are managed.
*/
// clang-format on
class RForestEntry {
class REntry {
std::vector<Detail::RFieldValueBase> fValues;
/// The objects involed in serialization and deserialization might be used long after the entry is gone:
/// hence the shared pointer
Expand All @@ -48,10 +48,10 @@ class RForestEntry {
std::vector<std::size_t> fManagedValues;

public:
RForestEntry() = default;
RForestEntry(const RForestEntry& other) = delete;
RForestEntry& operator=(const RForestEntry& other) = delete;
~RForestEntry();
REntry() = default;
REntry(const REntry& other) = delete;
REntry& operator=(const REntry& other) = delete;
~REntry();

/// Adds a value whose storage is managed by the entry
void AddValue(const Detail::RFieldValueBase& value);
Expand Down
6 changes: 3 additions & 3 deletions tree/dataset/v7/inc/ROOT/RField.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RField.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down Expand Up @@ -44,7 +44,7 @@ namespace ROOT {
namespace Experimental {

class RCollectionForest;
class RForestEntry;
class REntry;
class RForestModel;
class RFieldCollection;

Expand Down Expand Up @@ -235,7 +235,7 @@ public:
size_t GetValueSize() const final { return 0; }

/// Generates managed values for the top-level sub fields
RForestEntry* GenerateEntry();
REntry* GenerateEntry();
};

/// The field for a class with dictionary
Expand Down
4 changes: 2 additions & 2 deletions tree/dataset/v7/inc/ROOT/RFieldValue.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RFieldValue.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down Expand Up @@ -35,7 +35,7 @@ class RFieldBase;
The data carried by the tree value is used by the computational code and it is supposed to be serialized on Fill
or deserialized into by tree reading. Only fields can generate their corresponding tree values. This class is a mere
wrapper around the memory location, it does not own it. Memory ownership is managed through the RForestEntry.
wrapper around the memory location, it does not own it. Memory ownership is managed through the REntry.
*/
// clang-format on
class RFieldValueBase {
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RPage.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RPage.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RPagePool.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RPagePool.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-09
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RPageStorage.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RPageStorage.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-07-19
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/inc/ROOT/RPageStorageRoot.hxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file ROOT/RPageStorage.hxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-07-19
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
2 changes: 1 addition & 1 deletion tree/dataset/v7/src/RColumn.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file RColumn.cxx
/// \ingroup Forest ROOT7
/// \ingroup DataSet ROOT7
/// \author Jakob Blomer <[email protected]>
/// \date 2018-10-04
/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
Expand Down
Loading

0 comments on commit 1124e26

Please sign in to comment.