16#ifndef ROOT7_RNTupleModel
17#define ROOT7_RNTupleModel
26#include <unordered_set>
30namespace Experimental {
32class RCollectionNTupleWriter;
66 std::unique_ptr<RNTupleModel>
Clone()
const;
67 static std::unique_ptr<RNTupleModel>
Create() {
return std::make_unique<RNTupleModel>(); }
102 template <
typename T,
typename... ArgsT>
103 std::shared_ptr<T>
MakeField(std::string_view fieldName, ArgsT&&... args) {
104 return MakeField<T>({fieldName,
""}, std::forward<ArgsT>(args)...);
120 template <
typename T,
typename... ArgsT>
121 std::shared_ptr<T>
MakeField(std::pair<std::string_view, std::string_view> fieldNameDesc,
125 auto field = std::make_unique<RField<T>>(fieldNameDesc.first);
126 field->SetDescription(fieldNameDesc.second);
127 auto ptr =
fDefaultEntry->AddValue<T>(field.get(), std::forward<ArgsT>(args)...);
135 void AddField(std::unique_ptr<Detail::RFieldBase> field);
138 template <
typename T>
139 void AddField(std::string_view fieldName, T* fromWhere) {
140 AddField<T>({fieldName,
""}, fromWhere);
144 template <
typename T>
145 void AddField(std::pair<std::string_view, std::string_view> fieldNameDesc, T* fromWhere) {
150 auto field = std::make_unique<RField<T>>(fieldNameDesc.first);
151 field->SetDescription(fieldNameDesc.second);
156 template <
typename T>
157 T*
Get(std::string_view fieldName) {
165 std::string_view fieldName,
166 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.
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.
T * Get(std::string_view fieldName)
RNTupleModel(const RNTupleModel &)=delete
std::string GetDescription() const
std::unique_ptr< RNTupleModel > Clone() const
REntry * GetDefaultEntry()
void AddField(std::string_view fieldName, T *fromWhere)
Throws an exception if fromWhere is null.
std::unique_ptr< REntry > CreateEntry()
void SetDescription(std::string_view description)
std::unique_ptr< REntry > fDefaultEntry
Contains field values corresponding to the created top-level fields.
RNTupleUuid GetUuid() const
std::shared_ptr< T > MakeField(std::string_view fieldName, ArgsT &&... args)
Creates a new field and a corresponding tree value that is managed by a shared pointer.
std::shared_ptr< T > MakeField(std::pair< std::string_view, std::string_view > fieldNameDesc, ArgsT &&... args)
Creates a new field given a {name, description} pair and a corresponding tree value that is managed b...
RNTupleVersion GetVersion() const
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.
Detail::RFieldBase * GetField(std::string_view fieldName)
RFieldZero * GetFieldZero() const
static std::unique_ptr< RNTupleModel > Create()
void AddField(std::pair< std::string_view, std::string_view > fieldNameDesc, T *fromWhere)
Throws an exception if fromWhere is null.
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)
For forward and backward compatibility, attach version information to the consitituents of the file f...
std::string RNTupleUuid
Every NTuple is identified by a UUID. TODO(jblomer): should this be a TUUID?
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...