47namespace Experimental {
49class RCollectionField;
50class RCollectionNTupleWriter;
164 std::size_t nRepetitions = 0);
205 return value.fMappedElement.GetSize();
232 void Attach(std::unique_ptr<Detail::RFieldBase>
child);
259 RSchemaIterator
begin();
260 RSchemaIterator
end();
342 std::size_t
GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment)
const;
352 template <std::
size_t N>
357 for (
unsigned i = 0; i <
N; ++i) {
361 Attach(std::move(itemFields[i]));
409 size_t GetValueSize()
const override {
return sizeof(std::vector<char>); }
410 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
412 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
455 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
506 static std::string
GetTypeList(
const std::vector<Detail::RFieldBase *> &itemFields);
508 std::uint32_t
GetTag(
void *variantPtr)
const;
509 void SetTag(
void *variantPtr, std::uint32_t tag)
const;
536template <typename
T, typename=
void>
548 template <
typename... ArgsT>
567 std::shared_ptr<RCollectionNTupleWriter> collectionNTuple,
568 std::unique_ptr<RNTupleModel> collectionModel);
594 static std::string
GetTypeList(
const std::array<std::unique_ptr<Detail::RFieldBase>, 2> &itemFields);
600 const std::array<std::size_t, 2> &offsets);
617 static std::string
GetTypeList(
const std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields);
623 const std::vector<std::size_t> &offsets);
643 return std::make_unique<RField>(newName);
647 static std::string
TypeName() {
return "ROOT::Experimental::ClusterSize_t"; }
671 template <
typename... ArgsT>
676 this,
static_cast<ClusterSize_t*
>(where), std::forward<ArgsT>(args)...);
700 return std::make_unique<RField>(newName);
728 template <
typename... ArgsT>
733 this,
static_cast<bool*
>(where), std::forward<ArgsT>(args)...);
748 return std::make_unique<RField>(newName);
776 template <
typename... ArgsT>
781 this,
static_cast<float*
>(where), std::forward<ArgsT>(args)...);
797 return std::make_unique<RField>(newName);
825 template <
typename... ArgsT>
830 this,
static_cast<double*
>(where), std::forward<ArgsT>(args)...);
845 return std::make_unique<RField>(newName);
873 template <
typename... ArgsT>
878 this,
static_cast<char*
>(where), std::forward<ArgsT>(args)...);
890class RField<std::int8_t> :
public Detail::RFieldBase {
893 return std::make_unique<RField>(newName);
897 static std::string TypeName() {
return "std::int8_t"; }
910 std::int8_t *
Map(
const RClusterIndex &clusterIndex) {
916 std::int8_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
921 template <
typename... ArgsT>
924 return Detail::RFieldValue(
925 Detail::RColumnElement<std::int8_t>(
static_cast<std::int8_t*
>(where)),
926 this,
static_cast<std::int8_t*
>(where), std::forward<ArgsT>(args)...);
930 return Detail::RFieldValue(
true ,
931 Detail::RColumnElement<std::int8_t>(
static_cast<std::int8_t*
>(where)),
this, where);
933 size_t GetValueSize() const final {
return sizeof(std::int8_t); }
934 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
938class RField<std::uint8_t> :
public Detail::RFieldBase {
941 return std::make_unique<RField>(newName);
945 static std::string TypeName() {
return "std::uint8_t"; }
958 std::uint8_t *
Map(
const RClusterIndex &clusterIndex) {
964 std::uint8_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
969 template <
typename... ArgsT>
972 return Detail::RFieldValue(
973 Detail::RColumnElement<std::uint8_t>(
static_cast<std::uint8_t*
>(where)),
974 this,
static_cast<std::uint8_t*
>(where), std::forward<ArgsT>(args)...);
978 return Detail::RFieldValue(
true ,
979 Detail::RColumnElement<std::uint8_t>(
static_cast<std::uint8_t*
>(where)),
this, where);
981 size_t GetValueSize() const final {
return sizeof(std::uint8_t); }
982 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
986class RField<std::int16_t> :
public Detail::RFieldBase {
989 return std::make_unique<RField>(newName);
993 static std::string TypeName() {
return "std::int16_t"; }
1006 std::int16_t *
Map(
const RClusterIndex &clusterIndex) {
1012 std::int16_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1017 template <
typename... ArgsT>
1020 return Detail::RFieldValue(
1021 Detail::RColumnElement<std::int16_t>(
static_cast<std::int16_t*
>(where)),
1022 this,
static_cast<std::int16_t*
>(where), std::forward<ArgsT>(args)...);
1026 return Detail::RFieldValue(
true ,
1027 Detail::RColumnElement<std::int16_t>(
static_cast<std::int16_t*
>(where)),
this, where);
1029 size_t GetValueSize() const final {
return sizeof(std::int16_t); }
1030 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1034class RField<std::uint16_t> :
public Detail::RFieldBase {
1037 return std::make_unique<RField>(newName);
1041 static std::string TypeName() {
return "std::uint16_t"; }
1054 std::uint16_t *
Map(
const RClusterIndex &clusterIndex) {
1060 std::uint16_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1065 template <
typename... ArgsT>
1068 return Detail::RFieldValue(
1069 Detail::RColumnElement<std::uint16_t>(
static_cast<std::uint16_t*
>(where)),
1070 this,
static_cast<std::uint16_t*
>(where), std::forward<ArgsT>(args)...);
1074 return Detail::RFieldValue(
true ,
1075 Detail::RColumnElement<std::uint16_t>(
static_cast<std::uint16_t*
>(where)),
this, where);
1077 size_t GetValueSize() const final {
return sizeof(std::uint16_t); }
1078 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1082class RField<std::int32_t> :
public Detail::RFieldBase {
1085 return std::make_unique<RField>(newName);
1089 static std::string TypeName() {
return "std::int32_t"; }
1102 std::int32_t *
Map(
const RClusterIndex &clusterIndex) {
1108 std::int32_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1113 template <
typename... ArgsT>
1116 return Detail::RFieldValue(
1117 Detail::RColumnElement<std::int32_t>(
static_cast<std::int32_t*
>(where)),
1118 this,
static_cast<std::int32_t*
>(where), std::forward<ArgsT>(args)...);
1122 return Detail::RFieldValue(
true ,
1123 Detail::RColumnElement<std::int32_t>(
static_cast<std::int32_t*
>(where)),
this, where);
1125 size_t GetValueSize() const final {
return sizeof(std::int32_t); }
1126 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1130class RField<std::uint32_t> :
public Detail::RFieldBase {
1133 return std::make_unique<RField>(newName);
1137 static std::string TypeName() {
return "std::uint32_t"; }
1150 std::uint32_t *
Map(
const RClusterIndex clusterIndex) {
1156 std::uint32_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1161 template <
typename... ArgsT>
1164 return Detail::RFieldValue(
1165 Detail::RColumnElement<std::uint32_t>(
static_cast<std::uint32_t*
>(where)),
1166 this,
static_cast<std::uint32_t*
>(where), std::forward<ArgsT>(args)...);
1170 return Detail::RFieldValue(
true ,
1171 Detail::RColumnElement<std::uint32_t>(
static_cast<std::uint32_t*
>(where)),
this, where);
1173 size_t GetValueSize() const final {
return sizeof(std::uint32_t); }
1174 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1178class RField<std::uint64_t> :
public Detail::RFieldBase {
1181 return std::make_unique<RField>(newName);
1185 static std::string TypeName() {
return "std::uint64_t"; }
1198 std::uint64_t *
Map(
const RClusterIndex &clusterIndex) {
1204 std::uint64_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1209 template <
typename... ArgsT>
1212 return Detail::RFieldValue(
1213 Detail::RColumnElement<std::uint64_t>(
static_cast<std::uint64_t*
>(where)),
1214 this,
static_cast<std::uint64_t*
>(where), std::forward<ArgsT>(args)...);
1218 return Detail::RFieldValue(
true ,
1219 Detail::RColumnElement<std::uint64_t>(
static_cast<std::uint64_t*
>(where)),
this, where);
1221 size_t GetValueSize() const final {
return sizeof(std::uint64_t); }
1222 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1226class RField<std::int64_t> :
public Detail::RFieldBase {
1229 return std::make_unique<RField>(newName);
1233 static std::string TypeName() {
return "std::int64_t"; }
1246 std::int64_t *
Map(
const RClusterIndex &clusterIndex) {
1252 std::int64_t *MapV(
const RClusterIndex &clusterIndex,
NTupleSize_t &nItems) {
1257 template <
typename... ArgsT>
1260 return Detail::RFieldValue(
1261 Detail::RColumnElement<std::int64_t>(
static_cast<std::int64_t*
>(where)),
1262 this,
static_cast<std::int64_t*
>(where), std::forward<ArgsT>(args)...);
1266 return Detail::RFieldValue(
true ,
1267 Detail::RColumnElement<std::int64_t>(
static_cast<std::int64_t*
>(where)),
this, where);
1269 size_t GetValueSize() const final {
return sizeof(std::int64_t); }
1270 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1274class RField<std::string> :
public Detail::RFieldBase {
1277 Detail::RColumnElement<ClusterSize_t, EColumnType::kIndex> fElemIndex;
1280 return std::make_unique<RField>(newName);
1287 static std::string TypeName() {
return "std::string"; }
1290 , fIndex(0), fElemIndex(&fIndex) {}
1299 template <typename... ArgsT>
1302 return Detail::RFieldValue(
this,
static_cast<std::string*
>(where), std::forward<ArgsT>(args)...);
1306 auto str =
value.Get<std::string>();
1307 str->~basic_string();
1312 return Detail::RFieldValue(
true ,
this, where);
1314 size_t GetValueSize() const final {
return sizeof(std::string); }
1315 size_t GetAlignment() const final {
return std::alignment_of<std::string>(); }
1317 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
1321template <typename ItemT, std::
size_t N>
1322class
RField<std::array<ItemT,
N>> : public RArrayField {
1323 using ContainerT =
typename std::array<ItemT, N>;
1325 static std::string TypeName() {
1329 : RArrayField(
name, std::make_unique<
RField<ItemT>>(
RField<ItemT>::TypeName()),
N)
1336 template <
typename... ArgsT>
1339 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1347template <
typename... ItemTs>
1349 using ContainerT =
typename std::variant<ItemTs...>;
1351 template <
typename HeadT,
typename... TailTs>
1352 static std::string BuildItemTypes()
1355 if constexpr(
sizeof...(TailTs) > 0)
1356 result +=
"," + BuildItemTypes<TailTs...>();
1360 template <
typename HeadT,
typename... TailTs>
1361 static std::vector<Detail::RFieldBase *> BuildItemFields(
unsigned int index = 0)
1363 std::vector<Detail::RFieldBase *>
result;
1365 if constexpr(
sizeof...(TailTs) > 0) {
1366 auto tailFields = BuildItemFields<TailTs...>(
index + 1);
1367 result.insert(
result.end(), tailFields.begin(), tailFields.end());
1373 static std::string TypeName() {
return "std::variant<" + BuildItemTypes<ItemTs...>() +
">"; }
1380 template <
typename... ArgsT>
1383 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1390template <
typename ItemT>
1391class RField<std::vector<ItemT>> :
public RVectorField {
1392 using ContainerT =
typename std::vector<ItemT>;
1396 : RVectorField(
name, std::make_unique<
RField<ItemT>>(
"_0"))
1403 template <
typename... ArgsT>
1406 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1412 return Detail::RFieldValue(
true ,
this, where);
1414 size_t GetValueSize() const final {
return sizeof(ContainerT); }
1419class RField<std::vector<bool>> :
public Detail::RFieldBase {
1425 return std::make_unique<RField>(newName);
1433 static std::
string TypeName() {
return "std::vector<bool>"; }
1440 template <
typename... ArgsT>
1443 return Detail::RFieldValue(
this,
static_cast<std::vector<bool>*
>(where), std::forward<ArgsT>(args)...);
1449 return Detail::RFieldValue(
true ,
this, where);
1451 std::vector<Detail::RFieldValue>
SplitValue(
const Detail::RFieldValue &
value)
const final;
1452 void DestroyValue(
const Detail::RFieldValue&
value,
bool dtorOnly =
false) final;
1454 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
1455 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
1457 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1461 void GetCollectionInfo(
const RClusterIndex &clusterIndex, RClusterIndex *collectionStart,
ClusterSize_t *
size)
const
1467template <
typename ItemT>
1473 return std::make_unique<RField<ROOT::VecOps::RVec<ItemT>>>(newName, std::move(newItemField));
1478 auto count = typedValue->size();
1479 for (
unsigned i = 0; i < count; ++i) {
1480 auto itemValue =
fSubFields[0]->CaptureValue(&typedValue->data()[i]);
1484 this->fNWritten += count;
1486 return nbytes +
sizeof(elemIndex);
1493 typedValue->resize(nItems);
1494 for (
unsigned i = 0; i < nItems; ++i) {
1495 auto itemValue =
fSubFields[0]->CaptureValue(&typedValue->data()[i]);
1496 fSubFields[0]->Read(collectionStart + i, &itemValue);
1502 :
RRVecField(fieldName, std::move(itemField))
1524 template <
typename... ArgsT>
1536 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
1539template <
typename T1,
typename T2>
1540class RField<std::pair<T1, T2>> :
public RPairField {
1541 using ContainerT =
typename std::pair<T1,T2>;
1543 template <
typename Ty1,
typename Ty2>
1544 static std::array<std::unique_ptr<Detail::RFieldBase>, 2> BuildItemFields()
1546 return {std::make_unique<RField<Ty1>>(
"_0"), std::make_unique<
RField<Ty2>>(
"_1")};
1554 return std::make_unique<RField<std::pair<T1, T2>>>(newName, std::move(items));
1558 static std::string TypeName() {
1562 : RPairField(
name, std::move(itemFields), {offsetof(ContainerT,
first), offsetof(ContainerT,
second)})
1565 fSize =
sizeof(ContainerT);
1573 template <
typename... ArgsT>
1576 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1581 void DestroyValue(
const Detail::RFieldValue &
value,
bool dtorOnly =
false) final
1583 reinterpret_cast<ContainerT *
>(
value.GetRawPtr())->~pair();
1585 free(
reinterpret_cast<ContainerT *
>(
value.GetRawPtr()));
1589template <
typename... ItemTs>
1590class RField<std::tuple<ItemTs...>> :
public RTupleField {
1591 using ContainerT =
typename std::tuple<ItemTs...>;
1593 template <
typename HeadT,
typename... TailTs>
1594 static std::string BuildItemTypes()
1597 if constexpr (
sizeof...(TailTs) > 0)
1598 result +=
"," + BuildItemTypes<TailTs...>();
1602 template <
typename HeadT,
typename... TailTs>
1603 static void _BuildItemFields(std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields,
unsigned int index = 0)
1606 if constexpr (
sizeof...(TailTs) > 0)
1607 _BuildItemFields<TailTs...>(itemFields,
index + 1);
1609 template <
typename... Ts>
1610 static std::vector<std::unique_ptr<Detail::RFieldBase>> BuildItemFields()
1612 std::vector<std::unique_ptr<Detail::RFieldBase>>
result;
1613 _BuildItemFields<Ts...>(
result);
1617 template <
unsigned Index,
typename HeadT,
typename... TailTs>
1618 static void _BuildItemOffsets(std::vector<std::size_t> &offsets,
const ContainerT &tuple)
1621 reinterpret_cast<std::uintptr_t
>(&std::get<Index>(tuple)) -
reinterpret_cast<std::uintptr_t
>(&tuple);
1622 offsets.emplace_back(
offset);
1623 if constexpr (
sizeof...(TailTs) > 0)
1624 _BuildItemOffsets<
Index + 1, TailTs...>(offsets, tuple);
1626 template <
typename... Ts>
1627 static std::vector<std::size_t> BuildItemOffsets()
1629 std::vector<std::size_t>
result;
1630 _BuildItemOffsets<0, Ts...>(
result, ContainerT());
1637 std::vector<std::unique_ptr<Detail::RFieldBase>> items;
1639 items.push_back(item->Clone(item->GetName()));
1640 return std::make_unique<
RField<std::tuple<ItemTs...>>>(newName, std::move(items));
1644 static std::string TypeName() {
return "std::tuple<" + BuildItemTypes<ItemTs...>() +
">"; }
1646 : RTupleField(
name, std::move(itemFields), BuildItemOffsets<ItemTs...>())
1649 fSize =
sizeof(ContainerT);
1657 template <
typename... ArgsT>
1660 return Detail::RFieldValue(
this,
static_cast<ContainerT *
>(where), std::forward<ArgsT>(args)...);
1666 void DestroyValue(
const Detail::RFieldValue &
value,
bool dtorOnly =
false) final
1668 reinterpret_cast<ContainerT *
>(
value.GetRawPtr())->~tuple();
1670 free(
reinterpret_cast<ContainerT *
>(
value.GetRawPtr()));
ROOT::Experimental::RField< T > RField
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Pairs of C++ type and column type, like float and EColumnType::kReal32.
void Append(const RColumnElementBase &element)
CppT * MapV(const NTupleSize_t globalIndex, NTupleSize_t &nItems)
CppT * Map(const NTupleSize_t globalIndex)
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
virtual std::uint32_t GetFieldVersion() const
Indicates an evolution of the mapping scheme from C++ type to columns.
RFieldBase * GetParent() const
virtual RFieldValue CaptureValue(void *where)=0
Creates a value from a memory location with an already constructed object.
std::string GetDescription() const
Get the field's description.
void SetOnDiskId(DescriptorId_t id)
virtual void GenerateColumnsImpl(const RNTupleDescriptor &desc)=0
Creates the backing columns corresponsing to the field type for reading.
virtual void GenerateColumnsImpl()=0
Creates the backing columns corresponsing to the field type for writing.
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
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.
std::size_t GetNRepetitions() const
std::string fDescription
Free text set by the user.
virtual std::uint32_t GetTypeVersion() const
Indicates an evolution of the C++ type itself.
virtual void DestroyValue(const RFieldValue &value, bool dtorOnly=false)
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
DescriptorId_t GetOnDiskId() const
void ConnectPageSink(RPageSink &pageSink)
Fields and their columns live in the void until connected to a physical page storage.
ROOT::Experimental::EColumnType EnsureColumnType(const std::vector< EColumnType > &requestedTypes, unsigned int columnIndex, const RNTupleDescriptor &desc)
Throws an exception if the column given by fOnDiskId and the columnIndex in the provided descriptor i...
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 std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const =0
Called by Clone(), which additionally copies the on-disk ID.
virtual size_t GetValueSize() const =0
The number of bytes taken by a value of the appropriate type.
void SetDescription(std::string_view description)
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.
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.
NTupleSize_t GetNElements() const
void ConnectPageSource(RPageSource &pageSource)
std::size_t Append(const RFieldValue &value)
Write the given value into columns.
virtual std::size_t AppendImpl(const RFieldValue &value)
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > Clone(std::string_view newName) const
Copies the field and its sub fields using a possibly new name and a new, unconnected set of columns.
std::size_t fNRepetitions
For fixed sized arrays, the array length.
RFieldBase(const RFieldBase &)=delete
virtual void AcceptVisitor(RFieldVisitor &visitor) const
DescriptorId_t fOnDiskId
When the columns are connected to a page source or page sink, the field represents a field id in the ...
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.
std::vector< RFieldBase * > GetSubFields() const
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.
RFieldValue GenerateValue()
Generates an object of the field type and allocates new initialized memory according to the type.
RColumn * fPrincipalColumn
Points into fColumns.
Abstract base class for classes implementing the visitor design pattern.
Abstract interface to write data into an ntuple.
Abstract interface to read data from an ntuple.
The available trivial, native content types of a column.
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
RArrayField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField, std::size_t arrayLength)
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
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...
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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.
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
void Attach(std::unique_ptr< Detail::RFieldBase > child, RSubFieldInfo info)
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 > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
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 ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
RClassField(std::string_view fieldName, std::string_view className, TClass *classp)
std::vector< RSubFieldInfo > fSubFieldsInfo
Additional information kept for each entry in fSubFields
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...
The collection field is only used for writing; when reading, untyped collections are projected to an ...
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< RCollectionNTupleWriter > 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
A field translates read and write calls from/to underlying columns to/from tree values.
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
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const
Called by Clone(), which additionally copies the on-disk ID.
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().
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 for writing.
void GenerateColumnsImpl(const RNTupleDescriptor &) final
Creates the backing columns corresponsing to the field type for reading.
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
ClusterSize_t * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
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 for writing.
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
ClusterSize_t * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
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().
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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.
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
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)
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
bool * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
RField(std::string_view name)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
bool * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
static std::string TypeName()
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().
char * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
RField(std::string_view name)
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().
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
RField(RField &&other)=default
char * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
static std::string TypeName()
char * Map(const RClusterIndex &clusterIndex)
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
double * Map(const RClusterIndex &clusterIndex)
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
double * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
double * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
RField(std::string_view name)
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().
RField(RField &&other)=default
float * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
float * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
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.
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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()
The on-storage meta-data of an ntuple.
The generic field for std::pair<T1, T2> types.
static std::string GetTypeList(const std::array< std::unique_ptr< Detail::RFieldBase >, 2 > &itemFields)
RPairField(RPairField &&other)=default
RPairField & operator=(RPairField &&other)=default
The type-erased field for a RVec<Type>
Detail::RFieldValue CaptureValue(void *where) override
Creates a value from a memory location with an already constructed object.
std::size_t EvalValueSize() const
Evaluate the constant returned by GetValueSize.
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) override
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
RRVecField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
RRVecField(RRVecField &&)=default
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) override
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
size_t GetAlignment() const override
For many types, the alignment requirement is equal to the size; otherwise override.
RRVecField(const RRVecField &)=delete
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
RRVecField & operator=(RRVecField &&)=default
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
std::size_t AppendImpl(const Detail::RFieldValue &value) override
Operations on values of complex types, e.g.
RRVecField & operator=(RRVecField &)=delete
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(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
The field for an untyped record.
std::size_t fMaxAlignment
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
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< std::size_t > fOffsets
RRecordField(RRecordField &&other)=default
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
RRecordField(std::string_view fieldName, std::array< std::unique_ptr< Detail::RFieldBase >, N > &&itemFields, const std::array< std::size_t, N > &offsets, std::string_view typeName="")
void GenerateColumnsImpl(const RNTupleDescriptor &) final
Creates the backing columns corresponsing to the field type for reading.
RRecordField(std::string_view fieldName, std::vector< std::unique_ptr< Detail::RFieldBase > > &&itemFields, const std::vector< std::size_t > &offsets, std::string_view typeName="")
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
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 DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) override
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
RRecordField & operator=(RRecordField &&other)=default
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
RResult<void> has no data member and no Inspect() method but instead a Success() factory method.
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 std::tuple<Ts...> types.
static std::string GetTypeList(const std::vector< std::unique_ptr< Detail::RFieldBase > > &itemFields)
RTupleField & operator=(RTupleField &&other)=default
RTupleField(RTupleField &&other)=default
The generic field for std::variant types.
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RVariantField & operator=(RVariantField &&other)=default
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
std::vector< ClusterSize_t::ValueType > fNWritten
size_t fTagOffset
In the std::variant memory layout, at which byte number is the index stored.
void SetTag(void *variantPtr, std::uint32_t tag) const
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
std::uint32_t GetTag(void *variantPtr) const
Extracts the index from an std::variant and transforms it into the 1-based index used for the switch ...
static std::string GetTypeList(const std::vector< Detail::RFieldBase * > &itemFields)
RVariantField(std::string_view fieldName, const std::vector< Detail::RFieldBase * > &itemFields)
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
RVariantField(RVariantField &&other)=default
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
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.
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
RVectorField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
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.
RooCmdArg Index(RooCategory &icat)
auto Map(Args &&... args)
Create new collection applying a callable to the elements of the input collection.
basic_string_view< char > string_view
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.
constexpr DescriptorId_t kInvalidDescriptorId
std::string GetDemangledTypeName(const std::type_info &t)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static constexpr double second
Position(RFieldBase *fieldPtr, int idxInParent)
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...