|
ROOT
Reference Guide |
|
Go to the documentation of this file.
37 #include <type_traits>
39 #if __cplusplus >= 201703L
48 namespace Experimental {
50 class RCollectionField;
51 class RCollectionNTuple;
99 std::vector<std::unique_ptr<RColumn>>
fColumns;
149 std::size_t nRepetitions = 0);
216 void Attach(std::unique_ptr<Detail::RFieldBase> child);
232 RSchemaIterator
begin();
233 RSchemaIterator
end();
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;
371 #if __cplusplus >= 201703L
373 class 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;
411 template <
typename T,
typename=
void>
416 static_assert(std::is_class<T>::value,
"no I/O support for this basic C++ type");
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"; }
476 return std::make_unique<RField>(newName);
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);
524 return std::make_unique<RField>(newName);
527 void GenerateColumnsImpl() final;
537 template <
typename... ArgsT>
542 this,
static_cast<bool*
>(where), std::forward<ArgsT>(args)...);
563 return std::make_unique<RField>(newName);
566 void GenerateColumnsImpl() final;
576 template <
typename... ArgsT>
581 this,
static_cast<float*
>(where), std::forward<ArgsT>(args)...);
603 return std::make_unique<RField>(newName);
606 void GenerateColumnsImpl() final;
616 template <
typename... ArgsT>
621 this,
static_cast<double*
>(where), std::forward<ArgsT>(args)...);
633 class RField<std::
uint8_t> :
public Detail::RFieldBase {
635 static std::string TypeName() {
return "std::uint8_t"; }
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;
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;
672 class RField<std::int32_t> :
public Detail::RFieldBase {
674 static std::string TypeName() {
return "std::int32_t"; }
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;
689 std::int32_t *
Map(
const RClusterIndex &clusterIndex) {
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;
711 class RField<std::uint32_t> :
public Detail::RFieldBase {
713 static std::string TypeName() {
return "std::uint32_t"; }
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;
728 std::uint32_t *
Map(
const RClusterIndex clusterIndex) {
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;
750 class RField<std::uint64_t> :
public Detail::RFieldBase {
752 static std::string TypeName() {
return "std::uint64_t"; }
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;
767 std::uint64_t *
Map(
const RClusterIndex &clusterIndex) {
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;
790 class RField<std::string> :
public Detail::RFieldBase {
793 Detail::RColumnElement<ClusterSize_t, EColumnType::kIndex> fElemIndex;
800 static std::string TypeName() {
return "std::string"; }
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;
836 template <typename ItemT, std::
size_t N>
837 class RField<std::array<ItemT,
N>> : public RArrayField {
838 using ContainerT =
typename std::array<ItemT, N>;
840 static std::string TypeName() {
844 : RArrayField(
name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()),
N)
846 RField(RField&& other) =
default;
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
863 template <
typename... ItemTs>
864 class RField<std::variant<ItemTs...>> :
public RVariantField {
865 using ContainerT =
typename std::variant<ItemTs...>;
867 template <
typename HeadT,
typename... TailTs>
868 static std::string BuildItemTypes()
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...>() +
">"; }
891 RField(RField&& other) =
default;
896 template <
typename... ArgsT>
899 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
902 return GenerateValue(where, ContainerT());
907 template <
typename ItemT>
908 class RField<std::vector<ItemT>> :
public RVectorField {
909 using ContainerT =
typename std::vector<ItemT>;
913 : RVectorField(
name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()))
915 RField(RField&& other) =
default;
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); }
936 class 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>"; }
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);
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;
975 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
977 void GetCollectionInfo(
const RClusterIndex &clusterIndex, RClusterIndex *collectionStart,
ClusterSize_t *size)
const {
978 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
987 template <
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);
1022 , fItemSize(itemField->GetValueSize()), fNWritten(0)
1024 Attach(std::move(itemField));
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 );
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;
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>"; }
1141 template <
typename... ArgsT>
1153 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
The generic field for fixed size arrays, which do not need an offset column.
RField(std::string_view name)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
RField(std::string_view name)
ENTupleStructure fStructure
The role of this field in the data model structure.
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Abstract base class for classes implementing the visitor design pattern.
RField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
virtual void AppendImpl(const RFieldValue &value)
Operations on values of complex types, e.g.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
void Attach(std::unique_ptr< Detail::RFieldBase > child)
Add a new subfield to the list of nested fields.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
static std::string TypeName()
RField(RField &&other)=default
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
static void ConnectRecursively(DescriptorId_t fieldId, RPageSource &pageSource, RFieldBase &field)
Connect the field columns and all sub field columns.
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.
void Advance()
Given that the iterator points to a valid field which is not the end iterator, go to the next field i...
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
RClassField & operator=(RClassField &&other)=default
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
bool fIsSimple
A field on a trivial type that maps as-is to a single column.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
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().
virtual void AcceptVisitor(RFieldVisitor &visitor) const
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
std::vector< Position > fStack
The stack of nodes visited when walking down the tree of fields.
~RCollectionField()=default
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.
NTupleSize_t GetNElements() const
RSchemaIterator(pointer val, int idxInParent)
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
virtual void GenerateColumnsImpl()=0
Creates the backing columns corresponsing to the field type and name.
Common functionality of an ntuple storage for both reading and writing.
virtual RFieldValue GenerateValue(void *where)=0
Generates a tree value in a given location of size at least GetValueSize().
std::size_t fNRepetitions
For fixed sized arrays, the array length.
Detail::RFieldValue CaptureValue(void *where) override
Creates a value from a memory location with an already constructed object.
basic_string_view< char > string_view
Detail::RFieldValue GenerateValue(void *)
Generates a tree value in a given location of size at least GetValueSize().
RArrayField(RArrayField &&other)=default
RColumnElementBase fMappedElement
For simple types, the mapped element drills through the layers from the C++ data representation to th...
Binding & operator=(OUT(*fun)(void))
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.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
NTupleSize_t GetNElements() const
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
virtual size_t GetValueSize() const =0
The number of bytes taken by a value of the appropriate type.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
typename ROOT::VecOps::RVec< ItemT > ContainerT
std::vector< const RFieldBase * > GetSubFields() const
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Abstract interface to read data from an ntuple.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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.
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
static std::string TypeName()
RFieldBase(const RFieldBase &)=delete
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
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::string GetType() const
std::string GetName() const
std::ptrdiff_t difference_type
A friend of RFieldBase responsible for connecting a field's columns to the physical page storage.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
std::string GetDemangledTypeName(const std::type_info &)
Returns a string with the demangled and normalized name for the given type.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
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
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
RFieldValue GenerateValue()
Generates an object of the field type and allocates new initialized memory according to the type.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RFieldBase(std::string_view name, std::string_view type, ENTupleStructure structure, bool isSimple, std::size_t nRepetitions=0)
The constructor creates the underlying column objects and connects them to either a sink or a source.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
void Append(const RColumnElementBase &element)
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.
RFieldBase & operator=(const RFieldBase &)=delete
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RFieldBase * fParent
Sub fields point to their mother field.
std::size_t GetNRepetitions() const
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
RVectorField & operator=(RVectorField &&other)=default
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
RVectorField(RVectorField &&other)=default
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
RFieldBase(RFieldBase &&)=default
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
static RResult< void > EnsureValidFieldName(std::string_view fieldName)
Check whether a given string is a valid field name.
A field translates read and write calls from/to underlying columns to/from tree values.
Iterates over the sub tree of fields in depth-first search order.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
RCollectionField(RCollectionField &&other)=default
For forward and backward compatibility, attach version information to the consitituents of the file f...
void Flush() const
Ensure that all received items are written from page buffers to the storage.
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
NTupleSize_t GetGlobalIndex(const RClusterIndex &clusterIndex)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
virtual RNTupleVersion GetTypeVersion() const
Indicates an evolution of the C++ type itself.
RResult<void> has no data member and no Inspect() method but instead a Success() factory method.
static std::string TypeName()
typename ROOT::VecOps::RVec< bool > ContainerT
static std::string TypeName()
static std::string TypeName()
std::size_t fMaxAlignment
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
std::string fType
The C++ type captured by this field.
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
float * Map(const RClusterIndex &clusterIndex)
static std::string TypeName()
virtual void ReadGlobalImpl(NTupleSize_t globalIndex, RFieldValue *value)
std::forward_iterator_tag iterator_category
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
virtual void CommitCluster()
Perform housekeeping tasks for global to cluster-local index translation.
Detail::RFieldValue CaptureValue(void *) final
Creates a value from a memory location with an already constructed object.
RArrayField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField, std::size_t arrayLength)
RField(RField &&other)=default
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
Holds the static meta-data of a column in a tree.
const RFieldBase * GetParent() const
std::unique_ptr< REntry > GenerateEntry() const
Generates managed values for the top-level sub fields.
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
Represents transient storage of simple or complex C++ values.
virtual std::unique_ptr< RFieldBase > Clone(std::string_view newName) const =0
RVectorField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
static std::string TypeName()
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const
RField(std::string_view name)
RField(RField &&other)=default
RArrayField & operator=(RArrayField &&other)=default
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
virtual RFieldValue CaptureValue(void *where)=0
Creates a value from a memory location with an already constructed object.
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...
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.
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
bool operator==(const iterator &rh) const
RField(std::string_view name)
bool operator!=(const iterator &rh) const
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.
RField(RField &&other)=default
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
RColumn * fPrincipalColumn
Points into fColumns.
The container field for an ntuple model, which itself has no physical representation.
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
ClusterSize_t * Map(const RClusterIndex &clusterIndex)
pointer operator->() const
std::shared_ptr< RCollectionNTuple > fCollectionNTuple
Save the link to the collection ntuple in order to reset the offset counter when committing the clust...
TClass instances represent classes, structs and namespaces in the ROOT type system.
The generic field for a (nested) std::vector<Type> except for std::vector<bool>
ENTupleStructure GetStructure() const
RClusterSize ClusterSize_t
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
RField(RField &&other)=default
void Read(const NTupleSize_t globalIndex, RColumnElementBase *element)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
RField(std::string_view name)
RClassField(std::string_view fieldName, std::string_view className)
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
virtual size_t GetAlignment() const
For many types, the alignment requirement is equal to the size; otherwise override.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
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 std::vector< RFieldValue > SplitValue(const RFieldValue &value) const
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
RField(RField &&other)=default
RClassField(RClassField &&other)=default
void Read(const RClusterIndex &clusterIndex, RFieldValue *value)
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)
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
std::unique_ptr< Detail::RFieldBase > Clone(std::string_view newName) const final
virtual void DestroyValue(const RFieldValue &value, bool dtorOnly=false)
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
static std::string TypeName()
void Read(NTupleSize_t globalIndex, RFieldValue *value)
Populate a single value with data from the tree, which needs to be of the fitting type.
RField(std::string_view name)
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::string fName
The field name relative to its parent field.
RField(RField &&other)=default
Position(RFieldBase *fieldPtr, int idxInParent)
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Type GetType(const std::string &Name)
reference operator*() const
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.
The field for a class with dictionary.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
A "std::vector"-like collection of values implementing handy operation to analyse them.
bool * Map(const RClusterIndex &clusterIndex)
virtual RNTupleVersion GetFieldVersion() const
Indicates an evolution of the mapping scheme from C++ type to columns.
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
Classes with dictionaries that can be inspected by TClass.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
double * Map(const RClusterIndex &clusterIndex)
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
virtual void ReadInClusterImpl(const RClusterIndex &clusterIndex, RFieldValue *value)