Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JRootPrimitiveTypes.hh
Go to the documentation of this file.
1 #ifndef __JROOT_PRIMITIVE_TYPES__
2 #define __JROOT_PRIMITIVE_TYPES__
3 
4 #include <string>
5 #include <utility>
6 #include <vector>
7 
8 namespace JROOT {}
9 namespace JPP { using namespace JROOT; }
10 
11 namespace JROOT {
12 
14  {
15  /** Return the type code (used to create primitive leaves in basic
16  * Root tree branches) corresponding to the type name.
17  *
18  * If the type_name does not correspond to a primitive type (known to
19  * Root), then an empty string is returned.
20  */
21  static std::string getTypeCode(const std::string& type_name)
22  {
24  {"char[]", "C"},
25  {"char", "B"},
26  {"unsigned char", "b"},
27  {"short", "S"},
28  {"unsigned short", "s"},
29  {"unsigned int", "i"},
30  {"int", "I"},
31  {"float", "F"},
32  {"Float16_t", "f"},
33  {"double", "D"},
34  {"Double32_t", "d"},
35  {"Long64_t", "L"},
36  {"ULong64_t", "l"},
37  {"long", "G"},
38  {"unsigned long", "g"},
39  {"bool", "O"}};
40  std::string type_code;
41  for (const auto& type2code : type_codes) {
42  if (type2code.first == type_name) {
43  type_code = type2code.second;
44  }
45  }
46  return type_code;
47  }
48  };
49 } // namespace JROOT
50 
51 #endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
static std::string getTypeCode(const std::string &type_name)
Return the type code (used to create primitive leaves in basic Root tree branches) corresponding to t...