Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
13This class defines an abstract interface to a generic command line
14interpreter.
15*/
16
17#include "TInterpreter.h"
18
19#include "TROOT.h"
20#include "TError.h"
21#include "TGlobal.h"
22
23
24TInterpreter* gCling = nullptr; // returns pointer to global TCling object
25static TInterpreter *gInterpreterLocal = nullptr; // The real holder of the pointer.
26
27
28namespace {
29static struct AddPseudoGlobals {
30AddPseudoGlobals() {
31
32 // use special functor to extract pointer on gInterpreterLocal variable
33 TGlobalMappedFunction::MakeFunctor("gInterpreter", "TInterpreter*", TInterpreter::Instance, [] {
35 return (void *) &gInterpreterLocal;
36 });
37
38}
40}
41
42
43
44////////////////////////////////////////////////////////////////////////////////
45/// TInterpreter ctor only called by derived classes.
46
47TInterpreter::TInterpreter(const char *name, const char *title)
48 : TNamed(name, title)
49{
50 gInterpreterLocal = this;
51 gCling = this;
52}
53
54////////////////////////////////////////////////////////////////////////////////
55/// returns gInterpreter global
56
58{
59 if (gInterpreterLocal == nullptr) {
60 static TROOT *getROOT = ROOT::GetROOT(); // Make sure gInterpreterLocal is set
61 if (!getROOT) {
62 ::Fatal("TInterpreter::Instance","TROOT object is required before accessing a TInterpreter");
63 }
64 }
65 return gInterpreterLocal;
66}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char name[80]
Definition TGX11.cxx:110
static TInterpreter * gInterpreterLocal
TInterpreter * gCling
R__EXTERN TInterpreter * gCling
static void MakeFunctor(const char *name, const char *type, GlobFunc &func)
Definition TGlobal.h:73
This class defines an abstract interface to a generic command line interpreter.
static TInterpreter * Instance()
returns gInterpreter global
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1099
ROOT top level object description.
Definition TROOT.h:102
TROOT * GetROOT()
Definition TROOT.cxx:477