Example of a streaming vector: a special purpose container that reads large vectors piece-wise.
#include <cstdint>
#include <iostream>
#include <vector>
#include <utility>
constexpr char const *kFileName = "ntpl016_streaming_vector.root";
{
auto prng = std::make_unique<TRandom3>();
}
std::cout << "RNTuple written" << std::endl;
}
{
std::cout <<
"Simple reading, found " <<
nEntries <<
" entries" << std::endl;
std::cout <<
"Size and sum of vector: " <<
vectorSize <<
" " <<
sum << std::endl;
}
std::cout << "RNTuple simple read" << std::endl;
}
template <class T>
public:
class Iterator {
public:
using iterator = Iterator;
using iterator_category = std::input_iterator_tag;
using value_type = T;
using pointer = const T *;
using reference = const T &;
{
}
iterator operator++(int)
{
++(*this);
}
iterator &operator++()
{
return *this;
}
reference
operator*() {
return fView.operator()(*fRangeItr); }
pointer operator->() { return &fView.operator()(*fRangeItr); }
};
{
}
Iterator begin() {
return Iterator(fRange.begin(),
fItemView); }
{
}
};
{
std::cout <<
"Streamed reading, found " <<
nEntries <<
" entries" << std::endl;
std::cout <<
"Size and sum of vector: " <<
vectorSize <<
" " <<
sum << std::endl;
}
std::cout << "RNTuple streaming read" << std::endl;
}
{
}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Bool_t operator!=(const TDatime &d1, const TDatime &d2)
Bool_t operator==(const TDatime &d1, const TDatime &d2)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
TTime operator*(const TTime &t1, const TTime &t2)
A view for a collection, that can itself generate new ntuple views for its nested fields.
Used to loop over entries of collections in a single cluster.
static std::unique_ptr< RNTupleModel > Create()
Common user-tunable settings for reading RNTuples.
void SetClusterCache(EClusterCache val)
static std::unique_ptr< RNTupleReader > Open(std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Open an RNTuple for reading.
An RNTupleView for a known type.
static std::unique_ptr< RNTupleWriter > Recreate(std::unique_ptr< ROOT::RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Creates an RNTupleWriter backed by storage, overwriting it if one with the same URI exists.
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
static uint64_t sum(uint64_t i)