Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
RFieldBase.cxx
Go to the documentation of this file.
1/// \file RFieldBase.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
4/// \date 2024-11-19
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8#include <ROOT/RError.hxx>
9#include <ROOT/RField.hxx>
10#include <ROOT/RFieldBase.hxx>
12#include <ROOT/RFieldUtils.hxx>
13
14#include <TClass.h>
15#include <TClassEdit.h>
16#include <TEnum.h>
17
18#include <string>
19#include <vector>
20
21namespace {
22
23/// Used as a thread local context storage for Create(); steers the behavior of the Create() call stack
24class CreateContextGuard;
25class CreateContext {
26 friend class CreateContextGuard;
27 /// All classes that were defined by Create() calls higher up in the stack. Finds cyclic type definitions.
28 std::vector<std::string> fClassesOnStack;
29 /// If set to true, Create() will create an RInvalidField on error instead of throwing an exception.
30 /// This is used in RFieldBase::Check() to identify unsupported sub fields.
31 bool fContinueOnError = false;
32
33public:
34 CreateContext() = default;
35 bool GetContinueOnError() const { return fContinueOnError; }
36};
37
38/// RAII for modifications of CreateContext
39class CreateContextGuard {
40 CreateContext &fCreateContext;
41 std::size_t fNOriginalClassesOnStack;
42 bool fOriginalContinueOnError;
43
44public:
45 CreateContextGuard(CreateContext &ctx)
46 : fCreateContext(ctx),
47 fNOriginalClassesOnStack(ctx.fClassesOnStack.size()),
48 fOriginalContinueOnError(ctx.fContinueOnError)
49 {
50 }
52 {
53 fCreateContext.fClassesOnStack.resize(fNOriginalClassesOnStack);
54 fCreateContext.fContinueOnError = fOriginalContinueOnError;
55 }
56
57 void AddClassToStack(const std::string &cl)
58 {
59 if (std::find(fCreateContext.fClassesOnStack.begin(), fCreateContext.fClassesOnStack.end(), cl) !=
60 fCreateContext.fClassesOnStack.end()) {
61 throw ROOT::RException(R__FAIL("cyclic class definition: " + cl));
62 }
63 fCreateContext.fClassesOnStack.emplace_back(cl);
64 }
65
66 void SetContinueOnError(bool value) { fCreateContext.fContinueOnError = value; }
67};
68
69} // anonymous namespace
70
88
90ROOT::Internal::CallFieldBaseCreate(const std::string &fieldName, const std::string &typeName,
91 const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc,
93{
94 return RFieldBase::Create(fieldName, typeName, options, desc, fieldId);
95}
96
97//------------------------------------------------------------------------------
98
100{
101 // A single representations with an empty set of columns
104}
105
113
114//------------------------------------------------------------------------------
115
117{
118 // Set fObjPtr to an aliased shared_ptr of the input raw pointer. Note that
119 // fObjPtr will be non-empty but have use count zero.
121}
122
123//------------------------------------------------------------------------------
124
126 : fField(other.fField),
128 fCapacity(other.fCapacity),
130 fIsAdopted(other.fIsAdopted),
131 fNValidValues(other.fNValidValues),
132 fFirstIndex(other.fFirstIndex)
133{
134 std::swap(fDeleter, other.fDeleter);
135 std::swap(fValues, other.fValues);
136 std::swap(fMaskAvail, other.fMaskAvail);
137}
138
140{
141 std::swap(fField, other.fField);
142 std::swap(fDeleter, other.fDeleter);
143 std::swap(fValues, other.fValues);
144 std::swap(fValueSize, other.fValueSize);
145 std::swap(fCapacity, other.fCapacity);
146 std::swap(fSize, other.fSize);
147 std::swap(fIsAdopted, other.fIsAdopted);
148 std::swap(fMaskAvail, other.fMaskAvail);
149 std::swap(fNValidValues, other.fNValidValues);
150 std::swap(fFirstIndex, other.fFirstIndex);
151 return *this;
152}
153
155{
156 if (fValues)
157 ReleaseValues();
158}
159
161{
162 if (fIsAdopted)
163 return;
164
165 if (!(fField->GetTraits() & RFieldBase::kTraitTriviallyDestructible)) {
166 for (std::size_t i = 0; i < fCapacity; ++i) {
167 fDeleter->operator()(GetValuePtrAt(i), true /* dtorOnly */);
168 }
169 }
170
171 operator delete(fValues);
172}
173
175{
176 if (fCapacity < size) {
177 if (fIsAdopted) {
178 throw RException(R__FAIL("invalid attempt to bulk read beyond the adopted buffer"));
179 }
180 ReleaseValues();
181 fValues = operator new(size * fValueSize);
182
183 if (!(fField->GetTraits() & RFieldBase::kTraitTriviallyConstructible)) {
184 for (std::size_t i = 0; i < size; ++i) {
185 fField->ConstructValue(GetValuePtrAt(i));
186 }
187 }
188
189 fMaskAvail = std::make_unique<bool[]>(size);
190 fCapacity = size;
191 }
192
193 std::fill(fMaskAvail.get(), fMaskAvail.get() + size, false);
194 fNValidValues = 0;
195
196 fFirstIndex = firstIndex;
197 fSize = size;
198}
199
201{
202 fNValidValues = 0;
203 for (std::size_t i = 0; i < fSize; ++i)
204 fNValidValues += static_cast<std::size_t>(fMaskAvail[i]);
205}
206
207void ROOT::RFieldBase::RBulk::AdoptBuffer(void *buf, std::size_t capacity)
208{
209 ReleaseValues();
210 fValues = buf;
211 fCapacity = capacity;
212 fSize = capacity;
213
214 fMaskAvail = std::make_unique<bool[]>(capacity);
215
216 fFirstIndex = RNTupleLocalIndex();
217
218 fIsAdopted = true;
219}
220
221//------------------------------------------------------------------------------
222
224{
225 R__LOG_WARNING(ROOT::Internal::NTupleLog()) << "possibly leaking object from RField<T>::CreateObject<void>";
226}
227
228template <>
229std::unique_ptr<void, typename ROOT::RFieldBase::RCreateObjectDeleter<void>::deleter>
230ROOT::RFieldBase::CreateObject<void>() const
231{
233 return std::unique_ptr<void, RCreateObjectDeleter<void>::deleter>(CreateObjectRawPtr(), gDeleter);
234}
235
236//------------------------------------------------------------------------------
237
238ROOT::RFieldBase::RFieldBase(std::string_view name, std::string_view type, ROOT::ENTupleStructure structure,
239 bool isSimple, std::size_t nRepetitions)
240 : fName(name),
241 fType(type),
242 fStructure(structure),
245 fParent(nullptr),
246 fPrincipalColumn(nullptr),
248{
250}
251
253{
254 std::string result = GetFieldName();
255 auto parent = GetParent();
256 while (parent && !parent->GetFieldName().empty()) {
257 result = parent->GetFieldName() + "." + result;
258 parent = parent->GetParent();
259 }
260 return result;
261}
262
264ROOT::RFieldBase::Create(const std::string &fieldName, const std::string &typeName)
265{
266 return R__FORWARD_RESULT(
268}
269
270std::vector<ROOT::RFieldBase::RCheckResult>
271ROOT::RFieldBase::Check(const std::string &fieldName, const std::string &typeName)
272{
275 cfOpts.SetReturnInvalidOnError(true);
276 cfOpts.SetEmulateUnknownTypes(false);
277 fieldZero.Attach(RFieldBase::Create(fieldName, typeName, cfOpts, nullptr, kInvalidDescriptorId).Unwrap());
278
279 std::vector<RCheckResult> result;
280 for (const auto &f : fieldZero) {
281 const bool isInvalidField = f.GetTraits() & RFieldBase::kTraitInvalidField;
282 if (!isInvalidField)
283 continue;
284
285 const auto &invalidField = static_cast<const RInvalidField &>(f);
286 result.emplace_back(
287 RCheckResult{invalidField.GetQualifiedFieldName(), invalidField.GetTypeName(), invalidField.GetError()});
288 }
289 return result;
290}
291
293ROOT::RFieldBase::Create(const std::string &fieldName, const std::string &typeName,
294 const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc,
296{
300
302
303 thread_local CreateContext createContext;
304 CreateContextGuard createContextGuard(createContext);
305 if (options.GetReturnInvalidOnError())
306 createContextGuard.SetContinueOnError(true);
307
308 auto fnFail = [&fieldName,
309 &resolvedType](const std::string &errMsg,
311 RInvalidField::RCategory::kTypeError) -> RResult<std::unique_ptr<RFieldBase>> {
312 if (createContext.GetContinueOnError()) {
313 return std::unique_ptr<RFieldBase>(std::make_unique<RInvalidField>(fieldName, resolvedType, errMsg, cat));
314 } else {
315 return R__FAIL(errMsg);
316 }
317 };
318
319 if (resolvedType.empty())
320 return R__FORWARD_RESULT(fnFail("no type name specified for field '" + fieldName + "'"));
321
322 std::unique_ptr<ROOT::RFieldBase> result;
323
324 const auto maybeGetChildId = [desc, fieldId](int childId) {
325 if (desc) {
326 const auto &fieldDesc = desc->GetFieldDescriptor(fieldId);
327 return fieldDesc.GetLinkIds().at(childId);
328 } else {
330 }
331 };
332
333 // try-catch block to intercept any exception that may be thrown by Unwrap() so that this
334 // function never throws but returns RResult::Error instead.
335 try {
337 std::unique_ptr<RFieldBase> arrayField = Create("_0", arrayBaseType, options, desc, fieldId).Unwrap();
338 for (int i = arraySizes.size() - 1; i >= 0; --i) {
339 arrayField =
340 std::make_unique<RArrayField>((i == 0) ? fieldName : "_0", std::move(arrayField), arraySizes[i]);
341 }
342 return arrayField;
343 }
344
345 if (resolvedType == "bool") {
346 result = std::make_unique<RField<bool>>(fieldName);
347 } else if (resolvedType == "char") {
348 result = std::make_unique<RField<char>>(fieldName);
349 } else if (resolvedType == "std::byte") {
350 result = std::make_unique<RField<std::byte>>(fieldName);
351 } else if (resolvedType == "std::int8_t") {
352 result = std::make_unique<RField<std::int8_t>>(fieldName);
353 } else if (resolvedType == "std::uint8_t") {
354 result = std::make_unique<RField<std::uint8_t>>(fieldName);
355 } else if (resolvedType == "std::int16_t") {
356 result = std::make_unique<RField<std::int16_t>>(fieldName);
357 } else if (resolvedType == "std::uint16_t") {
358 result = std::make_unique<RField<std::uint16_t>>(fieldName);
359 } else if (resolvedType == "std::int32_t") {
360 result = std::make_unique<RField<std::int32_t>>(fieldName);
361 } else if (resolvedType == "std::uint32_t") {
362 result = std::make_unique<RField<std::uint32_t>>(fieldName);
363 } else if (resolvedType == "std::int64_t") {
364 result = std::make_unique<RField<std::int64_t>>(fieldName);
365 } else if (resolvedType == "std::uint64_t") {
366 result = std::make_unique<RField<std::uint64_t>>(fieldName);
367 } else if (resolvedType == "float") {
368 result = std::make_unique<RField<float>>(fieldName);
369 } else if (resolvedType == "double") {
370 result = std::make_unique<RField<double>>(fieldName);
371 } else if (resolvedType == "Double32_t") {
372 result = std::make_unique<RField<double>>(fieldName);
373 static_cast<RField<double> *>(result.get())->SetDouble32();
374 // Prevent the type alias from being reset by returning early
375 return result;
376 } else if (resolvedType == "std::string") {
377 result = std::make_unique<RField<std::string>>(fieldName);
378 } else if (resolvedType == "TObject") {
379 result = std::make_unique<RField<TObject>>(fieldName);
380 } else if (resolvedType == "std::vector<bool>") {
381 result = std::make_unique<RField<std::vector<bool>>>(fieldName);
382 } else if (resolvedType.substr(0, 12) == "std::vector<") {
383 std::string itemTypeName = resolvedType.substr(12, resolvedType.length() - 13);
384 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0));
385 result = std::make_unique<RVectorField>(fieldName, itemField.Unwrap());
386 } else if (resolvedType.substr(0, 19) == "ROOT::VecOps::RVec<") {
387 std::string itemTypeName = resolvedType.substr(19, resolvedType.length() - 20);
388 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0));
389 result = std::make_unique<RRVecField>(fieldName, itemField.Unwrap());
390 } else if (resolvedType.substr(0, 11) == "std::array<") {
391 auto arrayDef = TokenizeTypeList(resolvedType.substr(11, resolvedType.length() - 12));
392 if (arrayDef.size() != 2) {
393 return R__FORWARD_RESULT(fnFail("the template list for std::array must have exactly two elements"));
394 }
396 auto itemField = Create("_0", arrayDef[0], options, desc, maybeGetChildId(0));
397 result = std::make_unique<RArrayField>(fieldName, itemField.Unwrap(), arrayLength);
398 } else if (resolvedType.substr(0, 13) == "std::variant<") {
399 auto innerTypes = TokenizeTypeList(resolvedType.substr(13, resolvedType.length() - 14));
400 std::vector<std::unique_ptr<RFieldBase>> items;
401 items.reserve(innerTypes.size());
402 for (unsigned int i = 0; i < innerTypes.size(); ++i) {
403 items.emplace_back(
404 Create("_" + std::to_string(i), innerTypes[i], options, desc, maybeGetChildId(i)).Unwrap());
405 }
406 result = std::make_unique<RVariantField>(fieldName, std::move(items));
407 } else if (resolvedType.substr(0, 10) == "std::pair<") {
408 auto innerTypes = TokenizeTypeList(resolvedType.substr(10, resolvedType.length() - 11));
409 if (innerTypes.size() != 2) {
410 return R__FORWARD_RESULT(fnFail("the type list for std::pair must have exactly two elements"));
411 }
412 std::array<std::unique_ptr<RFieldBase>, 2> items{
413 Create("_0", innerTypes[0], options, desc, maybeGetChildId(0)).Unwrap(),
414 Create("_1", innerTypes[1], options, desc, maybeGetChildId(1)).Unwrap()};
415 result = std::make_unique<RPairField>(fieldName, std::move(items));
416 } else if (resolvedType.substr(0, 11) == "std::tuple<") {
417 auto innerTypes = TokenizeTypeList(resolvedType.substr(11, resolvedType.length() - 12));
418 std::vector<std::unique_ptr<RFieldBase>> items;
419 items.reserve(innerTypes.size());
420 for (unsigned int i = 0; i < innerTypes.size(); ++i) {
421 items.emplace_back(
422 Create("_" + std::to_string(i), innerTypes[i], options, desc, maybeGetChildId(i)).Unwrap());
423 }
424 result = std::make_unique<RTupleField>(fieldName, std::move(items));
425 } else if (resolvedType.substr(0, 12) == "std::bitset<") {
426 auto size = ParseUIntTypeToken(resolvedType.substr(12, resolvedType.length() - 13));
427 result = std::make_unique<RBitsetField>(fieldName, size);
428 } else if (resolvedType.substr(0, 16) == "std::unique_ptr<") {
429 std::string itemTypeName = resolvedType.substr(16, resolvedType.length() - 17);
430 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
431 auto normalizedInnerTypeName = itemField->GetTypeName();
432 result = std::make_unique<RUniquePtrField>(fieldName, "std::unique_ptr<" + normalizedInnerTypeName + ">",
433 std::move(itemField));
434 } else if (resolvedType.substr(0, 14) == "std::optional<") {
435 std::string itemTypeName = resolvedType.substr(14, resolvedType.length() - 15);
436 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
437 auto normalizedInnerTypeName = itemField->GetTypeName();
438 result = std::make_unique<ROptionalField>(fieldName, "std::optional<" + normalizedInnerTypeName + ">",
439 std::move(itemField));
440 } else if (resolvedType.substr(0, 9) == "std::set<") {
441 std::string itemTypeName = resolvedType.substr(9, resolvedType.length() - 10);
442 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
443 auto normalizedInnerTypeName = itemField->GetTypeName();
444 result =
445 std::make_unique<RSetField>(fieldName, "std::set<" + normalizedInnerTypeName + ">", std::move(itemField));
446 } else if (resolvedType.substr(0, 19) == "std::unordered_set<") {
447 std::string itemTypeName = resolvedType.substr(19, resolvedType.length() - 20);
448 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
449 auto normalizedInnerTypeName = itemField->GetTypeName();
450 result = std::make_unique<RSetField>(fieldName, "std::unordered_set<" + normalizedInnerTypeName + ">",
451 std::move(itemField));
452 } else if (resolvedType.substr(0, 14) == "std::multiset<") {
453 std::string itemTypeName = resolvedType.substr(14, resolvedType.length() - 15);
454 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
455 auto normalizedInnerTypeName = itemField->GetTypeName();
456 result = std::make_unique<RSetField>(fieldName, "std::multiset<" + normalizedInnerTypeName + ">",
457 std::move(itemField));
458 } else if (resolvedType.substr(0, 24) == "std::unordered_multiset<") {
459 std::string itemTypeName = resolvedType.substr(24, resolvedType.length() - 25);
460 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
461 auto normalizedInnerTypeName = itemField->GetTypeName();
462 result = std::make_unique<RSetField>(fieldName, "std::unordered_multiset<" + normalizedInnerTypeName + ">",
463 std::move(itemField));
464 } else if (resolvedType.substr(0, 9) == "std::map<") {
465 auto innerTypes = TokenizeTypeList(resolvedType.substr(9, resolvedType.length() - 10));
466 if (innerTypes.size() != 2) {
467 return R__FORWARD_RESULT(fnFail("the type list for std::map must have exactly two elements"));
468 }
469
470 auto itemField =
471 Create("_0", "std::pair<" + innerTypes[0] + "," + innerTypes[1] + ">", options, desc, maybeGetChildId(0))
472 .Unwrap();
473
474 // We use the type names of subfields of the newly created item fields to create the map's type name to
475 // ensure the inner type names are properly normalized.
476 auto keyTypeName = itemField->GetConstSubfields()[0]->GetTypeName();
477 auto valueTypeName = itemField->GetConstSubfields()[1]->GetTypeName();
478
479 result = std::make_unique<RMapField>(fieldName, "std::map<" + keyTypeName + "," + valueTypeName + ">",
480 std::move(itemField));
481 } else if (resolvedType.substr(0, 19) == "std::unordered_map<") {
482 auto innerTypes = TokenizeTypeList(resolvedType.substr(19, resolvedType.length() - 20));
483 if (innerTypes.size() != 2)
484 return R__FORWARD_RESULT(fnFail("the type list for std::unordered_map must have exactly two elements"));
485
486 auto itemField =
487 Create("_0", "std::pair<" + innerTypes[0] + "," + innerTypes[1] + ">", options, desc, maybeGetChildId(0))
488 .Unwrap();
489
490 // We use the type names of subfields of the newly created item fields to create the map's type name to
491 // ensure the inner type names are properly normalized.
492 auto keyTypeName = itemField->GetConstSubfields()[0]->GetTypeName();
493 auto valueTypeName = itemField->GetConstSubfields()[1]->GetTypeName();
494
495 result = std::make_unique<RMapField>(
496 fieldName, "std::unordered_map<" + keyTypeName + "," + valueTypeName + ">", std::move(itemField));
497 } else if (resolvedType.substr(0, 14) == "std::multimap<") {
498 auto innerTypes = TokenizeTypeList(resolvedType.substr(14, resolvedType.length() - 15));
499 if (innerTypes.size() != 2)
500 return R__FORWARD_RESULT(fnFail("the type list for std::multimap must have exactly two elements"));
501
502 auto itemField =
503 Create("_0", "std::pair<" + innerTypes[0] + "," + innerTypes[1] + ">", options, desc, maybeGetChildId(0))
504 .Unwrap();
505
506 // We use the type names of subfields of the newly created item fields to create the map's type name to
507 // ensure the inner type names are properly normalized.
508 auto keyTypeName = itemField->GetConstSubfields()[0]->GetTypeName();
509 auto valueTypeName = itemField->GetConstSubfields()[1]->GetTypeName();
510
511 result = std::make_unique<RMapField>(fieldName, "std::multimap<" + keyTypeName + "," + valueTypeName + ">",
512 std::move(itemField));
513 } else if (resolvedType.substr(0, 24) == "std::unordered_multimap<") {
514 auto innerTypes = TokenizeTypeList(resolvedType.substr(24, resolvedType.length() - 25));
515 if (innerTypes.size() != 2)
516 return R__FORWARD_RESULT(
517 fnFail("the type list for std::unordered_multimap must have exactly two elements"));
518
519 auto itemField =
520 Create("_0", "std::pair<" + innerTypes[0] + "," + innerTypes[1] + ">", options, desc, maybeGetChildId(0))
521 .Unwrap();
522
523 // We use the type names of subfields of the newly created item fields to create the map's type name to
524 // ensure the inner type names are properly normalized.
525 auto keyTypeName = itemField->GetConstSubfields()[0]->GetTypeName();
526 auto valueTypeName = itemField->GetConstSubfields()[1]->GetTypeName();
527
528 result = std::make_unique<RMapField>(
529 fieldName, "std::unordered_multimap<" + keyTypeName + "," + valueTypeName + ">", std::move(itemField));
530 } else if (resolvedType.substr(0, 12) == "std::atomic<") {
531 std::string itemTypeName = resolvedType.substr(12, resolvedType.length() - 13);
532 auto itemField = Create("_0", itemTypeName, options, desc, maybeGetChildId(0)).Unwrap();
533 auto normalizedInnerTypeName = itemField->GetTypeName();
534 result = std::make_unique<RAtomicField>(fieldName, "std::atomic<" + normalizedInnerTypeName + ">",
535 std::move(itemField));
536 } else if (resolvedType.substr(0, 25) == "ROOT::RNTupleCardinality<") {
537 auto innerTypes = TokenizeTypeList(resolvedType.substr(25, resolvedType.length() - 26));
538 if (innerTypes.size() != 1)
539 return R__FORWARD_RESULT(fnFail("invalid cardinality template: " + resolvedType));
541 if (canonicalInnerType == "std::uint32_t") {
542 result = std::make_unique<RField<RNTupleCardinality<std::uint32_t>>>(fieldName);
543 } else if (canonicalInnerType == "std::uint64_t") {
544 result = std::make_unique<RField<RNTupleCardinality<std::uint64_t>>>(fieldName);
545 } else {
546 return R__FORWARD_RESULT(fnFail("invalid cardinality template: " + resolvedType));
547 }
548 }
549
550 if (!result) {
551 auto e = TEnum::GetEnum(resolvedType.c_str());
552 if (e != nullptr) {
553 result = std::make_unique<REnumField>(fieldName, typeName);
554 }
555 }
556
557 if (!result) {
558 auto cl = TClass::GetClass(typeName.c_str());
559 // NOTE: if the class is not at least "Interpreted" we currently don't try to construct
560 // the RClassField, as in that case we'd need to fetch the information from the StreamerInfo
561 // rather than from TClass. This might be desirable in the future, but for now in this
562 // situation we rely on field emulation instead.
563 if (cl != nullptr && cl->GetState() >= TClass::kInterpreted) {
564 createContextGuard.AddClassToStack(resolvedType);
565 if (cl->GetCollectionProxy()) {
566 result = std::make_unique<RProxiedCollectionField>(fieldName, typeName);
567 } else {
570 result = std::make_unique<RStreamerField>(fieldName, typeName);
571 } else {
572 result = std::make_unique<RClassField>(fieldName, typeName);
573 }
574 }
575 } else if (options.GetEmulateUnknownTypes()) {
576 assert(desc);
577 const auto &fieldDesc = desc->GetFieldDescriptor(fieldId);
578
579 std::vector<std::unique_ptr<RFieldBase>> memberFields;
580 memberFields.reserve(fieldDesc.GetLinkIds().size());
581 for (auto id : fieldDesc.GetLinkIds()) {
582 const auto &memberDesc = desc->GetFieldDescriptor(id);
583 auto field = Create(memberDesc.GetFieldName(), memberDesc.GetTypeName(), options, desc, id).Unwrap();
584 memberFields.emplace_back(std::move(field));
585 }
586 R__ASSERT(typeName == fieldDesc.GetTypeName());
587 auto recordField =
589 recordField->fTypeAlias = fieldDesc.GetTypeAlias();
590 return recordField;
591 }
592 }
593 } catch (RException &e) {
594 auto error = e.GetError();
595 if (createContext.GetContinueOnError()) {
596 return std::unique_ptr<RFieldBase>(std::make_unique<RInvalidField>(fieldName, typeName, error.GetReport(),
598 } else {
599 return error;
600 }
601 } catch (std::logic_error &e) {
602 // Integer parsing error
603 if (createContext.GetContinueOnError()) {
604 return std::unique_ptr<RFieldBase>(
605 std::make_unique<RInvalidField>(fieldName, typeName, e.what(), RInvalidField::RCategory::kGeneric));
606 } else {
607 return R__FAIL(e.what());
608 }
609 }
610
611 if (result) {
613 if (normOrigType != result->GetTypeName()) {
614 result->fTypeAlias = normOrigType;
615 }
616 return result;
617 }
618 return R__FORWARD_RESULT(fnFail("unknown type: " + typeName, RInvalidField::RCategory::kUnknownType));
619}
620
626
627std::unique_ptr<ROOT::RFieldBase> ROOT::RFieldBase::Clone(std::string_view newName) const
628{
629 auto clone = CloneImpl(newName);
630 clone->fTypeAlias = fTypeAlias;
631 clone->fOnDiskId = fOnDiskId;
632 clone->fDescription = fDescription;
633 // We can just copy the references because fColumnRepresentatives point into a static structure
634 clone->fColumnRepresentatives = fColumnRepresentatives;
635 return clone;
636}
637
638std::size_t ROOT::RFieldBase::AppendImpl(const void * /* from */)
639{
640 R__ASSERT(false && "A non-simple RField must implement its own AppendImpl");
641 return 0;
642}
643
645{
646 R__ASSERT(false);
647}
648
650{
651 ReadGlobalImpl(fPrincipalColumn->GetGlobalIndex(localIndex), to);
652}
653
655{
656 const auto valueSize = GetValueSize();
657 std::size_t nRead = 0;
658 for (std::size_t i = 0; i < bulkSpec.fCount; ++i) {
659 // Value not needed
660 if (bulkSpec.fMaskReq && !bulkSpec.fMaskReq[i])
661 continue;
662
663 // Value already present
664 if (bulkSpec.fMaskAvail[i])
665 continue;
666
667 Read(bulkSpec.fFirstIndex + i, reinterpret_cast<unsigned char *>(bulkSpec.fValues) + i * valueSize);
668 bulkSpec.fMaskAvail[i] = true;
669 nRead++;
670 }
671 return nRead;
672}
673
675{
676 void *where = operator new(GetValueSize());
677 R__ASSERT(where != nullptr);
678 ConstructValue(where);
679 return where;
680}
681
683{
684 void *obj = CreateObjectRawPtr();
685 return RValue(this, std::shared_ptr<void>(obj, RSharedPtrDeleter(GetDeleter())));
686}
687
688std::vector<ROOT::RFieldBase::RValue> ROOT::RFieldBase::SplitValue(const RValue & /*value*/) const
689{
690 return std::vector<RValue>();
691}
692
693void ROOT::RFieldBase::Attach(std::unique_ptr<ROOT::RFieldBase> child)
694{
695 // Note that during a model update, new fields will be attached to the zero field. The zero field, however,
696 // does not change its inital state because only its sub fields get connected by RPageSink::UpdateSchema.
697 if (fState != EState::kUnconnected)
698 throw RException(R__FAIL("invalid attempt to attach subfield to already connected field"));
699 child->fParent = this;
700 fSubfields.emplace_back(std::move(child));
701}
702
704{
705 std::size_t result = globalIndex;
706 for (auto f = this; f != nullptr; f = f->GetParent()) {
707 auto parent = f->GetParent();
708 if (parent && (parent->GetStructure() == ROOT::ENTupleStructure::kCollection ||
709 parent->GetStructure() == ROOT::ENTupleStructure::kVariant)) {
710 return 0U;
711 }
712 result *= std::max(f->GetNRepetitions(), std::size_t{1U});
713 }
714 return result;
715}
716
717std::vector<ROOT::RFieldBase *> ROOT::RFieldBase::GetMutableSubfields()
718{
719 std::vector<RFieldBase *> result;
720 result.reserve(fSubfields.size());
721 for (const auto &f : fSubfields) {
722 result.emplace_back(f.get());
723 }
724 return result;
725}
726
727std::vector<const ROOT::RFieldBase *> ROOT::RFieldBase::GetConstSubfields() const
728{
729 std::vector<const RFieldBase *> result;
730 result.reserve(fSubfields.size());
731 for (const auto &f : fSubfields) {
732 result.emplace_back(f.get());
733 }
734 return result;
735}
736
738{
739 if (!fAvailableColumns.empty()) {
740 const auto activeRepresentationIndex = fPrincipalColumn->GetRepresentationIndex();
741 for (auto &column : fAvailableColumns) {
742 if (column->GetRepresentationIndex() == activeRepresentationIndex) {
743 column->Flush();
744 }
745 }
746 }
747}
748
750{
751 if (!fAvailableColumns.empty()) {
752 const auto activeRepresentationIndex = fPrincipalColumn->GetRepresentationIndex();
753 for (auto &column : fAvailableColumns) {
754 if (column->GetRepresentationIndex() == activeRepresentationIndex) {
755 column->Flush();
756 } else {
757 column->CommitSuppressed();
758 }
759 }
760 }
761 CommitClusterImpl();
762}
763
765{
766 if (fState != EState::kUnconnected)
767 throw RException(R__FAIL("cannot set field description once field is connected"));
768 fDescription = std::string(description);
769}
770
772{
773 if (fState != EState::kUnconnected)
774 throw RException(R__FAIL("cannot set field ID once field is connected"));
775 fOnDiskId = id;
776}
777
778/// Write the given value into columns. The value object has to be of the same type as the field.
779/// Returns the number of uncompressed bytes written.
780std::size_t ROOT::RFieldBase::Append(const void *from)
781{
782 if (~fTraits & kTraitMappable)
783 return AppendImpl(from);
784
785 fPrincipalColumn->Append(from);
786 return fPrincipalColumn->GetElement()->GetPackedSize();
787}
788
793
795{
796 return RValue(this, objPtr);
797}
798
800{
801 if (fIsSimple) {
802 /// For simple types, ignore the mask and memcopy the values into the destination
803 fPrincipalColumn->ReadV(bulkSpec.fFirstIndex, bulkSpec.fCount, bulkSpec.fValues);
804 std::fill(bulkSpec.fMaskAvail, bulkSpec.fMaskAvail + bulkSpec.fCount, true);
805 return RBulkSpec::kAllSet;
806 }
807
808 return ReadBulkImpl(bulkSpec);
809}
810
812{
813 return fSubfields.empty() ? RSchemaIterator(this, -1) : RSchemaIterator(fSubfields[0].get(), 0);
814}
815
820
822{
823 return fSubfields.empty() ? RConstSchemaIterator(this, -1) : RConstSchemaIterator(fSubfields[0].get(), 0);
824}
825
830
832{
833 return fSubfields.empty() ? RConstSchemaIterator(this, -1) : RConstSchemaIterator(fSubfields[0].get(), 0);
834}
835
840
842{
843 if (fColumnRepresentatives.empty()) {
844 return {GetColumnRepresentations().GetSerializationDefault()};
845 }
846
848 result.reserve(fColumnRepresentatives.size());
849 for (const auto &r : fColumnRepresentatives) {
850 result.emplace_back(r.get());
851 }
852 return result;
853}
854
856{
857 if (fState != EState::kUnconnected)
858 throw RException(R__FAIL("cannot set column representative once field is connected"));
859 const auto &validTypes = GetColumnRepresentations().GetSerializationTypes();
860 fColumnRepresentatives.clear();
861 fColumnRepresentatives.reserve(representatives.size());
862 for (const auto &r : representatives) {
863 auto itRepresentative = std::find(validTypes.begin(), validTypes.end(), r);
864 if (itRepresentative == std::end(validTypes))
865 throw RException(R__FAIL("invalid column representative"));
866
867 // don't add a duplicate representation
868 if (std::find_if(fColumnRepresentatives.begin(), fColumnRepresentatives.end(),
869 [&r](const auto &rep) { return r == rep.get(); }) == fColumnRepresentatives.end())
870 fColumnRepresentatives.emplace_back(*itRepresentative);
871 }
872}
873
876 std::uint16_t representationIndex) const
877{
878 static const ColumnRepresentation_t kEmpty;
879
880 if (fOnDiskId == ROOT::kInvalidDescriptorId)
881 throw RException(R__FAIL("No on-disk field information for `" + GetQualifiedFieldName() + "`"));
882
884 for (const auto &c : desc.GetColumnIterable(fOnDiskId)) {
885 if (c.GetRepresentationIndex() == representationIndex)
886 onDiskTypes.emplace_back(c.GetType());
887 }
888 if (onDiskTypes.empty()) {
889 if (representationIndex == 0) {
890 throw RException(R__FAIL("No on-disk column information for field `" + GetQualifiedFieldName() + "`"));
891 }
892 return kEmpty;
893 }
894
895 for (const auto &t : GetColumnRepresentations().GetDeserializationTypes()) {
896 if (t == onDiskTypes)
897 return t;
898 }
899
900 std::string columnTypeNames;
901 for (const auto &t : onDiskTypes) {
902 if (!columnTypeNames.empty())
903 columnTypeNames += ", ";
905 }
906 throw RException(R__FAIL("On-disk column types {" + columnTypeNames + "} for field `" + GetQualifiedFieldName() +
907 "` cannot be matched to its in-memory type `" + GetTypeName() + "` " +
908 "(representation index: " + std::to_string(representationIndex) + ")"));
909}
910
912{
913 fReadCallbacks.push_back(func);
914 fIsSimple = false;
915 return fReadCallbacks.size() - 1;
916}
917
919{
920 fReadCallbacks.erase(fReadCallbacks.begin() + idx);
921 fIsSimple = (fTraits & kTraitMappable) && !fIsArtificial && fReadCallbacks.empty();
922}
923
949
951{
952 if (dynamic_cast<ROOT::RFieldZero *>(this))
953 throw RException(R__FAIL("invalid attempt to connect zero field to page sink"));
954 if (fState != EState::kUnconnected)
955 throw RException(R__FAIL("invalid attempt to connect an already connected field to a page sink"));
956
957 AutoAdjustColumnTypes(pageSink.GetWriteOptions());
958
959 GenerateColumns();
960 for (auto &column : fAvailableColumns) {
961 // Only the first column of every representation can be a deferred column. In all column representations,
962 // larger column indexes are data columns of collections (string, streamer) and thus
963 // they have no elements on late model extension
964 auto firstElementIndex = (column->GetIndex() == 0) ? EntryToColumnElementIndex(firstEntry) : 0;
965 column->ConnectPageSink(fOnDiskId, pageSink, firstElementIndex);
966 }
967
968 if (HasExtraTypeInfo()) {
969 pageSink.RegisterOnCommitDatasetCallback(
970 [this](ROOT::Experimental::Internal::RPageSink &sink) { sink.UpdateExtraTypeInfo(GetExtraTypeInfo()); });
971 }
972
973 fState = EState::kConnectedToSink;
974}
975
977{
978 if (dynamic_cast<ROOT::RFieldZero *>(this))
979 throw RException(R__FAIL("invalid attempt to connect zero field to page source"));
980 if (fState != EState::kUnconnected)
981 throw RException(R__FAIL("invalid attempt to connect an already connected field to a page source"));
982
983 if (!fColumnRepresentatives.empty())
984 throw RException(R__FAIL("fixed column representative only valid when connecting to a page sink"));
985 if (!fDescription.empty())
986 throw RException(R__FAIL("setting description only valid when connecting to a page sink"));
987
988 BeforeConnectPageSource(pageSource);
989
990 for (auto &f : fSubfields) {
991 if (f->GetOnDiskId() == ROOT::kInvalidDescriptorId) {
992 f->SetOnDiskId(pageSource.GetSharedDescriptorGuard()->FindFieldId(f->GetFieldName(), GetOnDiskId()));
993 }
994 f->ConnectPageSource(pageSource);
995 }
996
997 // Do not generate columns nor set fColumnRepresentatives for artificial fields.
998 if (!fIsArtificial) {
999 const auto descriptorGuard = pageSource.GetSharedDescriptorGuard();
1000 const ROOT::RNTupleDescriptor &desc = descriptorGuard.GetRef();
1001 GenerateColumns(desc);
1002 if (fColumnRepresentatives.empty()) {
1003 // If we didn't get columns from the descriptor, ensure that we actually expect a field without columns
1004 for (const auto &t : GetColumnRepresentations().GetDeserializationTypes()) {
1005 if (t.empty()) {
1006 fColumnRepresentatives = {t};
1007 break;
1008 }
1009 }
1010 }
1011 R__ASSERT(!fColumnRepresentatives.empty());
1012 if (fOnDiskId != ROOT::kInvalidDescriptorId) {
1013 const auto &fieldDesc = desc.GetFieldDescriptor(fOnDiskId);
1014 fOnDiskTypeVersion = fieldDesc.GetTypeVersion();
1015 if (fieldDesc.GetTypeChecksum().has_value())
1016 fOnDiskTypeChecksum = *fieldDesc.GetTypeChecksum();
1017 }
1018 }
1019 for (auto &column : fAvailableColumns)
1020 column->ConnectPageSource(fOnDiskId, pageSource);
1021
1022 AfterConnectPageSource();
1023
1024 fState = EState::kConnectedToSource;
1025}
1026
1028{
1029 visitor.VisitField(*this);
1030}
size_t fValueSize
dim_t fSize
#define R__FORWARD_RESULT(res)
Short-hand to return an RResult<T> value from a subroutine to the calling stack frame.
Definition RError.hxx:301
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:299
#define R__LOG_WARNING(...)
Definition RLogger.hxx:358
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
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 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
char name[80]
Definition TGX11.cxx:110
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.
static const char * GetColumnTypeName(ROOT::ENTupleColumnType type)
Base class for all ROOT issued exceptions.
Definition RError.hxx:79
Points to an array of objects with RNTuple I/O support, used for bulk reading.
RBulk(RFieldBase *field)
void Reset(RNTupleLocalIndex firstIndex, std::size_t size)
Sets a new range for the bulk.
std::unique_ptr< RFieldBase::RDeleter > fDeleter
RBulk & operator=(const RBulk &)=delete
void * fValues
Cached deleter of fField.
std::unique_ptr< bool[]> fMaskAvail
Masks invalid values in the array.
void AdoptBuffer(void *buf, std::size_t capacity)
The list of column representations a field can have.
std::vector< ColumnRepresentation_t > Selection_t
A list of column representations.
Selection_t fDeserializationTypes
The union of the serialization types and the deserialization extra types passed during construction.
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
void BindRawPtr(void *rawPtr)
A field translates read and write calls from/to underlying columns to/from tree values.
RSchemaIterator end()
void SetColumnRepresentatives(const RColumnRepresentations::Selection_t &representatives)
Fixes a column representative.
ROOT::Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
ROOT::NTupleSize_t EntryToColumnElementIndex(ROOT::NTupleSize_t globalIndex) const
Translate an entry index to a column element index of the principal column and vice versa.
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
virtual void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const
void FlushColumns()
Flushes data from active columns.
virtual void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to)
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
RBulk CreateBulk()
Creates a new, initially empty bulk.
bool fIsSimple
A field qualifies as simple if it is mappable (which implies it has a single principal column),...
RConstSchemaIterator cbegin() const
void AutoAdjustColumnTypes(const ROOT::RNTupleWriteOptions &options)
When connecting a field to a page sink, the field's default column representation is subject to adjus...
std::vector< const RFieldBase * > GetConstSubfields() const
void SetOnDiskId(ROOT::DescriptorId_t id)
void RemoveReadCallback(size_t idx)
std::vector< RFieldBase * > GetMutableSubfields()
static std::vector< RCheckResult > Check(const std::string &fieldName, const std::string &typeName)
Checks if the given type is supported by RNTuple.
RSchemaIterator begin()
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...
RConstSchemaIterator cend() const
std::size_t fNRepetitions
For fixed sized arrays, the array length.
std::function< void(void *)> ReadCallback_t
std::size_t Append(const void *from)
Write the given value into columns.
RValue CreateValue()
Generates an object of the field's type, wraps it in a shared pointer and returns it as an RValue con...
const ColumnRepresentation_t & EnsureCompatibleColumnTypes(const ROOT::RNTupleDescriptor &desc, std::uint16_t representationIndex) const
Returns the on-disk column types found in the provided descriptor for fOnDiskId and the given represe...
virtual std::vector< RValue > SplitValue(const RValue &value) const
Creates the list of direct child values given an existing value for this field.
std::string GetQualifiedFieldName() const
Returns the field name and parent field names separated by dots (grandparent.parent....
std::size_t ReadBulk(const RBulkSpec &bulkSpec)
Returns the number of newly available values, that is the number of bools in bulkSpec....
std::vector< ROOT::ENTupleColumnType > ColumnRepresentation_t
void ConnectPageSource(ROOT::Experimental::Internal::RPageSource &pageSource)
Connects the field and its subfield tree to the given page source.
virtual void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to)
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
virtual std::size_t AppendImpl(const void *from)
Operations on values of complex types, e.g.
RFieldBase * fParent
Subfields point to their mother field.
RFieldBase(std::string_view name, std::string_view type, ROOT::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.
@ kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
@ kTraitTriviallyConstructible
No constructor needs to be called, i.e.
@ kTraitMappable
A field of a fundamental type that can be directly mapped via RField<T>::Map(), i....
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &typeName, const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
Factory method to resurrect a field from the stored on-disk type information.
std::string fType
The C++ type captured by this field.
RColumnRepresentations::Selection_t GetColumnRepresentatives() const
Returns the fColumnRepresentative pointee or, if unset (always the case for artificial fields),...
ROOT::ENTupleStructure fStructure
The role of this field in the data model structure.
void ConnectPageSink(ROOT::Experimental::Internal::RPageSink &pageSink, ROOT::NTupleSize_t firstEntry=0)
Fields and their columns live in the void until connected to a physical page storage.
RValue BindValue(std::shared_ptr< void > objPtr)
Creates a value from a memory location with an already constructed object.
void SetDescription(std::string_view description)
std::unique_ptr< RFieldBase > Clone(std::string_view newName) const
Copies the field and its subfields using a possibly new name and a new, unconnected set of columns.
std::string fName
The field name relative to its parent field.
void CommitCluster()
Flushes data from active columns to disk and calls CommitClusterImpl()
void * CreateObjectRawPtr() const
Factory method for the field's type. The caller owns the returned pointer.
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
The container field for an ntuple model, which itself has no physical representation.
Definition RField.hxx:56
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:74
@ kGeneric
Generic unrecoverable error.
@ kUnknownType
The type given to RFieldBase::Create was unknown.
@ kTypeError
The type given to RFieldBase::Create was invalid.
The on-storage metadata of an RNTuple.
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) const
RColumnDescriptorIterable GetColumnIterable() const
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Common user-tunable settings for storing RNTuples.
std::uint32_t GetCompression() const
const_iterator begin() const
const_iterator end() const
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
Definition RError.hxx:197
@ kInterpreted
Definition TClass.h:129
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:3069
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition TEnum.cxx:182
std::tuple< std::string, std::vector< std::size_t > > ParseArrayType(const std::string &typeName)
Parse a type name of the form T[n][m]... and return the base type T and a vector that contains,...
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
ROOT::RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
void CallCommitClusterOnField(RFieldBase &)
unsigned long long ParseUIntTypeToken(const std::string &uintToken)
ROOT::RResult< std::unique_ptr< ROOT::RFieldBase > > CallFieldBaseCreate(const std::string &fieldName, const std::string &typeName, const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
ERNTupleSerializationMode GetRNTupleSerializationMode(TClass *cl)
void CallConnectPageSinkOnField(RFieldBase &, ROOT::Experimental::Internal::RPageSink &, ROOT::NTupleSize_t firstEntry=0)
auto MakeAliasedSharedPtr(T *rawPtr)
std::string GetCanonicalTypePrefix(const std::string &typeName)
Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in RF...
void CallFlushColumnsOnField(RFieldBase &)
std::unique_ptr< RFieldBase > CreateEmulatedField(std::string_view fieldName, std::vector< std::unique_ptr< RFieldBase > > itemFields, std::string_view emulatedFromType)
Definition RField.cxx:515
std::string GetNormalizedUnresolvedTypeName(const std::string &origName)
Applies all RNTuple type normalization rules except typedef resolution.
void CallConnectPageSourceOnField(RFieldBase &, ROOT::Experimental::Internal::RPageSource &)
std::vector< std::string > TokenizeTypeList(std::string_view templateType)
Used in RFieldBase::Create() in order to get the comma-separated list of template types E....
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().
Used in the return value of the Check() method.