Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RFieldUtils.hxx
Go to the documentation of this file.
1/// \file RFieldUtils.hxx
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#ifndef ROOT7_RFieldUtils
9#define ROOT7_RFieldUtils
10
11#include <string>
12#include <string_view>
13#include <tuple>
14#include <vector>
15
16class TClass;
17
18namespace ROOT {
19namespace Experimental {
20namespace Internal {
21
22/// Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in
23/// RFieldBase::Create(). The normalization of templated types does not include full normalization of the
24/// template arguments (hence "Prefix").
25std::string GetCanonicalTypePrefix(const std::string &typeName);
26
27/// Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
28std::string GetRenormalizedTypeName(const std::string &metaNormalizedName);
29
30/// Applies all RNTuple type normalization rules except typedef resolution.
31std::string GetNormalizedUnresolvedTypeName(const std::string &origName);
32
33/// Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
34std::string GetNormalizedInteger(const std::string &intTemplateArg);
35std::string GetNormalizedInteger(long long val);
36std::string GetNormalizedInteger(unsigned long long val);
37long long ParseIntTypeToken(const std::string &intToken);
38unsigned long long ParseUIntTypeToken(const std::string &uintToken);
39
40/// Possible settings for the "rntuple.streamerMode" class attribute in the dictionary.
42
44
45/// Parse a type name of the form `T[n][m]...` and return the base type `T` and a vector that contains,
46/// in order, the declared size for each dimension, e.g. for `unsigned char[1][2][3]` it returns the tuple
47/// `{"unsigned char", {1, 2, 3}}`. Extra whitespace in `typeName` should be removed before calling this function.
48///
49/// If `typeName` is not an array type, it returns a tuple `{T, {}}`. On error, it returns a default-constructed tuple.
50std::tuple<std::string, std::vector<std::size_t>> ParseArrayType(const std::string &typeName);
51
52/// Used in RFieldBase::Create() in order to get the comma-separated list of template types
53/// E.g., gets {"int", "std::variant<double,int>"} from "int,std::variant<double,int>".
54/// TODO(jblomer): Try to merge with TClassEdit::TSplitType
55std::vector<std::string> TokenizeTypeList(std::string_view templateType);
56
57} // namespace Internal
58
59} // namespace Experimental
60} // namespace ROOT
61
62#endif
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
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::string GetCanonicalTypePrefix(const std::string &typeName)
Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in RF...
ERNTupleSerializationMode
Possible settings for the "rntuple.streamerMode" class attribute in the dictionary.
std::string GetNormalizedInteger(const std::string &intTemplateArg)
Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
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,...
ERNTupleSerializationMode GetRNTupleSerializationMode(TClass *cl)
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
std::string GetNormalizedUnresolvedTypeName(const std::string &origName)
Applies all RNTuple type normalization rules except typedef resolution.
unsigned long long ParseUIntTypeToken(const std::string &uintToken)
long long ParseIntTypeToken(const std::string &intToken)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...