/
Kernel.cxx
359 lines (285 loc) · 13.2 KB
/
Kernel.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
// @(#)root/reflex:$Id$
// Author: Stefan Roiser 2004
// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.
#ifndef REFLEX_BUILD
#define REFLEX_BUILD
#endif
#include "Reflex/Kernel.h"
#include "Reflex/Scope.h"
#include "Reflex/internal/ScopeName.h"
#include "Reflex/PropertyList.h"
#include "Reflex/Type.h"
#include "Reflex/Base.h"
#include "Reflex/Member.h"
#include "Reflex/Object.h"
#include "Reflex/PropertyList.h"
#include "Reflex/MemberTemplate.h"
#include "Reflex/Any.h"
#include "Fundamental.h"
#include "Namespace.h"
#include "Typedef.h"
#include "Class.h"
#include <typeinfo>
//-------------------------------------------------------------------------------
ROOT::Reflex::Reflex::Reflex() {
//-------------------------------------------------------------------------------
// Initialisation of Reflex.Setup of global scope, fundamental types.
/** initialisation of the global namespace */
Namespace::GlobalScope();
// initialising fundamental types
Fundamental * tb = 0;
Type t = Type();
// char [3.9.1.1]
tb = new Fundamental( "char",
sizeof( char ),
typeid( char ));
tb->Properties().AddProperty( "Description", "fundamental type" );
// signed integer types [3.9.1.2]
tb = new Fundamental( "signed char",
sizeof( signed char ),
typeid( signed char ));
tb->Properties().AddProperty( "Description", "fundamental type" );
tb = new Fundamental( "short int",
sizeof( short int ),
typeid( short int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "short", t, FUNDAMENTAL, t );
new Typedef( "signed short", t, FUNDAMENTAL, t );
new Typedef( "short signed", t, FUNDAMENTAL, t );
new Typedef( "signed short int", t, FUNDAMENTAL, t );
new Typedef( "short signed int", t, FUNDAMENTAL, t );
tb = new Fundamental( "int",
sizeof( int ),
typeid( int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "signed", t, FUNDAMENTAL, t );
new Typedef( "signed int", t, FUNDAMENTAL, t );
tb = new Fundamental( "long int",
sizeof( long int ),
typeid( long int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "long", t, FUNDAMENTAL, t );
new Typedef( "signed long", t, FUNDAMENTAL, t );
new Typedef( "long signed", t, FUNDAMENTAL, t );
new Typedef( "signed long int", t, FUNDAMENTAL, t );
new Typedef( "long signed int", t, FUNDAMENTAL, t );
// unsigned integer types [3.9.1.3]
tb = new Fundamental( "unsigned char",
sizeof( unsigned char ),
typeid( unsigned char ));
tb->Properties().AddProperty( "Description", "fundamental type" );
tb = new Fundamental( "unsigned short int",
sizeof( unsigned short int ),
typeid( unsigned short int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "unsigned short", t, FUNDAMENTAL, t );
new Typedef( "short unsigned int", t, FUNDAMENTAL, t );
tb = new Fundamental( "unsigned int",
sizeof( unsigned int ),
typeid( unsigned int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "unsigned", t, FUNDAMENTAL, t );
tb = new Fundamental( "unsigned long int",
sizeof( unsigned long int ),
typeid( unsigned long int ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "unsigned long", t, FUNDAMENTAL, t );
new Typedef( "long unsigned", t, FUNDAMENTAL, t );
new Typedef( "long unsigned int", t, FUNDAMENTAL, t );
/*/ w_chart [3.9.1.5]
tb = new Fundamental( "w_chart",
sizeof( w_chart ),
& typeid( w_chart ));
tb->Properties().AddProperty( "Description", "fundamental type" );
*/
// bool [3.9.1.6]
tb = new Fundamental( "bool",
sizeof( bool ),
typeid( bool ));
tb->Properties().AddProperty( "Description", "fundamental type" );
// floating point types [3.9.1.8]
tb = new Fundamental( "float",
sizeof( float ),
typeid( float ));
tb->Properties().AddProperty( "Description", "fundamental type" );
tb = new Fundamental( "double",
sizeof( double ),
typeid( double ));
tb->Properties().AddProperty( "Description", "fundamental type" );
tb = new Fundamental( "long double",
sizeof( long double ),
typeid( long double ));
tb->Properties().AddProperty( "Description", "fundamental type" );
// void [3.9.1.9]
tb = new Fundamental( "void",
0,
typeid( void ));
tb->Properties().AddProperty( "Description", "fundamental type" );
// Large integer definition depends of the platform
#if defined(_WIN32) && !defined(__CINT__)
typedef __int64 longlong;
typedef unsigned __int64 ulonglong;
#else
typedef long long int longlong; /* */
typedef unsigned long long int /**/ ulonglong;
#endif
// non fundamental types but also supported at initialisation
tb = new Fundamental( "longlong",
sizeof( longlong ),
typeid( longlong ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "long long", t, FUNDAMENTAL, t );
new Typedef( "long long int", t, FUNDAMENTAL, t );
tb = new Fundamental( "ulonglong",
sizeof( ulonglong ),
typeid( ulonglong ));
tb->Properties().AddProperty( "Description", "fundamental type" );
t = tb->ThisType();
new Typedef( "long long unsigned", t, FUNDAMENTAL, t );
new Typedef( "unsigned long long", t, FUNDAMENTAL, t );
new Typedef( "unsigned long long int", t, FUNDAMENTAL, t );
new Typedef( "long long unsigned int", t, FUNDAMENTAL, t );
}
//-------------------------------------------------------------------------------
void ROOT::Reflex::Reflex::Shutdown() {
//-------------------------------------------------------------------------------
// function to be called at tear down of Reflex, removes all memory allocations
MemberTemplateName::CleanUp();
TypeTemplateName::CleanUp();
TypeName::CleanUp();
ScopeName::CleanUp();
}
//-------------------------------------------------------------------------------
ROOT::Reflex::Reflex::~Reflex() {
//-------------------------------------------------------------------------------
// Destructor
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::StdString_Cont_Type_t & ROOT::Reflex::Dummy::StdStringCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of std strings.
return Get< StdString_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Type_Cont_Type_t & ROOT::Reflex::Dummy::TypeCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of Types.
return Get< Type_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Base_Cont_Type_t & ROOT::Reflex::Dummy::BaseCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of Bases.
return Get< Base_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Scope_Cont_Type_t & ROOT::Reflex::Dummy::ScopeCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of Scopes.
return Get< Scope_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Object_Cont_Type_t & ROOT::Reflex::Dummy::ObjectCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of Objects.
return Get< Object_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Member_Cont_Type_t & ROOT::Reflex::Dummy::MemberCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of Members.
return Get< Member_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::TypeTemplate_Cont_Type_t & ROOT::Reflex::Dummy::TypeTemplateCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of TypeTemplates.
return Get< TypeTemplate_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::MemberTemplate_Cont_Type_t & ROOT::Reflex::Dummy::MemberTemplateCont() {
//-------------------------------------------------------------------------------
// static wrapper for an empty container of MemberTemplates.
return Get< MemberTemplate_Cont_Type_t >();
}
//-------------------------------------------------------------------------------
ROOT::Reflex::Any & ROOT::Reflex::Dummy::Any() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Any object
static ROOT::Reflex::Any i;
if ( i ) i.Clear();
return i;
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Object & ROOT::Reflex::Dummy::Object() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Object
return Get< ROOT::Reflex::Object >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Type & ROOT::Reflex::Dummy::Type() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Type
return Get< ROOT::Reflex::Type >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::TypeTemplate & ROOT::Reflex::Dummy::TypeTemplate() {
//-------------------------------------------------------------------------------
// static wrapper for an empty TypeTemplate
return Get< ROOT::Reflex::TypeTemplate >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Base & ROOT::Reflex::Dummy::Base() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Base
return Get< ROOT::Reflex::Base >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::PropertyList & ROOT::Reflex::Dummy::PropertyList() {
//-------------------------------------------------------------------------------
// static wrapper for an empty PropertyList
return Get< ROOT::Reflex::PropertyList >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Member & ROOT::Reflex::Dummy::Member() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Member
return Get< ROOT::Reflex::Member >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::MemberTemplate & ROOT::Reflex::Dummy::MemberTemplate() {
//-------------------------------------------------------------------------------
// static wrapper for an empty MemberTemplate
return Get< ROOT::Reflex::MemberTemplate >();
}
//-------------------------------------------------------------------------------
const ROOT::Reflex::Scope & ROOT::Reflex::Dummy::Scope() {
//-------------------------------------------------------------------------------
// static wrapper for an empty Scope
return Get< ROOT::Reflex::Scope >();
}
//-------------------------------------------------------------------------------
const std::string & ROOT::Reflex::Reflex::Argv0() {
//-------------------------------------------------------------------------------
// Return the name of the package.
static std::string str = "REFLEX";
return str;
}
//-------------------------------------------------------------------------------
namespace {
ROOT::Reflex::Reflex initialise;
}
//-------------------------------------------------------------------------------