16#ifndef ROOT7_RNTupleIndex
17#define ROOT7_RNTupleIndex
23#include <unordered_map>
27namespace Experimental {
46 RIndexValue(
const std::vector<NTupleIndexValue_t> &fieldValues)
61 std::size_t combinedHash = 0;
63 combinedHash ^= fieldVal + 0x9e3779b9 + (fieldVal << 6) + (fieldVal >> 2);
113 static std::unique_ptr<RNTupleIndex>
114 Create(
const std::vector<std::string> &fieldNames,
const RPageSource &pageSource,
bool deferBuild =
false);
159 template <
typename... Ts>
163 throw RException(
R__FAIL(
"number of values must match number of indexed fields"));
165 std::vector<void *> valuePtrs;
166 valuePtrs.reserve(
sizeof...(Ts));
167 ([&] { valuePtrs.push_back(&values); }(), ...);
179 const std::vector<NTupleSize_t> *
GetAllEntryNumbers(
const std::vector<void *> &valuePtrs)
const;
185 template <
typename... Ts>
189 throw RException(
R__FAIL(
"number of values must match number of indexed fields"));
191 std::vector<void *> valuePtrs;
192 valuePtrs.reserve(
sizeof...(Ts));
193 ([&] { valuePtrs.push_back(&values); }(), ...);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Container for the hashes of the indexed fields.
RIndexValue(const std::vector< NTupleIndexValue_t > &fieldValues)
bool operator==(const RIndexValue &other) const
std::vector< NTupleIndexValue_t > fFieldValues
Builds an index on one or several fields of an RNTuple so it can be joined onto other RNTuples.
std::unique_ptr< RPageSource > fPageSource
The page source belonging to the RNTuple for which to build the index.
RNTupleIndex(const RNTupleIndex &other)=delete
const std::vector< NTupleSize_t > * GetAllEntryNumbers(Ts... values) const
Get all entry numbers for the given index.
RNTupleIndex & operator=(RNTupleIndex &&other)=delete
NTupleSize_t GetFirstEntryNumber(Ts... values) const
Get the entry number containing the given index value.
static std::unique_ptr< RNTupleIndex > Create(const std::vector< std::string > &fieldNames, const RPageSource &pageSource, bool deferBuild=false)
Create an RNTupleIndex from an existing RNTuple.
const std::vector< NTupleSize_t > * GetAllEntryNumbers(const std::vector< void * > &valuePtrs) const
Get all entry numbers for the given index.
NTupleSize_t GetFirstEntryNumber(const std::vector< void * > &valuePtrs) const
Get the first entry number containing the given index value.
void EnsureBuilt() const
Ensure the RNTupleIndex has been built.
std::size_t GetSize() const
Get the number of indexed values.
bool IsBuilt() const
Whether the index has been built (and therefore ready to be used).
bool fIsBuilt
Only built indexes can be queried.
RNTupleIndex & operator=(const RNTupleIndex &other)=delete
std::vector< std::unique_ptr< RFieldBase > > fIndexFields
The fields for which the index is built. Used to compute the hashes for each entry value.
std::uint64_t NTupleIndexValue_t
RNTupleIndex(RNTupleIndex &&other)=delete
void Build()
Build the index.
std::unordered_map< RIndexValue, std::vector< NTupleSize_t >, RIndexValueHash > fIndex
The index itself.
Abstract interface to read data from an ntuple.
Base class for all ROOT issued exceptions.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Hash combinining the individual index value hashes from RIndexValue.
std::size_t operator()(const RIndexValue &indexValue) const