Skip to content
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
2 changes: 2 additions & 0 deletions README/ReleaseNotes/v640/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ This change affects the following classes: `TFile`, `TMapFile`, `TMemFile`, `TD

### RNTuple

* `RRawPtrWriteEntry` is now part of the stable API, in the `ROOT::Detail` namespace. It is useful for frameworks passing data to RNTuple as `const` raw pointers.

## Math

### Migration from VecCore/Vc to `std::experimental::simd` for Vectorization
Expand Down
9 changes: 1 addition & 8 deletions tree/ntuple/inc/ROOT/RFieldBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,9 @@ class RClassField;

namespace Detail {
class RFieldVisitor;
} // namespace Detail

namespace Experimental {

namespace Detail {
class RRawPtrWriteEntry;
} // namespace Detail

} // namespace Experimental

namespace Internal {

class RPageSink;
Expand Down Expand Up @@ -86,7 +79,7 @@ This is and can only be partially enforced through C++.
// clang-format on
class RFieldBase {
friend class RFieldZero; // to reset fParent pointer in ReleaseSubfields()
friend class ROOT::Experimental::Detail::RRawPtrWriteEntry; // to call Append()
friend class ROOT::Detail::RRawPtrWriteEntry; // to call Append()
friend struct ROOT::Internal::RFieldCallbackInjector; // used for unit tests
friend struct ROOT::Internal::RFieldRepresentationModifier; // used for unit tests
friend void Internal::CallFlushColumnsOnField(RFieldBase &);
Expand Down
4 changes: 1 addition & 3 deletions tree/ntuple/inc/ROOT/RFieldToken.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ namespace ROOT {
class REntry;
class RNTupleModel;

namespace Experimental {
namespace Detail {
class RRawPtrWriteEntry;
} // namespace Detail
} // namespace Experimental

// clang-format off
/**
Expand All @@ -40,7 +38,7 @@ It can be used for fast indexing in REntry's methods, e.g. REntry::BindValue().
class RFieldToken {
friend class REntry;
friend class RNTupleModel;
friend class Experimental::Detail::RRawPtrWriteEntry;
friend class Detail::RRawPtrWriteEntry;

std::size_t fIndex = 0; ///< The index of the field (top-level or registered subfield)
std::uint64_t fSchemaId = std::uint64_t(-1); ///< Safety check to prevent tokens from other models being used
Expand Down
6 changes: 3 additions & 3 deletions tree/ntuple/inc/ROOT/RNTupleFillContext.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ public:
///
/// This method will check the entry's model ID to ensure it comes from the context's own model or throw an exception
/// otherwise.
void FillNoFlush(Experimental::Detail::RRawPtrWriteEntry &entry, ROOT::RNTupleFillStatus &status)
void FillNoFlush(ROOT::Detail::RRawPtrWriteEntry &entry, ROOT::RNTupleFillStatus &status)
{
FillNoFlushImpl(entry, status);
}
/// Fill an RRawPtrWriteEntry into this context. This method will check the entry's model ID to ensure it comes
/// from the context's own model or throw an exception otherwise.
/// \return The number of uncompressed bytes written.
std::size_t Fill(Experimental::Detail::RRawPtrWriteEntry &entry) { return FillImpl(entry); }
std::size_t Fill(ROOT::Detail::RRawPtrWriteEntry &entry) { return FillImpl(entry); }

/// Flush column data, preparing for CommitCluster or to reduce memory usage. This will trigger compression of pages,
/// but not actually write to storage.
Expand All @@ -148,7 +148,7 @@ public:

const ROOT::RNTupleModel &GetModel() const { return *fModel; }
std::unique_ptr<ROOT::REntry> CreateEntry() const { return fModel->CreateEntry(); }
std::unique_ptr<Experimental::Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const
std::unique_ptr<ROOT::Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const
{
return fModel->CreateRawPtrWriteEntry();
}
Expand Down
4 changes: 1 addition & 3 deletions tree/ntuple/inc/ROOT/RNTupleModel.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ class RNTupleWriteOptions;
class RNTupleModel;
class RNTupleWriter;

namespace Experimental {
namespace Detail {
class RRawPtrWriteEntry;
} // namespace Detail
} // namespace Experimental

namespace Internal {
class RProjectedFields;
Expand Down Expand Up @@ -343,7 +341,7 @@ public:
/// Creates a "bare entry", i.e. a entry with all null values. The user needs to explicitly call BindValue() or
/// BindRawPtr() to set memory addresses before serializing / deserializing the entry.
std::unique_ptr<REntry> CreateBareEntry() const;
std::unique_ptr<Experimental::Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const;
std::unique_ptr<Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const;
/// Creates a token to be used in REntry methods to address a field present in the entry
ROOT::RFieldToken GetToken(std::string_view fieldName) const;
/// Calls the given field's CreateBulk() method. Throws an RException if no field with the given name exists.
Expand Down
6 changes: 3 additions & 3 deletions tree/ntuple/inc/ROOT/RNTupleWriter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public:
/// Fill an RRawPtrWriteEntry into this ntuple. This method will check the entry's model ID to ensure it comes from
/// the writer's own model or throw an exception otherwise.
/// \return The number of uncompressed bytes written.
std::size_t Fill(Experimental::Detail::RRawPtrWriteEntry &entry) { return fFillContext.Fill(entry); }
std::size_t Fill(ROOT::Detail::RRawPtrWriteEntry &entry) { return fFillContext.Fill(entry); }
/// Fill an RRawPtrWriteEntry into this ntuple, but don't commit the cluster. The calling code must pass an
/// RNTupleFillStatus and check RNTupleFillStatus::ShouldFlushCluster.
void FillNoFlush(Experimental::Detail::RRawPtrWriteEntry &entry, RNTupleFillStatus &status)
void FillNoFlush(ROOT::Detail::RRawPtrWriteEntry &entry, RNTupleFillStatus &status)
{
fFillContext.FillNoFlush(entry, status);
}
Expand All @@ -196,7 +196,7 @@ public:
void CommitDataset();

std::unique_ptr<ROOT::REntry> CreateEntry() const { return fFillContext.CreateEntry(); }
std::unique_ptr<Experimental::Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const
std::unique_ptr<ROOT::Detail::RRawPtrWriteEntry> CreateRawPtrWriteEntry() const
{
return fFillContext.CreateRawPtrWriteEntry();
}
Expand Down
4 changes: 1 addition & 3 deletions tree/ntuple/inc/ROOT/RRawPtrWriteEntry.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ class RNTupleModel;

class RNTupleFillContext;

namespace Experimental {
namespace Detail {

// clang-format off
/**
\class ROOT::Experimental::Detail::RRawPtrWriteEntry
\class ROOT::Detail::RRawPtrWriteEntry
\ingroup NTuple
\brief A container of const raw pointers, corresponding to a row in the data set

Expand Down Expand Up @@ -120,7 +119,6 @@ public:
};

} // namespace Detail
} // namespace Experimental
} // namespace ROOT

#endif
5 changes: 2 additions & 3 deletions tree/ntuple/src/RNTupleModel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,15 @@ std::unique_ptr<ROOT::REntry> ROOT::RNTupleModel::CreateBareEntry() const
return entry;
}

std::unique_ptr<ROOT::Experimental::Detail::RRawPtrWriteEntry> ROOT::RNTupleModel::CreateRawPtrWriteEntry() const
std::unique_ptr<ROOT::Detail::RRawPtrWriteEntry> ROOT::RNTupleModel::CreateRawPtrWriteEntry() const
{
switch (fModelState) {
case EState::kBuilding: throw RException(R__FAIL("invalid attempt to create entry of unfrozen model"));
case EState::kExpired: throw RException(R__FAIL("invalid attempt to create entry of expired model"));
case EState::kFrozen: break;
}

auto entry = std::unique_ptr<Experimental::Detail::RRawPtrWriteEntry>(
new Experimental::Detail::RRawPtrWriteEntry(fModelId, fSchemaId));
auto entry = std::unique_ptr<Detail::RRawPtrWriteEntry>(new Detail::RRawPtrWriteEntry(fModelId, fSchemaId));
for (const auto &f : fFieldZero->GetMutableSubfields()) {
entry->AddField(*f);
}
Expand Down
10 changes: 2 additions & 8 deletions tutorials/io/ntuple/ntpl014_framework.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
/// \date September 2024
/// \author The ROOT Team

// NOTE: The RRawPtrWriteEntry is experimental at this point.
// Functionality and interface are still subject to changes.

#include <ROOT/RRawPtrWriteEntry.hxx>
#include <ROOT/RFieldToken.hxx>
#include <ROOT/RNTupleFillContext.hxx>
Expand All @@ -49,9 +46,6 @@
#include <utility> // for std::pair
#include <vector>

// Import classes from Experimental namespace for the time being
using ROOT::Experimental::Detail::RRawPtrWriteEntry;

using ModelTokensPair = std::pair<std::unique_ptr<ROOT::RNTupleModel>, std::vector<ROOT::RFieldToken>>;

// A DataProduct associates an arbitrary address to an index in the model.
Expand Down Expand Up @@ -95,7 +89,7 @@ class ParallelOutputter final : public Outputter {

struct SlotData {
std::shared_ptr<ROOT::RNTupleFillContext> fillContext;
std::unique_ptr<RRawPtrWriteEntry> entry;
std::unique_ptr<ROOT::Detail::RRawPtrWriteEntry> entry;
};
std::vector<SlotData> fSlots;

Expand Down Expand Up @@ -161,7 +155,7 @@ class SerializingOutputter final : public Outputter {
std::vector<ROOT::RFieldToken> fTokens;

struct SlotData {
std::unique_ptr<RRawPtrWriteEntry> entry;
std::unique_ptr<ROOT::Detail::RRawPtrWriteEntry> entry;
};
std::vector<SlotData> fSlots;

Expand Down
Loading