16#ifndef ROOT7_RNTupleModel
17#define ROOT7_RNTupleModel
27#include <unordered_set>
31namespace Experimental {
33class RCollectionNTupleWriter;
76 std::unique_ptr<RNTupleModel>
Clone()
const;
77 static std::unique_ptr<RNTupleModel>
Create();
136 template <
typename T,
typename... ArgsT>
142 auto field = std::make_unique<RField<T>>(fieldNameDesc.
fName);
144 std::shared_ptr<T> ptr;
146 ptr =
fDefaultEntry->AddValue<T>(field.get(), std::forward<ArgsT>(args)...);
154 void AddField(std::unique_ptr<Detail::RFieldBase> field);
157 template <
typename T>
165 auto field = std::make_unique<RField<T>>(fieldNameDesc.
fName);
171 template <
typename T>
172 T *
Get(std::string_view fieldName)
const
186 std::string_view fieldName,
187 std::unique_ptr<RNTupleModel> collectionModel);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Base class for all ROOT issued exceptions.
The container field for an ntuple model, which itself has no physical representation.
The RNTupleModel encapulates the schema of an ntuple.
std::unordered_set< std::string > fFieldNames
Keeps track of which field names are taken.
void AddField(const NameWithDescription_t &fieldNameDesc, T *fromWhere)
Throws an exception if fromWhere is null.
std::string fDescription
Free text set by the user.
void EnsureValidFieldName(std::string_view fieldName)
Checks that user-provided field names are valid in the context of this NTuple model.
std::uint64_t fModelId
Upon freezing, every model has a unique ID to distingusish it from other models.
std::uint64_t GetModelId() const
RNTupleModel(const RNTupleModel &)=delete
std::string GetDescription() const
std::shared_ptr< T > MakeField(const NameWithDescription_t &fieldNameDesc, ArgsT &&... args)
Creates a new field given a name or {name, description} pair and a corresponding tree value that is m...
void EnsureNotBare() const
Throws an RException if fDefaultEntry is nullptr.
std::unique_ptr< RNTupleModel > Clone() const
void EnsureNotFrozen() const
Throws an RException if fFrozen is true.
REntry * GetDefaultEntry() const
std::unique_ptr< REntry > CreateBareEntry() const
In a bare entry, all values point to nullptr.
std::unique_ptr< REntry > CreateEntry() const
static std::unique_ptr< RNTupleModel > Create()
static std::unique_ptr< RNTupleModel > CreateBare()
A bare model has no default entry.
void SetDescription(std::string_view description)
std::unique_ptr< REntry > fDefaultEntry
Contains field values corresponding to the created top-level fields.
std::shared_ptr< RCollectionNTupleWriter > MakeCollection(std::string_view fieldName, std::unique_ptr< RNTupleModel > collectionModel)
Ingests a model for a sub collection and attaches it to the current model.
const Detail::RFieldBase * GetField(std::string_view fieldName) const
RFieldZero * GetFieldZero() const
T * Get(std::string_view fieldName) const
RNTupleModel & operator=(const RNTupleModel &)=delete
void AddField(std::unique_ptr< Detail::RFieldBase > field)
Adds a field whose type is not known at compile time.
std::unique_ptr< RFieldZero > fFieldZero
Hierarchy of fields consisting of simple types and collections (sub trees)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
NameWithDescription_t(std::string_view name)
NameWithDescription_t(std::string_view name, std::string_view descr)
NameWithDescription_t(const char *name)
std::string_view fDescription