Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
RFieldUtils.hxx
Go to the documentation of this file.
1/// \file RFieldUtils.hxx
2/// \ingroup NTuple
3/// \author Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
4/// \date 2024-11-19
5
6#ifndef ROOT_RFieldUtils
7#define ROOT_RFieldUtils
8
9#include <string>
10#include <string_view>
11#include <typeinfo>
12#include <tuple>
13#include <vector>
14
15class TClass;
16
17namespace ROOT {
18namespace Internal {
19
20/// Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in
21/// RFieldBase::Create(). The normalization of templated types does not include full normalization of the
22/// template arguments (hence "Prefix").
23std::string GetCanonicalTypePrefix(const std::string &typeName);
24
25/// Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
26std::string GetRenormalizedTypeName(const std::string &metaNormalizedName);
27
28/// Given a type info ask ROOT meta to demangle it, then renormalize the resulting type name for RNTuple. Useful to
29/// ensure that e.g. fundamental types are normalized to the type used by RNTuple (e.g. int -> std::int32_t).
30std::string GetRenormalizedDemangledTypeName(const std::type_info &ti);
31
32/// Applies all RNTuple type normalization rules except typedef resolution.
33std::string GetNormalizedUnresolvedTypeName(const std::string &origName);
34
35/// Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
36std::string GetNormalizedInteger(const std::string &intTemplateArg);
37std::string GetNormalizedInteger(long long val);
38std::string GetNormalizedInteger(unsigned long long val);
39long long ParseIntTypeToken(const std::string &intToken);
40unsigned long long ParseUIntTypeToken(const std::string &uintToken);
41
42/// Possible settings for the "rntuple.streamerMode" class attribute in the dictionary.
48
50
51/// Parse a type name of the form `T[n][m]...` and return the base type `T` and a vector that contains,
52/// in order, the declared size for each dimension, e.g. for `unsigned char[1][2][3]` it returns the tuple
53/// `{"unsigned char", {1, 2, 3}}`. Extra whitespace in `typeName` should be removed before calling this function.
54///
55/// If `typeName` is not an array type, it returns a tuple `{T, {}}`. On error, it returns a default-constructed tuple.
56std::tuple<std::string, std::vector<std::size_t>> ParseArrayType(const std::string &typeName);
57
58/// Used in RFieldBase::Create() in order to get the comma-separated list of template types
59/// E.g., gets {"int", "std::variant<double,int>"} from "int,std::variant<double,int>".
60/// TODO(jblomer): Try to merge with TClassEdit::TSplitType
61std::vector<std::string> TokenizeTypeList(std::string_view templateType);
62
63} // namespace Internal
64} // namespace ROOT
65
66#endif
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
ERNTupleSerializationMode
Possible settings for the "rntuple.streamerMode" class attribute in the dictionary.
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,...
unsigned long long ParseUIntTypeToken(const std::string &uintToken)
std::string GetNormalizedInteger(const std::string &intTemplateArg)
Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
ERNTupleSerializationMode GetRNTupleSerializationMode(TClass *cl)
std::string GetCanonicalTypePrefix(const std::string &typeName)
Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in RF...
std::string GetNormalizedUnresolvedTypeName(const std::string &origName)
Applies all RNTuple type normalization rules except typedef resolution.
std::string GetRenormalizedDemangledTypeName(const std::type_info &ti)
Given a type info ask ROOT meta to demangle it, then renormalize the resulting type name for RNTuple.
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::vector< std::string > TokenizeTypeList(std::string_view templateType)
Used in RFieldBase::Create() in order to get the comma-separated list of template types E....
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...