The RNTupleModel encapulates the schema of an ntuple.
The ntuple model comprises a collection of hierarchically organized fields. From a model, "entries" can be extracted. For convenience, the model provides a default entry. Models have a unique model identifier that faciliates checking whether entries are compatible with it (i.e.: have been extracted from that model).
Definition at line 45 of file RNTupleModel.hxx.
Public Member Functions | |
RNTupleModel () | |
RNTupleModel (const RNTupleModel &)=delete | |
~RNTupleModel ()=default | |
template<typename T > | |
void | AddField (std::pair< std::string_view, std::string_view > fieldNameDesc, T *fromWhere) |
Throws an exception if fromWhere is null. | |
template<typename T > | |
void | AddField (std::string_view fieldName, T *fromWhere) |
Throws an exception if fromWhere is null. | |
void | AddField (std::unique_ptr< Detail::RFieldBase > field) |
Adds a field whose type is not known at compile time. | |
std::unique_ptr< RNTupleModel > | Clone () const |
std::unique_ptr< REntry > | CreateEntry () |
template<typename T > | |
T * | Get (std::string_view fieldName) |
REntry * | GetDefaultEntry () |
std::string | GetDescription () const |
Detail::RFieldBase * | GetField (std::string_view fieldName) |
RFieldZero * | GetFieldZero () const |
RNTupleUuid | GetUuid () const |
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. | |
template<typename T , typename... ArgsT> | |
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 by a shared pointer. | |
template<typename T , typename... ArgsT> | |
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. | |
RNTupleModel & | operator= (const RNTupleModel &)=delete |
void | SetDescription (std::string_view description) |
Static Public Member Functions | |
static std::unique_ptr< RNTupleModel > | Create () |
Private Member Functions | |
void | EnsureValidFieldName (std::string_view fieldName) |
Checks that user-provided field names are valid in the context of this NTuple model. | |
Private Attributes | |
std::unique_ptr< REntry > | fDefaultEntry |
Contains field values corresponding to the created top-level fields. | |
std::string | fDescription |
Free text set by the user. | |
std::unordered_set< std::string > | fFieldNames |
Keeps track of which field names are taken. | |
std::unique_ptr< RFieldZero > | fFieldZero |
Hierarchy of fields consisting of simple types and collections (sub trees) | |
#include <ROOT/RNTupleModel.hxx>
ROOT::Experimental::RNTupleModel::RNTupleModel | ( | ) |
Definition at line 39 of file RNTupleModel.cxx.
|
delete |
|
default |
|
inline |
Throws an exception if fromWhere is null.
Definition at line 145 of file RNTupleModel.hxx.
|
inline |
Throws an exception if fromWhere is null.
Definition at line 139 of file RNTupleModel.hxx.
void ROOT::Experimental::RNTupleModel::AddField | ( | std::unique_ptr< Detail::RFieldBase > | field | ) |
Adds a field whose type is not known at compile time.
Thus there is no shared pointer returned.
Throws an exception if the field is null.
Definition at line 56 of file RNTupleModel.cxx.
std::unique_ptr< ROOT::Experimental::RNTupleModel > ROOT::Experimental::RNTupleModel::Clone | ( | ) | const |
Definition at line 44 of file RNTupleModel.cxx.
|
inlinestatic |
Definition at line 67 of file RNTupleModel.hxx.
std::unique_ptr< ROOT::Experimental::REntry > ROOT::Experimental::RNTupleModel::CreateEntry | ( | ) |
Definition at line 102 of file RNTupleModel.cxx.
|
private |
Checks that user-provided field names are valid in the context of this NTuple model.
Throws an RException for invalid names.
Definition at line 27 of file RNTupleModel.cxx.
|
inline |
Definition at line 157 of file RNTupleModel.hxx.
|
inline |
Definition at line 170 of file RNTupleModel.hxx.
|
inline |
Definition at line 173 of file RNTupleModel.hxx.
ROOT::Experimental::Detail::RFieldBase * ROOT::Experimental::RNTupleModel::GetField | ( | std::string_view | fieldName | ) |
Definition at line 81 of file RNTupleModel.cxx.
|
inline |
Definition at line 168 of file RNTupleModel.hxx.
|
inline |
Definition at line 175 of file RNTupleModel.hxx.
|
inline |
Definition at line 172 of file RNTupleModel.hxx.
std::shared_ptr< ROOT::Experimental::RCollectionNTupleWriter > ROOT::Experimental::RNTupleModel::MakeCollection | ( | std::string_view | fieldName, |
std::unique_ptr< RNTupleModel > | collectionModel | ||
) |
Ingests a model for a sub collection and attaches it to the current model.
Throws an exception if collectionModel is null.
Definition at line 67 of file RNTupleModel.cxx.
|
inline |
Creates a new field given a {name, description}
pair and a corresponding tree value that is managed by a shared pointer.
Example: create a field with a description
Definition at line 121 of file RNTupleModel.hxx.
|
inline |
Creates a new field and a corresponding tree value that is managed by a shared pointer.
Example: create some fields and fill an RNTuple
Example: create a field with an initial value
Definition at line 103 of file RNTupleModel.hxx.
|
delete |
|
inline |
Definition at line 174 of file RNTupleModel.hxx.
|
private |
Contains field values corresponding to the created top-level fields.
Definition at line 49 of file RNTupleModel.hxx.
|
private |
Free text set by the user.
Definition at line 58 of file RNTupleModel.hxx.
|
private |
Keeps track of which field names are taken.
Definition at line 51 of file RNTupleModel.hxx.
|
private |
Hierarchy of fields consisting of simple types and collections (sub trees)
Definition at line 47 of file RNTupleModel.hxx.