49namespace Experimental {
51class RCollectionField;
52class RCollectionNTupleWriter;
57struct RFieldCallbackInjector;
136 virtual std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const = 0;
203 std::size_t nRepetitions = 0);
211 std::unique_ptr<RFieldBase>
Clone(std::string_view newName)
const;
246 return value.fMappedElement.GetSize();
283 void Attach(std::unique_ptr<Detail::RFieldBase>
child);
310 RSchemaIterator
begin();
311 RSchemaIterator
end();
323 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const override;
358 RClassField(std::string_view fieldName, std::string_view className,
TClass *classp);
362 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
368 RClassField(std::string_view fieldName, std::string_view className);
397 std::unique_ptr<TVirtualCollectionProxy>
fProxy;
404 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
422 size_t GetAlignment() const final {
return alignof(std::max_align_t); }
424 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
443 std::size_t
GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment)
const;
445 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const override;
450 RRecordField(std::string_view fieldName, std::vector<std::unique_ptr<Detail::RFieldBase>> &&itemFields,
451 const std::vector<std::size_t> &offsets, std::string_view typeName =
"");
453 template <std::
size_t N>
454 RRecordField(std::string_view fieldName, std::array<std::unique_ptr<Detail::RFieldBase>,
N> &&itemFields,
455 const std::array<std::size_t, N> &offsets, std::string_view typeName =
"")
459 for (
unsigned i = 0; i <
N; ++i) {
463 fTraits &= itemFields[i]->GetTraits();
464 Attach(std::move(itemFields[i]));
470 RRecordField(std::string_view fieldName, std::vector<std::unique_ptr<Detail::RFieldBase>> &&itemFields);
471 RRecordField(std::string_view fieldName, std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields);
495 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
500 RVectorField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField);
512 size_t GetValueSize()
const override {
return sizeof(std::vector<char>); }
513 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
515 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
536 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const override;
541 RRVecField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField);
558 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
576 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
582 RArrayField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField, std::size_t arrayLength);
609 static std::string
GetTypeList(
const std::vector<Detail::RFieldBase *> &itemFields);
611 std::uint32_t
GetTag(
void *variantPtr)
const;
612 void SetTag(
void *variantPtr, std::uint32_t tag)
const;
615 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
621 RVariantField(std::string_view fieldName,
const std::vector<Detail::RFieldBase *> &itemFields);
639template <typename T, typename=
void>
644 static_assert(std::is_class<T>::value,
"no I/O support for this basic C++ type");
651 template <
typename... ArgsT>
659template <
typename T,
typename =
void>
664 T, typename std::enable_if<std::is_same<typename T::IsCollectionProxy, std::true_type>::value>
::type>
705template <
typename T,
typename =
void>
727 RField(std::string_view
name) : RCollectionClassField(
name, TypeName())
729 static_assert(std::is_class<T>::value,
"collection proxy unsupported for fundamental types");
735 using Detail::RFieldBase::GenerateValue;
736 template <
typename... ArgsT>
739 return Detail::RFieldValue(
this,
static_cast<T*
>(where), std::forward<ArgsT>(args)...);
750 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final;
754 std::shared_ptr<RCollectionNTupleWriter> collectionNTuple,
755 std::unique_ptr<RNTupleModel> collectionModel);
781 static std::string
GetTypeList(
const std::array<std::unique_ptr<Detail::RFieldBase>, 2> &itemFields);
784 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const override;
786 RPairField(std::string_view fieldName, std::array<std::unique_ptr<Detail::RFieldBase>, 2> &&itemFields,
787 const std::array<std::size_t, 2> &offsets);
790 RPairField(std::string_view fieldName, std::array<std::unique_ptr<Detail::RFieldBase>, 2> &itemFields);
804 static std::string
GetTypeList(
const std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields);
807 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const override;
809 RTupleField(std::string_view fieldName, std::vector<std::unique_ptr<Detail::RFieldBase>> &&itemFields,
810 const std::vector<std::size_t> &offsets);
813 RTupleField(std::string_view fieldName, std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields);
818 using Detail::RFieldBase::GenerateValue;
829 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
830 return std::make_unique<RField>(newName);
834 static std::string
TypeName() {
return "ROOT::Experimental::ClusterSize_t"; }
838 fTraits |= kTraitTrivialType;
854 return fPrincipalColumn->MapV<
ClusterSize_t>(globalIndex, nItems);
857 return fPrincipalColumn->MapV<
ClusterSize_t>(clusterIndex, nItems);
860 using Detail::RFieldBase::GenerateValue;
861 template <
typename... ArgsT>
866 this,
static_cast<ClusterSize_t*
>(where), std::forward<ArgsT>(args)...);
877 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart,
size);
880 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart,
size);
889 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
890 return std::make_unique<RField>(newName);
898 fTraits |= kTraitTrivialType;
904 void GenerateColumnsImpl() final;
908 return fPrincipalColumn->Map<
bool>(globalIndex);
911 return fPrincipalColumn->Map<
bool>(clusterIndex);
914 return fPrincipalColumn->MapV<
bool>(globalIndex, nItems);
917 return fPrincipalColumn->MapV<
bool>(clusterIndex, nItems);
920 using Detail::RFieldBase::GenerateValue;
921 template <
typename... ArgsT>
926 this,
static_cast<bool*
>(where), std::forward<ArgsT>(args)...);
940 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
941 return std::make_unique<RField>(newName);
949 fTraits |= kTraitTrivialType;
955 void GenerateColumnsImpl() final;
959 return fPrincipalColumn->Map<
float>(globalIndex);
962 return fPrincipalColumn->Map<
float>(clusterIndex);
965 return fPrincipalColumn->MapV<
float>(globalIndex, nItems);
968 return fPrincipalColumn->MapV<
float>(clusterIndex, nItems);
971 using Detail::RFieldBase::GenerateValue;
972 template <
typename... ArgsT>
977 this,
static_cast<float*
>(where), std::forward<ArgsT>(args)...);
992 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
993 return std::make_unique<RField>(newName);
1001 fTraits |= kTraitTrivialType;
1007 void GenerateColumnsImpl() final;
1011 return fPrincipalColumn->Map<
double>(globalIndex);
1014 return fPrincipalColumn->Map<
double>(clusterIndex);
1017 return fPrincipalColumn->MapV<
double>(globalIndex, nItems);
1020 return fPrincipalColumn->MapV<
double>(clusterIndex, nItems);
1023 using Detail::RFieldBase::GenerateValue;
1024 template <
typename... ArgsT>
1029 this,
static_cast<double*
>(where), std::forward<ArgsT>(args)...);
1043 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
1044 return std::make_unique<RField>(newName);
1052 fTraits |= kTraitTrivialType;
1058 void GenerateColumnsImpl() final;
1062 return fPrincipalColumn->Map<
char>(globalIndex);
1065 return fPrincipalColumn->Map<
char>(clusterIndex);
1068 return fPrincipalColumn->MapV<
char>(globalIndex, nItems);
1071 return fPrincipalColumn->MapV<
char>(clusterIndex, nItems);
1074 using Detail::RFieldBase::GenerateValue;
1075 template <
typename... ArgsT>
1080 this,
static_cast<char*
>(where), std::forward<ArgsT>(args)...);
1092class RField<std::int8_t> :
public Detail::RFieldBase {
1094 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1095 return std::make_unique<RField>(newName);
1099 static std::string TypeName() {
return "std::int8_t"; }
1103 fTraits |= kTraitTrivialType;
1109 void GenerateColumnsImpl() final;
1110 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1112 std::int8_t *Map(NTupleSize_t globalIndex) {
1113 return fPrincipalColumn->Map<std::int8_t>(globalIndex);
1115 std::int8_t *
Map(
const RClusterIndex &clusterIndex) {
1116 return fPrincipalColumn->Map<std::int8_t>(clusterIndex);
1118 std::int8_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1119 return fPrincipalColumn->MapV<std::int8_t>(globalIndex, nItems);
1121 std::int8_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1122 return fPrincipalColumn->MapV<std::int8_t>(clusterIndex, nItems);
1125 using Detail::RFieldBase::GenerateValue;
1126 template <
typename... ArgsT>
1129 return Detail::RFieldValue(
1130 Detail::RColumnElement<std::int8_t>(
static_cast<std::int8_t*
>(where)),
1131 this,
static_cast<std::int8_t*
>(where), std::forward<ArgsT>(args)...);
1134 Detail::RFieldValue CaptureValue(
void *where)
final {
1135 return Detail::RFieldValue(
true ,
1136 Detail::RColumnElement<std::int8_t>(
static_cast<std::int8_t*
>(where)),
this, where);
1138 size_t GetValueSize() const final {
return sizeof(std::int8_t); }
1139 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1143class RField<std::uint8_t> :
public Detail::RFieldBase {
1145 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1146 return std::make_unique<RField>(newName);
1150 static std::string TypeName() {
return "std::uint8_t"; }
1154 fTraits |= kTraitTrivialType;
1160 void GenerateColumnsImpl() final;
1161 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1163 std::uint8_t *Map(NTupleSize_t globalIndex) {
1164 return fPrincipalColumn->Map<std::uint8_t>(globalIndex);
1166 std::uint8_t *
Map(
const RClusterIndex &clusterIndex) {
1167 return fPrincipalColumn->Map<std::uint8_t>(clusterIndex);
1169 std::uint8_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1170 return fPrincipalColumn->MapV<std::uint8_t>(globalIndex, nItems);
1172 std::uint8_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1173 return fPrincipalColumn->MapV<std::uint8_t>(clusterIndex, nItems);
1176 using Detail::RFieldBase::GenerateValue;
1177 template <
typename... ArgsT>
1180 return Detail::RFieldValue(
1181 Detail::RColumnElement<std::uint8_t>(
static_cast<std::uint8_t*
>(where)),
1182 this,
static_cast<std::uint8_t*
>(where), std::forward<ArgsT>(args)...);
1185 Detail::RFieldValue CaptureValue(
void *where)
final {
1186 return Detail::RFieldValue(
true ,
1187 Detail::RColumnElement<std::uint8_t>(
static_cast<std::uint8_t*
>(where)),
this, where);
1189 size_t GetValueSize() const final {
return sizeof(std::uint8_t); }
1190 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1194class RField<std::int16_t> :
public Detail::RFieldBase {
1196 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1197 return std::make_unique<RField>(newName);
1201 static std::string TypeName() {
return "std::int16_t"; }
1205 fTraits |= kTraitTrivialType;
1211 void GenerateColumnsImpl() final;
1212 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1214 std::int16_t *Map(NTupleSize_t globalIndex) {
1215 return fPrincipalColumn->Map<std::int16_t>(globalIndex);
1217 std::int16_t *
Map(
const RClusterIndex &clusterIndex) {
1218 return fPrincipalColumn->Map<std::int16_t>(clusterIndex);
1220 std::int16_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1221 return fPrincipalColumn->MapV<std::int16_t>(globalIndex, nItems);
1223 std::int16_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1224 return fPrincipalColumn->MapV<std::int16_t>(clusterIndex, nItems);
1227 using Detail::RFieldBase::GenerateValue;
1228 template <
typename... ArgsT>
1231 return Detail::RFieldValue(
1232 Detail::RColumnElement<std::int16_t>(
static_cast<std::int16_t*
>(where)),
1233 this,
static_cast<std::int16_t*
>(where), std::forward<ArgsT>(args)...);
1236 Detail::RFieldValue CaptureValue(
void *where)
final {
1237 return Detail::RFieldValue(
true ,
1238 Detail::RColumnElement<std::int16_t>(
static_cast<std::int16_t*
>(where)),
this, where);
1240 size_t GetValueSize() const final {
return sizeof(std::int16_t); }
1241 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1245class RField<std::uint16_t> :
public Detail::RFieldBase {
1247 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1248 return std::make_unique<RField>(newName);
1252 static std::string TypeName() {
return "std::uint16_t"; }
1256 fTraits |= kTraitTrivialType;
1262 void GenerateColumnsImpl() final;
1263 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1265 std::uint16_t *Map(NTupleSize_t globalIndex) {
1266 return fPrincipalColumn->Map<std::uint16_t>(globalIndex);
1268 std::uint16_t *
Map(
const RClusterIndex &clusterIndex) {
1269 return fPrincipalColumn->Map<std::uint16_t>(clusterIndex);
1271 std::uint16_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1272 return fPrincipalColumn->MapV<std::uint16_t>(globalIndex, nItems);
1274 std::uint16_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1275 return fPrincipalColumn->MapV<std::uint16_t>(clusterIndex, nItems);
1278 using Detail::RFieldBase::GenerateValue;
1279 template <
typename... ArgsT>
1282 return Detail::RFieldValue(
1283 Detail::RColumnElement<std::uint16_t>(
static_cast<std::uint16_t*
>(where)),
1284 this,
static_cast<std::uint16_t*
>(where), std::forward<ArgsT>(args)...);
1287 Detail::RFieldValue CaptureValue(
void *where)
final {
1288 return Detail::RFieldValue(
true ,
1289 Detail::RColumnElement<std::uint16_t>(
static_cast<std::uint16_t*
>(where)),
this, where);
1291 size_t GetValueSize() const final {
return sizeof(std::uint16_t); }
1292 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1296class RField<std::int32_t> :
public Detail::RFieldBase {
1298 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1299 return std::make_unique<RField>(newName);
1303 static std::string TypeName() {
return "std::int32_t"; }
1307 fTraits |= kTraitTrivialType;
1313 void GenerateColumnsImpl() final;
1314 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1316 std::int32_t *Map(NTupleSize_t globalIndex) {
1317 return fPrincipalColumn->Map<std::int32_t>(globalIndex);
1319 std::int32_t *
Map(
const RClusterIndex &clusterIndex) {
1320 return fPrincipalColumn->Map<std::int32_t>(clusterIndex);
1322 std::int32_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1323 return fPrincipalColumn->MapV<std::int32_t>(globalIndex, nItems);
1325 std::int32_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1326 return fPrincipalColumn->MapV<std::int32_t>(clusterIndex, nItems);
1329 using Detail::RFieldBase::GenerateValue;
1330 template <
typename... ArgsT>
1333 return Detail::RFieldValue(
1334 Detail::RColumnElement<std::int32_t>(
static_cast<std::int32_t*
>(where)),
1335 this,
static_cast<std::int32_t*
>(where), std::forward<ArgsT>(args)...);
1338 Detail::RFieldValue CaptureValue(
void *where)
final {
1339 return Detail::RFieldValue(
true ,
1340 Detail::RColumnElement<std::int32_t>(
static_cast<std::int32_t*
>(where)),
this, where);
1342 size_t GetValueSize() const final {
return sizeof(std::int32_t); }
1343 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1347class RField<std::uint32_t> :
public Detail::RFieldBase {
1349 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1350 return std::make_unique<RField>(newName);
1354 static std::string TypeName() {
return "std::uint32_t"; }
1358 fTraits |= kTraitTrivialType;
1364 void GenerateColumnsImpl() final;
1365 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1367 std::uint32_t *Map(NTupleSize_t globalIndex) {
1368 return fPrincipalColumn->Map<std::uint32_t>(globalIndex);
1370 std::uint32_t *
Map(
const RClusterIndex clusterIndex) {
1371 return fPrincipalColumn->Map<std::uint32_t>(clusterIndex);
1373 std::uint32_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1374 return fPrincipalColumn->MapV<std::uint32_t>(globalIndex, nItems);
1376 std::uint32_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1377 return fPrincipalColumn->MapV<std::uint32_t>(clusterIndex, nItems);
1380 using Detail::RFieldBase::GenerateValue;
1381 template <
typename... ArgsT>
1384 return Detail::RFieldValue(
1385 Detail::RColumnElement<std::uint32_t>(
static_cast<std::uint32_t*
>(where)),
1386 this,
static_cast<std::uint32_t*
>(where), std::forward<ArgsT>(args)...);
1389 Detail::RFieldValue CaptureValue(
void *where)
final {
1390 return Detail::RFieldValue(
true ,
1391 Detail::RColumnElement<std::uint32_t>(
static_cast<std::uint32_t*
>(where)),
this, where);
1393 size_t GetValueSize() const final {
return sizeof(std::uint32_t); }
1394 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1398class RField<std::uint64_t> :
public Detail::RFieldBase {
1400 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1401 return std::make_unique<RField>(newName);
1405 static std::string TypeName() {
return "std::uint64_t"; }
1409 fTraits |= kTraitTrivialType;
1415 void GenerateColumnsImpl() final;
1416 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1418 std::uint64_t *Map(NTupleSize_t globalIndex) {
1419 return fPrincipalColumn->Map<std::uint64_t>(globalIndex);
1421 std::uint64_t *
Map(
const RClusterIndex &clusterIndex) {
1422 return fPrincipalColumn->Map<std::uint64_t>(clusterIndex);
1424 std::uint64_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1425 return fPrincipalColumn->MapV<std::uint64_t>(globalIndex, nItems);
1427 std::uint64_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1428 return fPrincipalColumn->MapV<std::uint64_t>(clusterIndex, nItems);
1431 using Detail::RFieldBase::GenerateValue;
1432 template <
typename... ArgsT>
1435 return Detail::RFieldValue(
1436 Detail::RColumnElement<std::uint64_t>(
static_cast<std::uint64_t*
>(where)),
1437 this,
static_cast<std::uint64_t*
>(where), std::forward<ArgsT>(args)...);
1440 Detail::RFieldValue CaptureValue(
void *where)
final {
1441 return Detail::RFieldValue(
true ,
1442 Detail::RColumnElement<std::uint64_t>(
static_cast<std::uint64_t*
>(where)),
this, where);
1444 size_t GetValueSize() const final {
return sizeof(std::uint64_t); }
1445 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1449class RField<std::int64_t> :
public Detail::RFieldBase {
1451 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1452 return std::make_unique<RField>(newName);
1456 static std::string TypeName() {
return "std::int64_t"; }
1460 fTraits |= kTraitTrivialType;
1466 void GenerateColumnsImpl() final;
1467 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1469 std::int64_t *Map(NTupleSize_t globalIndex) {
1470 return fPrincipalColumn->Map<std::int64_t>(globalIndex);
1472 std::int64_t *
Map(
const RClusterIndex &clusterIndex) {
1473 return fPrincipalColumn->Map<std::int64_t>(clusterIndex);
1475 std::int64_t *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) {
1476 return fPrincipalColumn->MapV<std::int64_t>(globalIndex, nItems);
1478 std::int64_t *MapV(
const RClusterIndex &clusterIndex, NTupleSize_t &nItems) {
1479 return fPrincipalColumn->MapV<std::int64_t>(clusterIndex, nItems);
1482 using Detail::RFieldBase::GenerateValue;
1483 template <
typename... ArgsT>
1486 return Detail::RFieldValue(
1487 Detail::RColumnElement<std::int64_t>(
static_cast<std::int64_t*
>(where)),
1488 this,
static_cast<std::int64_t*
>(where), std::forward<ArgsT>(args)...);
1491 Detail::RFieldValue CaptureValue(
void *where)
final {
1492 return Detail::RFieldValue(
true ,
1493 Detail::RColumnElement<std::int64_t>(
static_cast<std::int64_t*
>(where)),
this, where);
1495 size_t GetValueSize() const final {
return sizeof(std::int64_t); }
1496 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1500class RField<std::string> :
public Detail::RFieldBase {
1503 Detail::RColumnElement<ClusterSize_t, EColumnType::kIndex> fElemIndex;
1505 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1506 return std::make_unique<RField>(newName);
1513 static std::string TypeName() {
return "std::string"; }
1523 void GenerateColumnsImpl() final;
1524 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1527 template <typename... ArgsT>
1528 ROOT::Experimental::Detail::
RFieldValue GenerateValue(
void* where, ArgsT&&... args)
1530 return Detail::RFieldValue(
this,
static_cast<std::string*
>(where), std::forward<ArgsT>(args)...);
1533 void DestroyValue(
const Detail::RFieldValue&
value,
bool dtorOnly =
false)
override {
1534 auto str =
value.Get<std::string>();
1535 str->~basic_string();
1539 Detail::RFieldValue CaptureValue(
void *where)
override {
1540 return Detail::RFieldValue(
true ,
this, where);
1542 size_t GetValueSize() const final {
return sizeof(std::string); }
1543 size_t GetAlignment() const final {
return std::alignment_of<std::string>(); }
1544 void CommitCluster() final;
1545 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
1549template <typename ItemT, std::
size_t N>
1550class
RField<std::array<ItemT,
N>> : public RArrayField {
1551 using ContainerT =
typename std::array<ItemT, N>;
1553 static std::string TypeName() {
1557 : RArrayField(
name, std::make_unique<
RField<ItemT>>(
RField<ItemT>::TypeName()),
N)
1563 using Detail::RFieldBase::GenerateValue;
1564 template <
typename... ArgsT>
1567 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1570 return GenerateValue(where, ContainerT());
1574template <
typename ItemT, std::
size_t N>
1583template <
typename... ItemTs>
1585 using ContainerT =
typename std::variant<ItemTs...>;
1587 template <
typename HeadT,
typename... TailTs>
1588 static std::string BuildItemTypes()
1591 if constexpr(
sizeof...(TailTs) > 0)
1592 result +=
"," + BuildItemTypes<TailTs...>();
1596 template <
typename HeadT,
typename... TailTs>
1597 static std::vector<Detail::RFieldBase *> BuildItemFields(
unsigned int index = 0)
1599 std::vector<Detail::RFieldBase *>
result;
1601 if constexpr(
sizeof...(TailTs) > 0) {
1602 auto tailFields = BuildItemFields<TailTs...>(
index + 1);
1603 result.insert(
result.end(), tailFields.begin(), tailFields.end());
1609 static std::string TypeName() {
return "std::variant<" + BuildItemTypes<ItemTs...>() +
">"; }
1610 explicit RField(std::string_view
name) : RVariantField(
name, BuildItemFields<ItemTs...>()) {}
1615 using Detail::RFieldBase::GenerateValue;
1616 template <
typename... ArgsT>
1619 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1622 return GenerateValue(where, ContainerT());
1626template <
typename ItemT>
1627class RField<std::vector<ItemT>> :
public RVectorField {
1628 using ContainerT =
typename std::vector<ItemT>;
1632 : RVectorField(
name, std::make_unique<
RField<ItemT>>(
"_0"))
1638 using Detail::RFieldBase::GenerateValue;
1639 template <
typename... ArgsT>
1642 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1645 return GenerateValue(where, ContainerT());
1647 Detail::RFieldValue CaptureValue(
void *where)
final {
1648 return Detail::RFieldValue(
true ,
this, where);
1650 size_t GetValueSize() const final {
return sizeof(ContainerT); }
1655class RField<std::vector<bool>> :
public Detail::RFieldBase {
1660 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final {
1661 return std::make_unique<RField>(newName);
1663 std::size_t AppendImpl(
const Detail::RFieldValue&
value)
final;
1664 void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *
value)
final;
1665 void GenerateColumnsImpl() final;
1666 void GenerateColumnsImpl(const RNTupleDescriptor &desc) final;
1669 static std::
string TypeName() {
return "std::vector<bool>"; }
1675 using Detail::RFieldBase::GenerateValue;
1676 template <
typename... ArgsT>
1679 return Detail::RFieldValue(
this,
static_cast<std::vector<bool>*
>(where), std::forward<ArgsT>(args)...);
1682 return GenerateValue(where, std::vector<bool>());
1684 Detail::RFieldValue CaptureValue(
void *where)
final {
1685 return Detail::RFieldValue(
true ,
this, where);
1687 std::vector<Detail::RFieldValue> SplitValue(
const Detail::RFieldValue &
value)
const final;
1688 void DestroyValue(
const Detail::RFieldValue&
value,
bool dtorOnly =
false) final;
1690 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
1691 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
1692 void CommitCluster() final { fNWritten = 0; }
1693 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
1694 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *
size)
const {
1695 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart,
size);
1697 void GetCollectionInfo(
const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *
size)
const
1699 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart,
size);
1703template <
typename ItemT>
1707 std::unique_ptr<Detail::RFieldBase>
CloneImpl(std::string_view newName)
const final {
1708 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetName());
1709 return std::make_unique<RField<ROOT::VecOps::RVec<ItemT>>>(newName, std::move(newItemField));
1714 auto count = typedValue->size();
1715 for (
unsigned i = 0; i < count; ++i) {
1716 auto itemValue = fSubFields[0]->CaptureValue(&typedValue->data()[i]);
1717 nbytes += fSubFields[0]->Append(itemValue);
1720 this->fNWritten += count;
1721 fColumns[0]->Append(elemIndex);
1722 return nbytes +
sizeof(elemIndex);
1728 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
1729 typedValue->resize(nItems);
1730 for (
unsigned i = 0; i < nItems; ++i) {
1731 auto itemValue = fSubFields[0]->CaptureValue(&typedValue->data()[i]);
1732 fSubFields[0]->Read(collectionStart + i, &itemValue);
1737 RField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField)
1738 :
RRVecField(fieldName, std::move(itemField))
1759 using Detail::RFieldBase::GenerateValue;
1760 template <
typename... ArgsT>
1772 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
1775template <
typename T1,
typename T2>
1776class RField<std::pair<T1, T2>> :
public RPairField {
1777 using ContainerT =
typename std::pair<T1,T2>;
1779 template <
typename Ty1,
typename Ty2>
1780 static std::array<std::unique_ptr<Detail::RFieldBase>, 2> BuildItemFields()
1782 return {std::make_unique<RField<Ty1>>(
"_0"), std::make_unique<
RField<Ty2>>(
"_1")};
1786 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final
1788 std::array<std::unique_ptr<Detail::RFieldBase>, 2> items{fSubFields[0]->
Clone(fSubFields[0]->GetName()),
1789 fSubFields[1]->Clone(fSubFields[1]->GetName())};
1790 return std::make_unique<RField<std::pair<T1, T2>>>(newName, std::move(items));
1794 static std::string TypeName() {
1797 explicit RField(std::string_view
name, std::array<std::unique_ptr<Detail::RFieldBase>, 2> &&itemFields)
1798 : RPairField(
name, std::move(itemFields), {offsetof(ContainerT,
first), offsetof(ContainerT, second)})
1800 fMaxAlignment = std::max(
alignof(
T1),
alignof(
T2));
1801 fSize =
sizeof(ContainerT);
1808 using Detail::RFieldBase::GenerateValue;
1809 template <
typename... ArgsT>
1812 return Detail::RFieldValue(
this,
static_cast<ContainerT*
>(where), std::forward<ArgsT>(args)...);
1815 return GenerateValue(where, ContainerT());
1817 void DestroyValue(
const Detail::RFieldValue &
value,
bool dtorOnly =
false) final
1819 reinterpret_cast<ContainerT *
>(
value.GetRawPtr())->~pair();
1821 free(
reinterpret_cast<ContainerT *
>(
value.GetRawPtr()));
1825template <
typename... ItemTs>
1826class RField<std::tuple<ItemTs...>> :
public RTupleField {
1827 using ContainerT =
typename std::tuple<ItemTs...>;
1829 template <
typename HeadT,
typename... TailTs>
1830 static std::string BuildItemTypes()
1833 if constexpr (
sizeof...(TailTs) > 0)
1834 result +=
"," + BuildItemTypes<TailTs...>();
1838 template <
typename HeadT,
typename... TailTs>
1839 static void _BuildItemFields(std::vector<std::unique_ptr<Detail::RFieldBase>> &itemFields,
unsigned int index = 0)
1842 if constexpr (
sizeof...(TailTs) > 0)
1843 _BuildItemFields<TailTs...>(itemFields,
index + 1);
1845 template <
typename... Ts>
1846 static std::vector<std::unique_ptr<Detail::RFieldBase>> BuildItemFields()
1848 std::vector<std::unique_ptr<Detail::RFieldBase>>
result;
1849 _BuildItemFields<Ts...>(
result);
1853 template <
unsigned Index,
typename HeadT,
typename... TailTs>
1854 static void _BuildItemOffsets(std::vector<std::size_t> &offsets,
const ContainerT &tuple)
1857 reinterpret_cast<std::uintptr_t
>(&std::get<Index>(tuple)) -
reinterpret_cast<std::uintptr_t
>(&tuple);
1858 offsets.emplace_back(
offset);
1859 if constexpr (
sizeof...(TailTs) > 0)
1860 _BuildItemOffsets<
Index + 1, TailTs...>(offsets, tuple);
1862 template <
typename... Ts>
1863 static std::vector<std::size_t> BuildItemOffsets()
1865 std::vector<std::size_t>
result;
1866 _BuildItemOffsets<0, Ts...>(
result, ContainerT());
1871 std::unique_ptr<Detail::RFieldBase> CloneImpl(std::string_view newName)
const final
1873 std::vector<std::unique_ptr<Detail::RFieldBase>> items;
1874 for (
auto &item : fSubFields)
1875 items.push_back(item->Clone(item->GetName()));
1876 return std::make_unique<
RField<std::tuple<ItemTs...>>>(newName, std::move(items));
1880 static std::string TypeName() {
return "std::tuple<" + BuildItemTypes<ItemTs...>() +
">"; }
1881 explicit RField(std::string_view
name, std::vector<std::unique_ptr<Detail::RFieldBase>> &&itemFields)
1882 : RTupleField(
name, std::move(itemFields), BuildItemOffsets<ItemTs...>())
1884 fMaxAlignment = std::max({
alignof(ItemTs)...});
1885 fSize =
sizeof(ContainerT);
1892 using Detail::RFieldBase::GenerateValue;
1893 template <
typename... ArgsT>
1896 return Detail::RFieldValue(
this,
static_cast<ContainerT *
>(where), std::forward<ArgsT>(args)...);
1900 return GenerateValue(where, ContainerT());
1902 void DestroyValue(
const Detail::RFieldValue &
value,
bool dtorOnly =
false) final
1904 reinterpret_cast<ContainerT *
>(
value.GetRawPtr())->~tuple();
1906 free(
reinterpret_cast<ContainerT *
>(
value.GetRawPtr()));
#define R__unlikely(expr)
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
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
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
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.
int fTraits
Properties of the type that allow for optimizations of collections of that type.
friend struct ROOT::Experimental::Internal::RFieldCallbackInjector
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
static constexpr int kTraitTrivialType
Shorthand for types that are both trivially constructible and destructible.
friend class ROOT::Experimental::RCollectionField
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 RemoveReadCallback(size_t idx)
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 qualifies as simple if it is both mappable and has no post-read callback.
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.
size_t AddReadCallback(ReadCallback_t func)
Set a user-defined function to be called after reading a value, giving a chance to inspect and/or mod...
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::function< void(RFieldValue &)> ReadCallback_t
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)
void InvokeReadCallbacks(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.
static constexpr int kTraitMappable
A field of a fundamental type that can be directly mapped via RField<T>::Map(), i....
void Attach(std::unique_ptr< Detail::RFieldBase > child)
Add a new subfield to the list of nested fields.
std::vector< RFieldBase * > GetSubFields() const
bool HasReadCallbacks() 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.
static constexpr int kTraitTriviallyConstructible
No constructor needs to be called, i.e.
static constexpr int kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. DestroyValue() is a no-op.
RFieldValue GenerateValue()
Generates an object of the field type and allocates new initialized memory according to the type.
std::vector< ReadCallback_t > fReadCallbacks
List of functions to be called after reading a value.
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
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.
~RArrayField() override=default
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
~RClassField() override=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.
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 field for a class representing a collection of elements via TVirtualCollectionProxy.
~RCollectionClassField() override=default
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
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::unique_ptr< TVirtualCollectionProxy > fProxy
std::unique_ptr< Detail::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RCollectionClassField & operator=(RCollectionClassField &&other)=default
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Detail::RFieldValue CaptureValue(void *where) override
Creates a value from a memory location with an already constructed object.
std::size_t AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
RCollectionClassField(RCollectionClassField &&other)=default
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
static constexpr const std::size_t kReadChunkSize
Chunk size in bytes used in ReadGlobalImp().
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() override=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 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.
Detail::RFieldValue GenerateValue(void *) override
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.
~RField() override=default
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 & operator=(RField &&other)=default
RField(RField &&other)=default
~RField() override=default
RField(std::string_view name)
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() override=default
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)
~RField() override=default
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()
~RField() override=default
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)
~RField() override=default
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.
~RField() override=default
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 & operator=(RField &&other)=default
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()
~RField() override=default
The on-storage meta-data of an ntuple.
The generic field for std::pair<T1, T2> types.
~RPairField() override=default
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...
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
RRVecField(RRVecField &&)=default
~RRVecField() override=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.
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
~RRecordField() override=default
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
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() override=default
RTupleField(RTupleField &&other)=default
The generic field for std::variant types.
~RVariantField() override=default
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)
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>
~RVectorField() override=default
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.
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.
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.
Position(RFieldBase *fieldPtr, int idxInParent)
The point here is that we can only tell at run time if a class has an associated collection proxy.
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...