Logo ROOT   6.12/07
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 
22 TInterpreter* (*gPtr2Interpreter)() = 0; // returns pointer to global object
23 TInterpreter* gCling = 0; // returns pointer to global TCling object
24 static TInterpreter *gInterpreterLocal = 0; // The real holder of the pointer.
25 
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// TInterpreter ctor only called by derived classes.
30 
31 TInterpreter::TInterpreter(const char *name, const char *title)
32  : TNamed(name, title)
33 {
34  gInterpreterLocal = this;
35  gCling = this;
36 }
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 /// returns gInterpreter global
40 
42 {
43  if (gInterpreterLocal == 0) {
44  static TROOT *getROOT = ROOT::GetROOT(); // Make sure gInterpreterLocal is set
45  if (!getROOT) {
46  ::Fatal("TInterpreter::Instance","TROOT object is required before accessing a TInterpreter");
47  }
48  }
49  if (gPtr2Interpreter) return gPtr2Interpreter();
50  return gInterpreterLocal;
51 }
This class defines an abstract interface to a generic command line interpreter.
Definition: TInterpreter.h:60
ROOT top level object description.
Definition: TROOT.h:100
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
static TInterpreter * gInterpreterLocal
TROOT * GetROOT()
Definition: TROOT.cxx:517
static TInterpreter * Instance()
returns gInterpreter global
#define ClassImp(name)
Definition: Rtypes.h:359
TInterpreter * gCling
TInterpreter *(* gPtr2Interpreter)()=0
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:908
char name[80]
Definition: TGX11.cxx:109