1 |
|
---|
2 | #ifndef ROOT_Rtypes
|
---|
3 | #define ROOT_Rtypes
|
---|
4 |
|
---|
5 | // Copyright (C) 1994 CodeCERN. All rights reserved.
|
---|
6 |
|
---|
7 | //////////////////////////////////////////////////////////////////////////
|
---|
8 | // //
|
---|
9 | // Rtypes //
|
---|
10 | // //
|
---|
11 | // Basic types used by ROOT. //
|
---|
12 | // //
|
---|
13 | //////////////////////////////////////////////////////////////////////////
|
---|
14 |
|
---|
15 |
|
---|
16 | #ifndef ROOT_RConfig
|
---|
17 | //*KEEP,RConfig.
|
---|
18 | #include "RConfig.h"
|
---|
19 | //*KEND.
|
---|
20 | #endif
|
---|
21 |
|
---|
22 | #include <stdio.h>
|
---|
23 |
|
---|
24 | //*KEEP,DllImport,T=C.
|
---|
25 | #include "DllImport.h"
|
---|
26 | //*KEND.
|
---|
27 |
|
---|
28 | //---- types -------------------------------------------------------------------
|
---|
29 |
|
---|
30 | typedef char Char_t; //Signed Character 1 byte
|
---|
31 | typedef unsigned char UChar_t; //Unsigned Character 1 byte
|
---|
32 | typedef short Short_t; //Signed Short integer 2 bytes
|
---|
33 | typedef unsigned short UShort_t; //Unsigned Short integer 2 bytes
|
---|
34 | #ifdef R__INT16
|
---|
35 | typedef long Int_t; //Signed integer 4 bytes
|
---|
36 | typedef unsigned long UInt_t; //Unsigned integer 4 bytes
|
---|
37 | #else
|
---|
38 | typedef int Int_t; //Signed integer 4 bytes
|
---|
39 | typedef unsigned int UInt_t; //Unsigned integer 4 bytes
|
---|
40 | #endif
|
---|
41 | #ifdef R__B64
|
---|
42 | typedef int Seek_t; //File pointer
|
---|
43 | typedef long Long_t; //Signed long integer 4 bytes
|
---|
44 | typedef unsigned long ULong_t; //Unsigned long integer 4 bytes
|
---|
45 | #else
|
---|
46 | typedef int Seek_t; //File pointer
|
---|
47 | typedef long Long_t; //Signed long integer 8 bytes
|
---|
48 | typedef unsigned long ULong_t; //Unsigned long integer 8 bytes
|
---|
49 | #endif
|
---|
50 | typedef float Float_t; //Float 4 bytes
|
---|
51 | typedef double Double_t; //Float 8 bytes
|
---|
52 | typedef char Text_t; //General string
|
---|
53 | typedef unsigned char Bool_t; //Boolean (0=false, 1=true)
|
---|
54 | typedef unsigned char Byte_t; //Byte (8 bits)
|
---|
55 | typedef short Version_t; //Class version identifier
|
---|
56 | typedef char Option_t; //Option string
|
---|
57 | typedef int Ssiz_t; //String size
|
---|
58 | typedef float Real_t; //TVector and TMatrix element type
|
---|
59 |
|
---|
60 | typedef void (*VoidFuncPtr_t)(); //pointer to void function
|
---|
61 |
|
---|
62 |
|
---|
63 | //---- constants ---------------------------------------------------------------
|
---|
64 |
|
---|
65 | #ifndef NULL
|
---|
66 | #define NULL 0
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | const Bool_t kTRUE = 1;
|
---|
70 | const Bool_t kFALSE = 0;
|
---|
71 |
|
---|
72 | const Int_t kMaxInt = 2147483647;
|
---|
73 | const Int_t kMaxShort = 32767;
|
---|
74 | const size_t kBitsPerByte = 8;
|
---|
75 | const Ssiz_t kNPOS = ~(Ssiz_t)0;
|
---|
76 |
|
---|
77 |
|
---|
78 | //--- bit manipulation ---------------------------------------------------------
|
---|
79 |
|
---|
80 | #define BIT(n) (1 << (n))
|
---|
81 | #define SETBIT(n,i) ((n) |= BIT(i))
|
---|
82 | #define CLRBIT(n,i) ((n) &= ~BIT(i))
|
---|
83 | #define TESTBIT(n,i) ((Bool_t)(((n) & BIT(i)) != 0))
|
---|
84 |
|
---|
85 |
|
---|
86 | //---- debug global ------------------------------------------------------------
|
---|
87 |
|
---|
88 | EXTERN Bool_t gDebug;
|
---|
89 |
|
---|
90 |
|
---|
91 | //---- ClassDef macros ---------------------------------------------------------
|
---|
92 |
|
---|
93 | class TClass;
|
---|
94 | class TBuffer;
|
---|
95 | class TMemberInspector;
|
---|
96 |
|
---|
97 | extern TClass *CreateClass(const char *cname, Version_t id,
|
---|
98 | const char *dfil, const char *ifil,
|
---|
99 | Int_t dl, Int_t il);
|
---|
100 |
|
---|
101 | #define ClassDef(name,id) \
|
---|
102 | private: \
|
---|
103 | static TClass *fgIsA; \
|
---|
104 | public: \
|
---|
105 | static const char *DeclFileName() { return __FILE__; } \
|
---|
106 | static int DeclFileLine() { return __LINE__; } \
|
---|
107 | static const char *ImplFileName(); \
|
---|
108 | static int ImplFileLine(); \
|
---|
109 | static Version_t Class_Version() { return id; } \
|
---|
110 | static TClass *Class(); \
|
---|
111 | static void Dictionary(); \
|
---|
112 | virtual TClass *IsA() const { return name::Class(); } \
|
---|
113 | virtual void ShowMembers(TMemberInspector &insp, char *parent); \
|
---|
114 | virtual void Streamer(TBuffer &b); \
|
---|
115 | friend TBuffer &operator>>(TBuffer &buf, name *&obj);
|
---|
116 |
|
---|
117 | #define _ClassInit_(name) \
|
---|
118 | extern void AddClass(const char *cname, Version_t id, VoidFuncPtr_t dict); \
|
---|
119 | extern void RemoveClass(const char *cname); \
|
---|
120 | class _NAME3_(__,name,Init__) { \
|
---|
121 | public: \
|
---|
122 | _NAME3_(__,name,Init__)() { \
|
---|
123 | AddClass(_QUOTE_(name), name::Class_Version(), \
|
---|
124 | &name::Dictionary); \
|
---|
125 | } \
|
---|
126 | ~_NAME3_(__,name,Init__)() { \
|
---|
127 | RemoveClass(_QUOTE_(name)); \
|
---|
128 | } \
|
---|
129 | }; \
|
---|
130 | static _NAME3_(__,name,Init__) _NAME3_(__g,name,Init__);
|
---|
131 |
|
---|
132 | #define _ClassImp_(name) \
|
---|
133 | TClass *name::Class() \
|
---|
134 | { if (!fgIsA) name::Dictionary(); return fgIsA; } \
|
---|
135 | const char *name::ImplFileName() { return __FILE__; } \
|
---|
136 | int name::ImplFileLine() { return __LINE__; } \
|
---|
137 | TClass *name::fgIsA = 0; \
|
---|
138 | _ClassInit_(name)
|
---|
139 |
|
---|
140 | #define ClassImp(name) \
|
---|
141 | void name::Dictionary() \
|
---|
142 | { \
|
---|
143 | TClass *c = CreateClass(_QUOTE_(name), Class_Version(), \
|
---|
144 | DeclFileName(), ImplFileName(), \
|
---|
145 | DeclFileLine(), ImplFileLine()); \
|
---|
146 | fgIsA = c; \
|
---|
147 | } \
|
---|
148 | _ClassImp_(name)
|
---|
149 |
|
---|
150 | #endif
|
---|
151 |
|
---|