ROOT
master
Reference Guide
TInterpreter.cxx
Go to the documentation of this file.
1
// @(#)root/meta:$Id$
2
// Author: Fons Rademakers 01/03/96
3
4
/*************************************************************************
5
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
/** \class TInterpreter
13
This class defines an abstract interface to a generic command line
14
interpreter.
15
*/
16
17
#include "
TInterpreter.h
"
18
19
#include "
TROOT.h
"
20
#include "
TError.h
"
21
#include "
TGlobal.h
"
22
23
24
TInterpreter
*
gCling
=
nullptr
;
// returns pointer to global TCling object
25
static
TInterpreter
*
gInterpreterLocal
=
nullptr
;
// The real holder of the pointer.
26
27
28
namespace
{
29
static
struct
AddPseudoGlobals {
30
AddPseudoGlobals() {
31
32
// use special functor to extract pointer on gInterpreterLocal variable
33
TGlobalMappedFunction::MakeFunctor
(
"gInterpreter"
,
"TInterpreter*"
,
TInterpreter::Instance
, [] {
34
TInterpreter::Instance
();
35
return
(
void
*) &
gInterpreterLocal
;
36
});
37
38
}
39
} gAddPseudoGlobals;
40
}
41
42
43
ClassImp
(
TInterpreter
);
44
45
////////////////////////////////////////////////////////////////////////////////
46
/// TInterpreter ctor only called by derived classes.
47
48
TInterpreter::TInterpreter
(
const
char
*
name
,
const
char
*title)
49
:
TNamed
(
name
, title)
50
{
51
gInterpreterLocal
=
this
;
52
gCling
=
this
;
53
}
54
55
////////////////////////////////////////////////////////////////////////////////
56
/// returns gInterpreter global
57
58
TInterpreter
*
TInterpreter::Instance
()
59
{
60
if
(
gInterpreterLocal
== 0) {
61
static
TROOT
*getROOT =
ROOT::GetROOT
();
// Make sure gInterpreterLocal is set
62
if
(!getROOT) {
63
::Fatal
(
"TInterpreter::Instance"
,
"TROOT object is required before accessing a TInterpreter"
);
64
}
65
}
66
return
gInterpreterLocal
;
67
}
TInterpreter::Instance
static TInterpreter * Instance()
returns gInterpreter global
Definition:
TInterpreter.cxx:58
gCling
TInterpreter * gCling
Definition:
TInterpreter.cxx:24
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:364
TObject::Fatal
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition:
TObject.cxx:918
ROOT::GetROOT
TROOT * GetROOT()
Definition:
TROOT.cxx:465
TROOT
ROOT top level object description.
Definition:
TROOT.h:94
TROOT.h
TGlobalMappedFunction::MakeFunctor
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Definition:
TGlobal.h:73
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition:
TNamed.h:29
gInterpreterLocal
static TInterpreter * gInterpreterLocal
Definition:
TInterpreter.cxx:25
TInterpreter::TInterpreter
TInterpreter()
Definition:
TInterpreter.h:139
TGlobal.h
TInterpreter.h
name
char name[80]
Definition:
TGX11.cxx:110
TInterpreter
This class defines an abstract interface to a generic command line interpreter.
Definition:
TInterpreter.h:64
TError.h
core
meta
src
TInterpreter.cxx
ROOT master - Reference Guide Generated on Thu Feb 25 2021 11:58:55 (GVA Time) using Doxygen 1.9.0