Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RtypesCore.h
Go to the documentation of this file.
1/* @(#)root/foundation:$Id$ */
2
3/*************************************************************************
4 * Copyright (C) 1995-2014, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RtypesCore
12#define ROOT_RtypesCore
13
14//////////////////////////////////////////////////////////////////////////
15// //
16// RtypesCore //
17// //
18// Basic types used by ROOT and required by TInterpreter. //
19// //
20//////////////////////////////////////////////////////////////////////////
21
22/**
23 * \file
24 * \brief Basic types used by ROOT and required by TInterpreter.
25 * It ensures a portable fixed data type size across systems, since in
26 * the early days, sizeof(int) could be 2 or 4 depending on the architecture.
27 * \deprecated For future designs, unless for very specific needs, consider using instead standard
28 * fixed-width classes from <cstdint> such as `std::int16_t`, `std::int32_t` or from <cstdfloat> for floating types.
29 * \warning `Long_t` has not the same width across platforms, so it should be avoided if portability is envisioned.
30 * Also derived classes such as `TArrayL`. Use instead `Long64_t` or `TArrayL64`, or `std::int64_t`.
31 * Likewise with `ULong_t`.
32 * \warning In some architectures, `std::int64_t` may have a different underlying data type (long vs int) than in others
33 * and may lead to a different StreamerInfo than in others, thus it might be convenient to use (U)Long64_t instead.
34 * Hence, full fledge embrace of the std::types is actually waiting on ROOT I/O to be extended to support them explicitly.
35 */
36
37#include <ROOT/RConfig.hxx>
38
39#include "DllImport.h"
40
41#ifndef R__LESS_INCLUDES
42#include <cstddef> // size_t, NULL
43#endif
44
45//---- Tag used by rootcling to determine constructor used for I/O.
46
47class TRootIOCtor;
48
49//---- types -------------------------------------------------------------------
50
51typedef char Char_t; ///< Character 1 byte (char) \warning Can be signed (most common) or unsigned depending on platform and compiler flags. \deprecated Consider replacing with `char`, `signed char` or `std::int8_t`
52typedef unsigned char UChar_t; ///< Unsigned Character 1 byte (unsigned char) \deprecated Consider replacing with `unsigned char` or `std::uint8_t`
53typedef short Short_t; ///< Signed Short integer 2 bytes (short) \deprecated Consider replacing with `short` or `std::int16_t`
54typedef unsigned short UShort_t; ///< Unsigned Short integer 2 bytes (unsigned short) \deprecated Consider replacing with `unsigned short` or `std::uint16_t`
55#ifdef R__INT16
56typedef long Int_t; ///< Signed integer 4 bytes \deprecated Consider replacing with `std::int32_t`
57typedef unsigned long UInt_t; ///< Unsigned integer 4 bytes \deprecated Consider replacing with `std::int32_t`
58#else
59typedef int Int_t; ///< Signed integer 4 bytes (int) \deprecated Consider replacing with `std::int32_t`
60typedef unsigned int UInt_t; ///< Unsigned integer 4 bytes (unsigned int) \deprecated Consider replacing with `std::uint32_t`
61#endif
62#ifdef R__B64 // Note: Long_t and ULong_t are currently not portable types
63typedef int Seek_t; ///< File pointer (int).
64typedef long Long_t; ///< Signed long integer 8 bytes (long). Size depends on architecture \deprecated Consider replacing with `long`
65typedef unsigned long ULong_t; ///< Unsigned long integer 8 bytes (unsigned long). Size depends on architecture \deprecated Consider replacing with `unsigned long`
66#else
67typedef int Seek_t; ///< File pointer (int).
68typedef long Long_t; ///< Signed long integer 4 bytes (long). Size depends on architecture \deprecated Consider replacing with `long`
69typedef unsigned long ULong_t; ///< Unsigned long integer 4 bytes (unsigned long). Size depends on architecture \deprecated Consider replacing with `unsigned long`
70#endif
71typedef float Float_t; ///< Float 4 bytes (float) \deprecated Consider replacing with `float`.
72typedef float Float16_t; ///< Float 4 bytes in memory, written to disk as 3 bytes (24-bits) by default or as a 4 bytes fixed-point-arithmetic Int_t (32-bits) if range was customized, with a truncated mantissa (12-bit by default in memory), and (7+1)-bits of exponent \warning Do not confuse Float16_t on file representation with a half-float such as std::float16_t.
73typedef double Double_t; ///< Double 8 bytes \deprecated Consider replacing with `double`.
74typedef double Double32_t; ///< Double 8 bytes in memory, written to disk as a 4 bytes Float_t (32-bits) by default, or as 3 bytes (24-bits) float if range is customized, with a truncated mantissa (24-bit by default in memory, less if range is customized), and (7+1)-bits of exponent \warning Do not confuse Double32_t on file representation with a single-precision float such as std::float32_t
75typedef long double LongDouble_t;///< Long Double (not portable) \deprecated Consider replacing with `long double`.
76typedef char Text_t; ///< General string (char)
77typedef bool Bool_t; ///< Boolean (0=false, 1=true) (bool) \deprecated Consider replacing with `bool`.
78typedef unsigned char Byte_t; ///< Byte (8 bits) (unsigned char) \deprecated Consider replacing with `unsigned char` or `std::byte`.
79typedef short Version_t; ///< Class version identifier (short)
80typedef const char Option_t; ///< Option string (const char)
81typedef int Ssiz_t; ///< String size (currently int)
82typedef float Real_t; ///< TVector and TMatrix element type (float) \deprecated Consider replacing with `float`.
83typedef long long Long64_t;///< Portable signed long integer 8 bytes \deprecated Consider replacing with `long long` or `std::int64_t` (unless you are worried about different StreamerInfos in different platforms).
84typedef unsigned long long ULong64_t;///< Portable unsigned long integer 8 bytes \deprecated Consider replacing with `unsigned long long` or `std::uint64_t` (unless you are worried about different StreamerInfos in different platforms).
85#ifdef _WIN64
86typedef long long Longptr_t; ///< Integer large enough to hold a pointer (platform-dependent)
87typedef unsigned long long ULongptr_t;///< Unsigned integer large enough to hold a pointer (platform-dependent)
88#else
89typedef long Longptr_t; ///< Integer large enough to hold a pointer (platform-dependent)
90typedef unsigned long ULongptr_t; ///< Unsigned integer large enough to hold a pointer (platform-dependent)
91#endif
92typedef double Axis_t; ///< Axis values type (double)
93typedef double Stat_t; ///< Statistics type (double)
94
95typedef short Font_t; ///< Font number (short)
96typedef short Style_t; ///< Style number (short)
97typedef short Marker_t; ///< Marker number (short)
98typedef short Width_t; ///< Line width (short)
99typedef short Color_t; ///< Color number (short)
100typedef short SCoord_t; ///< Screen coordinates (short)
101typedef double Coord_t; ///< Pad world coordinates (double)
102typedef float Angle_t; ///< Graphics angle (float)
103typedef float Size_t; ///< Attribute size (float)
104
105//---- constants ---------------------------------------------------------------
106
107constexpr Bool_t kTRUE = true; ///< \deprecated Consider replacing with `true`
108constexpr Bool_t kFALSE = false;///< \deprecated Consider replacing with `false`
109
110constexpr Int_t kMaxUChar = UChar_t(~0); ///< \deprecated Consider replacing with `std::numeric_limits<unsigned char>::max()` (or `std::uint8_t`)
111constexpr Int_t kMaxChar = kMaxUChar >> 1;///< \deprecated Consider replacing with `std::numeric_limits<char>::max()` (or `std::int8_t`)
112constexpr Int_t kMinChar = -kMaxChar - 1; ///< \deprecated Consider replacing with `std::numeric_limits<char>::lowest()` (or `std::int8_t`)
113
114constexpr Int_t kMaxUShort = UShort_t(~0); ///< \deprecated Consider replacing with `std::numeric_limits<unsigned short>::max()` (or `std::uint16_t`)
115constexpr Int_t kMaxShort = kMaxUShort >> 1;///< \deprecated Consider replacing with `std::numeric_limits<short>::max()` (or `std::int16_t`)
116constexpr Int_t kMinShort = -kMaxShort - 1; ///< \deprecated Consider replacing with `std::numeric_limits<short>::lowest()` (or `std::int16_t`)
117
118constexpr UInt_t kMaxUInt = UInt_t(~0); ///< \deprecated Consider replacing with `std::numeric_limits<unsigned int>::max()` (or `std::uint32_t`)
119constexpr Int_t kMaxInt = Int_t(kMaxUInt >> 1);///< \deprecated Consider replacing with `std::numeric_limits<int>::max()` (or `std::int32_t`)
120constexpr Int_t kMinInt = -kMaxInt - 1; ///< \deprecated Consider replacing with `std::numeric_limits<int>::lowest()` (or `std::int32_t`)
121
122constexpr ULong_t kMaxULong = ULong_t(~0); ///< \deprecated Consider replacing with `std::numeric_limits<unsigned long>::max()`
123constexpr Long_t kMaxLong = Long_t(kMaxULong >> 1);///< \deprecated Consider replacing with `std::numeric_limits<long>::max()`
124constexpr Long_t kMinLong = -kMaxLong - 1; ///< \deprecated Consider replacing with `std::numeric_limits<long>::lowest()`
125
126constexpr ULong64_t kMaxULong64 = ULong64_t(~0LL); ///< \deprecated Consider replacing with `std::numeric_limits<unsigned long long>::max()` (or `std::uint64_t`)
127constexpr Long64_t kMaxLong64 = Long64_t(kMaxULong64 >> 1);///< \deprecated Consider replacing with `std::numeric_limits<long long>::max()` (or `std::int64_t`)
128constexpr Long64_t kMinLong64 = -kMaxLong64 - 1; ///< \deprecated Consider replacing with `std::numeric_limits<long long>::lowest()` (or `std::int64_t`)
129
130constexpr ULong_t kBitsPerByte = 8; ///< \deprecated Consider replacing with `std::numeric_limits<unsigned char>::digits`.
131constexpr Ssiz_t kNPOS = ~(Ssiz_t)0;///< The equivalent of `std::string::npos` for the ROOT class TString. \note Consider using std::string instead of TString whenever possible
132
133//---- debug global ------------------------------------------------------------
134
135R__EXTERN Int_t gDebug;///< Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase the level of debugging-printing verbosity when running ROOT commands
136
137
138#endif
#define R__EXTERN
Definition DllImport.h:26
short Style_t
Style number (short)
Definition RtypesCore.h:96
float Float16_t
Float 4 bytes in memory, written to disk as 3 bytes (24-bits) by default or as a 4 bytes fixed-point-...
Definition RtypesCore.h:72
constexpr Long64_t kMaxLong64
Definition RtypesCore.h:127
double Coord_t
Pad world coordinates (double)
Definition RtypesCore.h:101
constexpr Long_t kMaxLong
Definition RtypesCore.h:123
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:54
constexpr Long_t kMinLong
Definition RtypesCore.h:124
constexpr Int_t kMaxChar
Definition RtypesCore.h:111
constexpr ULong64_t kMaxULong64
Definition RtypesCore.h:126
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned char Byte_t
Byte (8 bits) (unsigned char)
Definition RtypesCore.h:78
double Double32_t
Double 8 bytes in memory, written to disk as a 4 bytes Float_t (32-bits) by default,...
Definition RtypesCore.h:74
constexpr ULong_t kMaxULong
Definition RtypesCore.h:122
short Color_t
Color number (short)
Definition RtypesCore.h:99
constexpr Int_t kMaxUChar
Definition RtypesCore.h:110
constexpr Int_t kMaxUShort
Definition RtypesCore.h:114
constexpr Int_t kMaxInt
Definition RtypesCore.h:119
float Size_t
Attribute size (float)
Definition RtypesCore.h:103
char Text_t
General string (char)
Definition RtypesCore.h:76
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
float Angle_t
Graphics angle (float)
Definition RtypesCore.h:102
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
Definition TROOT.cxx:627
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:52
int Ssiz_t
String size (currently int)
Definition RtypesCore.h:81
constexpr ULong_t kBitsPerByte
Definition RtypesCore.h:130
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
short Marker_t
Marker number (short)
Definition RtypesCore.h:97
constexpr Int_t kMinInt
Definition RtypesCore.h:120
float Real_t
TVector and TMatrix element type (float)
Definition RtypesCore.h:82
int Seek_t
File pointer (int).
Definition RtypesCore.h:67
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
constexpr Int_t kMaxShort
Definition RtypesCore.h:115
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Font_t
Font number (short)
Definition RtypesCore.h:95
double Axis_t
Axis values type (double)
Definition RtypesCore.h:92
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
constexpr UInt_t kMaxUInt
Definition RtypesCore.h:118
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
short SCoord_t
Screen coordinates (short)
Definition RtypesCore.h:100
long double LongDouble_t
Long Double (not portable)
Definition RtypesCore.h:75
double Stat_t
Statistics type (double)
Definition RtypesCore.h:93
constexpr Long64_t kMinLong64
Definition RtypesCore.h:128
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:131
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Int_t kMinChar
Definition RtypesCore.h:112
constexpr Int_t kMinShort
Definition RtypesCore.h:116
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Definition RtypesCore.h:84
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80