![]() |
|
|||
File indexing completed on 2025-09-17 09:14:27
0001 /// \file RFieldUtils.hxx 0002 /// \ingroup NTuple 0003 /// \author Jonas Hahnfeld <jonas.hahnfeld@cern.ch> 0004 /// \date 2024-11-19 0005 0006 #ifndef ROOT_RFieldUtils 0007 #define ROOT_RFieldUtils 0008 0009 #include <string> 0010 #include <string_view> 0011 #include <typeinfo> 0012 #include <tuple> 0013 #include <vector> 0014 0015 class TClass; 0016 0017 namespace ROOT { 0018 namespace Internal { 0019 0020 /// Applies RNTuple specific type name normalization rules (see specs) that help the string parsing in 0021 /// RFieldBase::Create(). The normalization of templated types does not include full normalization of the 0022 /// template arguments (hence "Prefix"). 0023 std::string GetCanonicalTypePrefix(const std::string &typeName); 0024 0025 /// Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix. 0026 std::string GetRenormalizedTypeName(const std::string &metaNormalizedName); 0027 0028 /// Given a type info ask ROOT meta to demangle it, then renormalize the resulting type name for RNTuple. Useful to 0029 /// ensure that e.g. fundamental types are normalized to the type used by RNTuple (e.g. int -> std::int32_t). 0030 std::string GetRenormalizedDemangledTypeName(const std::type_info &ti); 0031 0032 /// Applies all RNTuple type normalization rules except typedef resolution. 0033 std::string GetNormalizedUnresolvedTypeName(const std::string &origName); 0034 0035 /// Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed. 0036 std::string GetNormalizedInteger(const std::string &intTemplateArg); 0037 std::string GetNormalizedInteger(long long val); 0038 std::string GetNormalizedInteger(unsigned long long val); 0039 long long ParseIntTypeToken(const std::string &intToken); 0040 unsigned long long ParseUIntTypeToken(const std::string &uintToken); 0041 0042 /// Possible settings for the "rntuple.streamerMode" class attribute in the dictionary. 0043 enum class ERNTupleSerializationMode { 0044 kForceNativeMode, 0045 kForceStreamerMode, 0046 kUnset 0047 }; 0048 0049 ERNTupleSerializationMode GetRNTupleSerializationMode(TClass *cl); 0050 0051 /// Parse a type name of the form `T[n][m]...` and return the base type `T` and a vector that contains, 0052 /// in order, the declared size for each dimension, e.g. for `unsigned char[1][2][3]` it returns the tuple 0053 /// `{"unsigned char", {1, 2, 3}}`. Extra whitespace in `typeName` should be removed before calling this function. 0054 /// 0055 /// If `typeName` is not an array type, it returns a tuple `{T, {}}`. On error, it returns a default-constructed tuple. 0056 std::tuple<std::string, std::vector<std::size_t>> ParseArrayType(const std::string &typeName); 0057 0058 /// Used in RFieldBase::Create() in order to get the comma-separated list of template types 0059 /// E.g., gets {"int", "std::variant<double,int>"} from "int,std::variant<double,int>". 0060 /// TODO(jblomer): Try to merge with TClassEdit::TSplitType 0061 std::vector<std::string> TokenizeTypeList(std::string_view templateType); 0062 0063 } // namespace Internal 0064 } // namespace ROOT 0065 0066 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |