39#if __cplusplus >= 201703L
48namespace Experimental {
50class RCollectionField;
51class RCollectionNTuple;
99 std::vector<std::unique_ptr<RColumn>>
fColumns;
149 std::size_t nRepetitions = 0);
157 virtual std::unique_ptr<RFieldBase>
Clone(std::string_view newName)
const = 0;
216 void Attach(std::unique_ptr<Detail::RFieldBase> child);
232 RSchemaIterator
begin();
233 RSchemaIterator
end();
263 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const;
288 RClassField(std::string_view fieldName, std::string_view className);
292 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final;
316 RVectorField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField);
320 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final;
328 size_t GetValueSize()
const override {
return sizeof(std::vector<char>); }
329 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
331 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
353 RArrayField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField, std::size_t arrayLength);
357 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final;
371#if __cplusplus >= 201703L
373class RVariantField :
public Detail::RFieldBase {
375 size_t fMaxItemSize = 0;
376 size_t fMaxAlignment = 1;
378 size_t fTagOffset = 0;
379 std::vector<ClusterSize_t::ValueType> fNWritten;
381 static std::string GetTypeList(
const std::vector<Detail::RFieldBase *> &itemFields);
383 std::uint32_t GetTag(
void *variantPtr)
const;
384 void SetTag(
void *variantPtr, std::uint32_t tag)
const;
387 void AppendImpl(
const Detail::RFieldValue& value)
final;
388 void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value)
final;
392 RVariantField(std::string_view fieldName,
const std::vector<Detail::RFieldBase *> &itemFields);
393 RVariantField(RVariantField &&other) =
default;
394 RVariantField&
operator =(RVariantField &&other) =
default;
395 ~RVariantField() =
default;
396 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final;
398 void GenerateColumnsImpl() final;
400 Detail::
RFieldValue GenerateValue(
void *where) override;
401 void DestroyValue(const Detail::
RFieldValue &value,
bool dtorOnly = false) final;
402 Detail::
RFieldValue CaptureValue(
void *where) final;
403 size_t GetValueSize() const final;
404 size_t GetAlignment() const final {
return fMaxAlignment; }
405 void CommitCluster() final;
411template <
typename T,
typename=
void>
416 static_assert(std::is_class<T>::value,
"no I/O support for this basic C++ type");
422 using Detail::RFieldBase::GenerateValue;
423 template <
typename... ArgsT>
437 static std::string
TypeName() {
return ":RCollectionField:"; }
439 std::shared_ptr<RCollectionNTuple> collectionNTuple,
440 std::unique_ptr<RNTupleModel> collectionModel);
444 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final;
446 void GenerateColumnsImpl() final;
459 void CommitCluster() final;
469 static std::string
TypeName() {
return "ROOT::Experimental::ClusterSize_t"; }
475 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
476 return std::make_unique<RField>(newName);
482 return fPrincipalColumn->Map<
ClusterSize_t, EColumnType::kIndex>(globalIndex);
485 return fPrincipalColumn->Map<
ClusterSize_t, EColumnType::kIndex>(clusterIndex);
488 using Detail::RFieldBase::GenerateValue;
489 template <
typename... ArgsT>
494 this,
static_cast<ClusterSize_t*
>(where), std::forward<ArgsT>(args)...);
505 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
508 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
523 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
524 return std::make_unique<RField>(newName);
527 void GenerateColumnsImpl() final;
530 return fPrincipalColumn->Map<
bool, EColumnType::kBit>(globalIndex);
533 return fPrincipalColumn->Map<
bool, EColumnType::kBit>(clusterIndex);
536 using Detail::RFieldBase::GenerateValue;
537 template <
typename... ArgsT>
542 this,
static_cast<bool*
>(where), std::forward<ArgsT>(args)...);
562 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
563 return std::make_unique<RField>(newName);
566 void GenerateColumnsImpl() final;
569 return fPrincipalColumn->Map<float, EColumnType::kReal32>(globalIndex);
572 return fPrincipalColumn->Map<float, EColumnType::kReal32>(clusterIndex);
575 using Detail::RFieldBase::GenerateValue;
576 template <
typename... ArgsT>
581 this,
static_cast<float*
>(where), std::forward<ArgsT>(args)...);
602 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
603 return std::make_unique<RField>(newName);
606 void GenerateColumnsImpl() final;
609 return fPrincipalColumn->Map<
double, EColumnType::kReal64>(globalIndex);
612 return fPrincipalColumn->Map<
double, EColumnType::kReal64>(clusterIndex);
615 using Detail::RFieldBase::GenerateValue;
616 template <
typename... ArgsT>
621 this,
static_cast<double*
>(where), std::forward<ArgsT>(args)...);
633class RField<std::
uint8_t> :
public Detail::RFieldBase {
635 static std::string TypeName() {
return "std::uint8_t"; }
636 explicit RField(std::string_view
name)
637 : Detail::
RFieldBase(
name, TypeName(), ENTupleStructure::kLeaf, true ) {}
638 RField(RField&& other) =
default;
641 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
642 return std::make_unique<RField>(newName);
645 void GenerateColumnsImpl() final;
647 std::
uint8_t *Map(NTupleSize_t globalIndex) {
648 return fPrincipalColumn->Map<std::uint8_t, EColumnType::kByte>(globalIndex);
650 std::uint8_t *
Map(
const RClusterIndex &clusterIndex) {
651 return fPrincipalColumn->Map<std::uint8_t, EColumnType::kByte>(clusterIndex);
654 using Detail::RFieldBase::GenerateValue;
655 template <
typename... ArgsT>
658 return Detail::RFieldValue(
659 Detail::RColumnElement<std::uint8_t, EColumnType::kByte>(
static_cast<std::uint8_t*
>(where)),
660 this,
static_cast<std::uint8_t*
>(where), std::forward<ArgsT>(args)...);
663 Detail::RFieldValue CaptureValue(
void *where)
final {
664 return Detail::RFieldValue(
true ,
665 Detail::RColumnElement<std::uint8_t, EColumnType::kByte>(
static_cast<std::uint8_t*
>(where)),
this, where);
667 size_t GetValueSize() const final {
return sizeof(std::uint8_t); }
668 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
672class RField<std::int32_t> :
public Detail::RFieldBase {
674 static std::string TypeName() {
return "std::int32_t"; }
675 explicit RField(std::string_view
name)
677 RField(RField&& other) =
default;
680 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
681 return std::make_unique<RField>(newName);
684 void GenerateColumnsImpl() final;
686 std::int32_t *Map(NTupleSize_t globalIndex) {
687 return fPrincipalColumn->Map<std::int32_t, EColumnType::kInt32>(globalIndex);
689 std::int32_t *
Map(
const RClusterIndex &clusterIndex) {
690 return fPrincipalColumn->Map<std::int32_t, EColumnType::kInt32>(clusterIndex);
693 using Detail::RFieldBase::GenerateValue;
694 template <
typename... ArgsT>
697 return Detail::RFieldValue(
698 Detail::RColumnElement<std::int32_t, EColumnType::kInt32>(
static_cast<std::int32_t*
>(where)),
699 this,
static_cast<std::int32_t*
>(where), std::forward<ArgsT>(args)...);
702 Detail::RFieldValue CaptureValue(
void *where)
final {
703 return Detail::RFieldValue(
true ,
704 Detail::RColumnElement<std::int32_t, EColumnType::kInt32>(
static_cast<std::int32_t*
>(where)),
this, where);
706 size_t GetValueSize() const final {
return sizeof(std::int32_t); }
707 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
711class RField<std::uint32_t> :
public Detail::RFieldBase {
713 static std::string TypeName() {
return "std::uint32_t"; }
714 explicit RField(std::string_view
name)
716 RField(RField&& other) =
default;
719 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
720 return std::make_unique<RField>(newName);
723 void GenerateColumnsImpl() final;
725 std::uint32_t *Map(NTupleSize_t globalIndex) {
726 return fPrincipalColumn->Map<std::uint32_t, EColumnType::kInt32>(globalIndex);
728 std::uint32_t *
Map(
const RClusterIndex clusterIndex) {
729 return fPrincipalColumn->Map<std::uint32_t, EColumnType::kInt32>(clusterIndex);
732 using Detail::RFieldBase::GenerateValue;
733 template <
typename... ArgsT>
736 return Detail::RFieldValue(
737 Detail::RColumnElement<std::uint32_t, EColumnType::kInt32>(
static_cast<std::uint32_t*
>(where)),
738 this,
static_cast<std::uint32_t*
>(where), std::forward<ArgsT>(args)...);
741 Detail::RFieldValue CaptureValue(
void *where)
final {
742 return Detail::RFieldValue(
true ,
743 Detail::RColumnElement<std::uint32_t, EColumnType::kInt32>(
static_cast<std::uint32_t*
>(where)),
this, where);
745 size_t GetValueSize() const final {
return sizeof(std::uint32_t); }
746 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
750class RField<std::uint64_t> :
public Detail::RFieldBase {
752 static std::string TypeName() {
return "std::uint64_t"; }
753 explicit RField(std::string_view
name)
755 RField(RField&& other) =
default;
758 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
759 return std::make_unique<RField>(newName);
762 void GenerateColumnsImpl() final;
764 std::uint64_t *Map(NTupleSize_t globalIndex) {
765 return fPrincipalColumn->Map<std::uint64_t, EColumnType::kInt64>(globalIndex);
767 std::uint64_t *
Map(
const RClusterIndex &clusterIndex) {
768 return fPrincipalColumn->Map<std::uint64_t, EColumnType::kInt64>(clusterIndex);
771 using Detail::RFieldBase::GenerateValue;
772 template <
typename... ArgsT>
775 return Detail::RFieldValue(
776 Detail::RColumnElement<std::uint64_t, EColumnType::kInt64>(
static_cast<std::uint64_t*
>(where)),
777 this,
static_cast<std::uint64_t*
>(where), std::forward<ArgsT>(args)...);
780 Detail::RFieldValue CaptureValue(
void *where)
final {
781 return Detail::RFieldValue(
true ,
782 Detail::RColumnElement<std::uint64_t, EColumnType::kInt64>(
static_cast<std::uint64_t*
>(where)),
this, where);
784 size_t GetValueSize() const final {
return sizeof(std::uint64_t); }
785 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
790class RField<std::string> :
public Detail::RFieldBase {
793 Detail::RColumnElement<ClusterSize_t, EColumnType::kIndex> fElemIndex;
800 static std::string TypeName() {
return "std::string"; }
801 explicit RField(std::string_view
name)
803 , fIndex(0), fElemIndex(&fIndex) {}
804 RField(RField&& other) =
default;
807 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
808 return std::make_unique<RField>(newName);
811 void GenerateColumnsImpl() final;
814 template <typename... ArgsT>
815 ROOT::Experimental::Detail::
RFieldValue GenerateValue(
void* where, ArgsT&&... args)
817 return Detail::RFieldValue(
this,
static_cast<std::string*
>(where), std::forward<ArgsT>(args)...);
820 void DestroyValue(
const Detail::RFieldValue& value,
bool dtorOnly =
false) {
821 auto str = value.Get<std::string>();
822 str->~basic_string();
826 Detail::RFieldValue CaptureValue(
void *where) {
827 return Detail::RFieldValue(
true ,
this, where);
829 size_t GetValueSize() const final {
return sizeof(std::string); }
830 size_t GetAlignment() const final {
return std::alignment_of<std::string>(); }
831 void CommitCluster() final;
832 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
836template <typename ItemT, std::
size_t N>
837class RField<std::array<ItemT,
N>> : public RArrayField {
838 using ContainerT =
typename std::array<ItemT, N>;
840 static std::string TypeName() {
841 return "std::array<" + RField<ItemT>::TypeName() +
"," + std::to_string(
N) +
">";
843 explicit RField(std::string_view
name)
844 : RArrayField(
name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()),
N)
846 RField(RField&& other) =
default;
850 using Detail::RFieldBase::GenerateValue;
851 template <
typename... ArgsT>
854 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
857 return GenerateValue(where, ContainerT());
862#if __cplusplus >= 201703L
863template <
typename... ItemTs>
864class RField<std::variant<ItemTs...>> :
public RVariantField {
865 using ContainerT =
typename std::variant<ItemTs...>;
867 template <
typename HeadT,
typename... TailTs>
868 static std::string BuildItemTypes()
870 std::string result = RField<HeadT>::TypeName();
871 if constexpr(
sizeof...(TailTs) > 0)
872 result +=
"," + BuildItemTypes<TailTs...>();
876 template <
typename HeadT,
typename... TailTs>
877 static std::vector<Detail::RFieldBase *> BuildItemFields(
unsigned int index = 0)
879 std::vector<Detail::RFieldBase *> result;
880 result.emplace_back(
new RField<HeadT>(
"variant" + std::to_string(index)));
881 if constexpr(
sizeof...(TailTs) > 0) {
882 auto tailFields = BuildItemFields<TailTs...>(index + 1);
883 result.insert(result.end(), tailFields.begin(), tailFields.end());
889 static std::string TypeName() {
return "std::variant<" + BuildItemTypes<ItemTs...>() +
">"; }
890 explicit RField(std::string_view
name) : RVariantField(
name, BuildItemFields<ItemTs...>()) {}
891 RField(RField&& other) =
default;
895 using Detail::RFieldBase::GenerateValue;
896 template <
typename... ArgsT>
899 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
902 return GenerateValue(where, ContainerT());
907template <
typename ItemT>
908class RField<std::vector<ItemT>> :
public RVectorField {
909 using ContainerT =
typename std::vector<ItemT>;
911 static std::string TypeName() {
return "std::vector<" + RField<ItemT>::TypeName() +
">"; }
912 explicit RField(std::string_view
name)
913 : RVectorField(
name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()))
915 RField(RField&& other) =
default;
919 using Detail::RFieldBase::GenerateValue;
920 template <
typename... ArgsT>
923 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
926 return GenerateValue(where, ContainerT());
928 Detail::RFieldValue CaptureValue(
void *where)
final {
929 return Detail::RFieldValue(
true ,
this, where);
931 size_t GetValueSize() const final {
return sizeof(ContainerT); }
936class RField<std::vector<bool>> :
public Detail::RFieldBase {
941 void AppendImpl(
const Detail::RFieldValue& value)
final;
942 void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value)
final;
943 void GenerateColumnsImpl() final;
946 static std::
string TypeName() {
return "std::vector<bool>"; }
947 explicit RField(std::string_view
name);
948 RField(RField&& other) =
default;
951 std::unique_ptr<Detail::RFieldBase> Clone(std::string_view newName)
const final {
952 return std::make_unique<RField>(newName);
955 using Detail::RFieldBase::GenerateValue;
956 template <
typename... ArgsT>
959 return Detail::RFieldValue(
this,
static_cast<std::vector<bool>*
>(where), std::forward<ArgsT>(args)...);
962 return GenerateValue(where, std::vector<bool>());
964 Detail::RFieldValue CaptureValue(
void *where)
final {
965 return Detail::RFieldValue(
true ,
this, where);
967 std::vector<Detail::RFieldValue> SplitValue(
const Detail::RFieldValue &value)
const final;
968 void DestroyValue(
const Detail::RFieldValue& value,
bool dtorOnly =
false) final;
970 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
971 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
972 void CommitCluster() final { fNWritten = 0; }
973 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
974 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
const {
975 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
977 void GetCollectionInfo(
const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
const {
978 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
987template <
typename ItemT>
997 auto count = typedValue->size();
998 for (
unsigned i = 0; i < count; ++i) {
999 auto itemValue = fSubFields[0]->CaptureValue(&typedValue->data()[i]);
1000 fSubFields[0]->Append(itemValue);
1004 fColumns[0]->Append(elemIndex);
1010 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
1011 typedValue->resize(nItems);
1012 for (
unsigned i = 0; i < nItems; ++i) {
1013 auto itemValue = fSubFields[0]->GenerateValue(&typedValue->data()[i]);
1014 fSubFields[0]->Read(collectionStart + i, &itemValue);
1019 RField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField)
1022 , fItemSize(itemField->GetValueSize()), fNWritten(0)
1024 Attach(std::move(itemField));
1033 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
1034 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetName());
1035 return std::make_unique<RField<ROOT::VecOps::RVec<ItemT>>>(newName, std::move(newItemField));
1040 fColumns.emplace_back(std::unique_ptr<Detail::RColumn>(
1041 Detail::RColumn::Create<ClusterSize_t, EColumnType::kIndex>(modelIndex, 0)));
1042 fPrincipalColumn = fColumns[0].get();
1046 auto nItems = vec->size();
1047 for (
unsigned i = 0; i < nItems; ++i) {
1048 auto itemValue = fSubFields[0]->CaptureValue(vec->data() + (i * fItemSize));
1049 fSubFields[0]->DestroyValue(itemValue,
true );
1059 using Detail::RFieldBase::GenerateValue;
1060 template <
typename... ArgsT>
1072 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
1087 auto count = typedValue->size();
1088 for (
unsigned i = 0; i < count; ++i) {
1089 bool bval = (*typedValue)[i];
1090 auto itemValue = fSubFields[0]->CaptureValue(&bval);
1091 fSubFields[0]->Append(itemValue);
1095 fColumns[0]->Append(elemIndex);
1101 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
1102 typedValue->resize(nItems);
1103 for (
unsigned i = 0; i < nItems; ++i) {
1104 bool bval = (*typedValue)[i];
1105 auto itemValue = fSubFields[0]->GenerateValue(&bval);
1106 fSubFields[0]->Read(collectionStart + i, &itemValue);
1107 (*typedValue)[i] = bval;
1120 std::unique_ptr<Detail::RFieldBase>
Clone(std::string_view newName)
const final {
1121 return std::make_unique<RField<ROOT::VecOps::RVec<bool>>>(newName);
1126 fColumns.emplace_back(std::unique_ptr<Detail::RColumn>(
1127 Detail::RColumn::Create<ClusterSize_t, EColumnType::kIndex>(modelIndex, 0)));
1128 fPrincipalColumn = fColumns[0].get();
1138 static std::string
TypeName() {
return "ROOT::VecOps::RVec<bool>"; }
1140 using Detail::RFieldBase::GenerateValue;
1141 template <
typename... ArgsT>
1153 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
Binding & operator=(OUT(*fun)(void))
Pairs of C++ type and column type, like float and EColumnType::kReal32.
void Append(const RColumnElementBase &element)
void Read(const NTupleSize_t globalIndex, RColumnElementBase *element)
NTupleSize_t GetGlobalIndex(const RClusterIndex &clusterIndex)
NTupleSize_t GetNElements() const
void GetCollectionInfo(const NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
Iterates over the sub tree of fields in depth-first search order.
void Advance()
Given that the iterator points to a valid field which is not the end iterator, go to the next field i...
std::vector< Position > fStack
The stack of nodes visited when walking down the tree of fields.
std::ptrdiff_t difference_type
pointer operator->() const
bool operator!=(const iterator &rh) const
reference operator*() const
std::forward_iterator_tag iterator_category
RSchemaIterator(pointer val, int idxInParent)
bool operator==(const iterator &rh) const
void Append(const RFieldValue &value)
Write the given value into columns. The value object has to be of the same type as the field.
virtual RFieldValue CaptureValue(void *where)=0
Creates a value from a memory location with an already constructed object.
virtual void GenerateColumnsImpl()=0
Creates the backing columns corresponsing to the field type and name.
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
RFieldBase * fParent
Sub fields point to their mother field.
std::string GetName() const
std::size_t GetNRepetitions() const
virtual void DestroyValue(const RFieldValue &value, bool dtorOnly=false)
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
virtual RNTupleVersion GetTypeVersion() const
Indicates an evolution of the C++ type itself.
void Flush() const
Ensure that all received items are written from page buffers to the storage.
virtual void ReadInClusterImpl(const RClusterIndex &clusterIndex, RFieldValue *value)
virtual void CommitCluster()
Perform housekeeping tasks for global to cluster-local index translation.
virtual size_t GetAlignment() const
For many types, the alignment requirement is equal to the size; otherwise override.
virtual size_t GetValueSize() const =0
The number of bytes taken by a value of the appropriate type.
virtual std::vector< RFieldValue > SplitValue(const RFieldValue &value) const
Creates the list of direct child values given a value for this field.
std::string GetType() const
static RResult< void > EnsureValidFieldName(std::string_view fieldName)
Check whether a given string is a valid field name.
RFieldBase(RFieldBase &&)=default
bool fIsSimple
A field on a trivial type that maps as-is to a single column.
std::string fType
The C++ type captured by this field.
virtual void AppendImpl(const RFieldValue &value)
Operations on values of complex types, e.g.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &typeName)
Factory method to resurrect a field from the stored on-disk type information.
std::string fName
The field name relative to its parent field.
virtual RNTupleVersion GetFieldVersion() const
Indicates an evolution of the mapping scheme from C++ type to columns.
NTupleSize_t GetNElements() const
std::size_t fNRepetitions
For fixed sized arrays, the array length.
RFieldBase(const RFieldBase &)=delete
virtual void AcceptVisitor(RFieldVisitor &visitor) const
std::vector< const RFieldBase * > GetSubFields() const
virtual void ReadGlobalImpl(NTupleSize_t globalIndex, RFieldValue *value)
ENTupleStructure fStructure
The role of this field in the data model structure.
void Read(const RClusterIndex &clusterIndex, RFieldValue *value)
std::vector< std::unique_ptr< RColumn > > fColumns
The columns are connected either to a sink or to a source (not to both); they are owned by the field.
void Attach(std::unique_ptr< Detail::RFieldBase > child)
Add a new subfield to the list of nested fields.
virtual RFieldValue GenerateValue(void *where)=0
Generates a tree value in a given location of size at least GetValueSize().
RFieldBase & operator=(const RFieldBase &)=delete
ENTupleStructure GetStructure() const
void Read(NTupleSize_t globalIndex, RFieldValue *value)
Populate a single value with data from the tree, which needs to be of the fitting type.
const RFieldBase * GetParent() const
virtual std::unique_ptr< RFieldBase > Clone(std::string_view newName) const =0
RFieldValue GenerateValue()
Generates an object of the field type and allocates new initialized memory according to the type.
RColumn * fPrincipalColumn
Points into fColumns.
static void ConnectRecursively(DescriptorId_t fieldId, RPageSource &pageSource, RFieldBase &field)
Connect the field columns and all sub field columns.
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
RColumnElementBase fMappedElement
For simple types, the mapped element drills through the layers from the C++ data representation to th...
Abstract base class for classes implementing the visitor design pattern.
Abstract interface to read data from an ntuple.
Common functionality of an ntuple storage for both reading and writing.
The generic field for fixed size arrays, which do not need an offset column.
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
RArrayField & operator=(RArrayField &&other)=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RArrayField(RArrayField &&other)=default
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
The field for a class with dictionary.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
RClassField & operator=(RClassField &&other)=default
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
std::size_t fMaxAlignment
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
RClassField(RClassField &&other)=default
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
static std::string TypeName()
std::shared_ptr< RCollectionNTuple > fCollectionNTuple
Save the link to the collection ntuple in order to reset the offset counter when committing the clust...
~RCollectionField()=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RCollectionField(RCollectionField &&other)=default
Holds the static meta-data of a column in a tree.
A field translates read and write calls from/to underlying columns to/from tree values.
A friend of RFieldBase responsible for connecting a field's columns to the physical page storage.
Represents transient storage of simple or complex C++ values.
The container field for an ntuple model, which itself has no physical representation.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Detail::RFieldValue GenerateValue(void *)
Generates a tree value in a given location of size at least GetValueSize().
std::unique_ptr< REntry > GenerateEntry() const
Generates managed values for the top-level sub fields.
Detail::RFieldValue CaptureValue(void *) final
Creates a value from a memory location with an already constructed object.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
static std::string TypeName()
RField(std::string_view name)
ClusterSize_t * Map(const RClusterIndex &clusterIndex)
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
RField(RField &&other)=default
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
RField(std::string_view name)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
typename ROOT::VecOps::RVec< ItemT > ContainerT
static std::string TypeName()
RField(RField &&other)=default
RField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
RField(std::string_view name)
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
RField(RField &&other)=default
typename ROOT::VecOps::RVec< bool > ContainerT
static std::string TypeName()
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
RField(std::string_view name)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
static std::string TypeName()
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
RField(RField &&other)=default
bool * Map(const RClusterIndex &clusterIndex)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
double * Map(const RClusterIndex &clusterIndex)
RField(std::string_view name)
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
RField(RField &&other)=default
static std::string TypeName()
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
static std::string TypeName()
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
RField(RField &&other)=default
RField(std::string_view name)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
float * Map(const RClusterIndex &clusterIndex)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Classes with dictionaries that can be inspected by TClass.
RField(std::string_view name)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
RField(RField &&other)=default
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
static std::string TypeName()
For forward and backward compatibility, attach version information to the consitituents of the file f...
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
The generic field for a (nested) std::vector<Type> except for std::vector<bool>
Detail::RFieldValue CaptureValue(void *where) override
Creates a value from a memory location with an already constructed object.
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
RVectorField & operator=(RVectorField &&other)=default
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
RVectorField(RVectorField &&other)=default
A "std::vector"-like collection of values implementing handy operation to analyse them.
TClass instances represent classes, structs and namespaces in the ROOT type system.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
RClusterSize ClusterSize_t
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::string GetDemangledTypeName(const std::type_info &)
Returns a string with the demangled and normalized name for the given type.
auto Map(Args &&... args) -> decltype(ROOT::Detail::VecOps::MapFromTuple(std::forward_as_tuple(args...), std::make_index_sequence< sizeof...(args) - 1 >()))
Create new collection applying a callable to the elements of the input collection.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Position(RFieldBase *fieldPtr, int idxInParent)
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...