ROOT logo
// @(#)root/base:$Id$
// Author: Rene Brun   08/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TROOT
#define ROOT_TROOT


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TROOT                                                                //
//                                                                      //
// The TROOT object is the entry point to the system.                   //
// The single instance of TROOT is accessable via the global gROOT.     //
// Using the gROOT pointer one has access to basically every object     //
// created in a ROOT based program. The TROOT object is essentially a   //
// "dispatcher" with several lists pointing to the ROOT main objects.   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TDirectory
#include "TDirectory.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif
#if __cplusplus >= 201103L
#include <atomic>
#endif

class TClass;
class TCanvas;
class TColor;
class TDataType;
class TFile;
class TStyle;
class TVirtualPad;
class TApplication;
class TInterpreter;
class TBrowser;
class TGlobal;
class TFunction;
class TFolder;
class TPluginManager;
class TProcessUUID;
class TClassGenerator;
class TVirtualMutex;



R__EXTERN TVirtualMutex *gROOTMutex;

class TROOT : public TDirectory {

friend class TCint;
friend class TCintWithCling;

private:
   Int_t           fLineIsProcessing;     //To synchronize multi-threads

   static Int_t    fgDirLevel;            //Indentation level for ls()
   static Bool_t   fgRootInit;            //Singleton initialization flag
   static Bool_t   fgMemCheck;            //Turn on memory leak checker

   TROOT(const TROOT&);                   //Not implemented
   TROOT& operator=(const TROOT&);        //Not implemented

protected:
   TString         fConfigOptions;        //ROOT ./configure set build options
   TString         fConfigFeatures;       //ROOT ./configure detected build features
   TString         fVersion;              //ROOT version (from CMZ VERSQQ) ex 0.05/01
   Int_t           fVersionInt;           //ROOT version in integer format (501)
   Int_t           fVersionCode;          //ROOT version code as used in RVersion.h
   Int_t           fVersionDate;          //Date of ROOT version (ex 951226)
   Int_t           fVersionTime;          //Time of ROOT version (ex 1152)
   Int_t           fBuiltDate;            //Date of ROOT built
   Int_t           fBuiltTime;            //Time of ROOT built
   Int_t           fSvnRevision;          //Subversion revision number of built (dec value of Git short SHA1)
   TString         fGitCommit;            //Git commit SHA1 of built
   TString         fGitBranch;            //Git branch
   TString         fGitDate;              //Date and time when make was run
   Int_t           fTimer;                //Timer flag
#if __cplusplus >= 201103L
   std::atomic<TApplication*> fApplication;         //Pointer to current application
#else
   TApplication    *fApplication;         //Pointer to current application
#endif
   TInterpreter    *fInterpreter;         //Command interpreter
   Bool_t          fBatch;                //True if session without graphics
   Bool_t          fEditHistograms;       //True if histograms can be edited with the mouse
   Bool_t          fFromPopUp;            //True if command executed from a popup menu
   Bool_t          fMustClean;            //True if object destructor scans canvases
   Bool_t          fReadingObject;        //True while reading an object [Deprecated (will be removed in next release)
   Bool_t          fForceStyle;           //Force setting of current style when reading objects
   Bool_t          fInterrupt;            //True if macro should be interrupted
   Bool_t          fEscape;               //True if ESC has been pressed
   Bool_t          fExecutingMacro;       //True while executing a TMacro
   Int_t           fEditorMode;           //Current Editor mode
   const TObject   *fPrimitive;           //Currently selected primitive
   TVirtualPad     *fSelectPad;           //Currently selected pad
   TCollection     *fClasses;             //List of classes definition
   TCollection     *fTypes;               //List of data types definition
   TCollection     *fGlobals;             //List of global variables
   TCollection     *fGlobalFunctions;     //List of global functions
   TSeqCollection  *fClosedObjects;       //List of closed objects from the list of files and sockets, so we can delete them if neededCl. 
   TSeqCollection  *fFiles;               //List of files
   TSeqCollection  *fMappedFiles;         //List of memory mapped files
   TSeqCollection  *fSockets;             //List of network sockets
   TSeqCollection  *fCanvases;            //List of canvases
   TSeqCollection  *fStyles;              //List of styles
   TCollection     *fFunctions;           //List of analytic functions
   TSeqCollection  *fTasks;               //List of tasks
   TSeqCollection  *fColors;              //List of colors
   TSeqCollection  *fGeometries;          //List of geometries
   TSeqCollection  *fBrowsers;            //List of browsers
   TSeqCollection  *fSpecials;            //List of special objects
   TSeqCollection  *fCleanups;            //List of recursiveRemove collections
   TSeqCollection  *fMessageHandlers;     //List of message handlers
   TSeqCollection  *fStreamerInfo;        //List of active StreamerInfo classes
   TCollection     *fClassGenerators;     //List of user defined class generators;
   TSeqCollection  *fSecContexts;         //List of security contexts (TSecContext)
   TSeqCollection  *fProofs;              //List of proof sessions
   TSeqCollection  *fClipboard;           //List of clipbard objects
   TSeqCollection  *fDataSets;            //List of data sets (TDSet or TChain)
   TProcessUUID    *fUUIDs;               //Pointer to TProcessID managing TUUIDs
   TFolder         *fRootFolder;          //top level folder //root
   TList           *fBrowsables;          //List of browsables
   TPluginManager  *fPluginManager;       //Keeps track of plugin library handlers
   TString         fCutClassName;         //Name of default CutG class in graphics editor
   TString         fDefCanvasName;        //Name of default canvas

                  TROOT();                //Only used by Dictionary
   void           InitSystem();           //Operating System interface
   void           InitThreads();          //Initialize threads library
   void           ReadGitInfo();          //Read Subversion revision number and branch name
   void          *operator new(size_t l) { return TObject::operator new(l); }

public:
                     TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc = 0);
   virtual           ~TROOT();
   void              AddClass(TClass *cl);
   void              AddClassGenerator(TClassGenerator *gen);
   void              Browse(TBrowser *b);
   Bool_t            ClassSaved(TClass *cl);
   void              CloseFiles();
   void              EndOfProcessCleanups(bool altInterpreter = kFALSE);
   virtual TObject  *FindObject(const char *name) const;
   virtual TObject  *FindObject(const TObject *obj) const;
   virtual TObject  *FindObjectAny(const char *name) const;
   virtual TObject  *FindObjectAnyFile(const char *name) const;
   TObject          *FindSpecialObject(const char *name, void *&where);
   const char       *FindObjectClassName(const char *name) const;
   const char       *FindObjectPathName(const TObject *obj) const;
   TClass           *FindSTLClass(const char *name, Bool_t load, Bool_t silent = kFALSE) const;
   void              ForceStyle(Bool_t force = kTRUE) { fForceStyle = force; }
   Bool_t            FromPopUp() const { return fFromPopUp; }
   TPluginManager   *GetPluginManager() const { return fPluginManager; }
   TApplication     *GetApplication() const { return fApplication; }
   TInterpreter     *GetInterpreter() const { return fInterpreter; }
   TClass           *GetClass(const char *name, Bool_t load = kTRUE, Bool_t silent = kFALSE) const;
   TClass           *GetClass(const type_info &typeinfo, Bool_t load = kTRUE, Bool_t silent = kFALSE) const;
   TColor           *GetColor(Int_t color) const;
   const char       *GetConfigOptions() const { return fConfigOptions; }
   const char       *GetConfigFeatures() const { return fConfigFeatures; }
   const char       *GetCutClassName() const { return fCutClassName; }
   const char       *GetDefCanvasName() const { return fDefCanvasName; }
   Bool_t            GetEditHistograms() const { return fEditHistograms; }
   Int_t             GetEditorMode() const { return fEditorMode; }
   Bool_t            GetForceStyle() const { return fForceStyle; }
   Int_t             GetBuiltDate() const { return fBuiltDate; }
   Int_t             GetBuiltTime() const { return fBuiltTime; }
   Int_t             GetSvnRevision() const { return fSvnRevision; }
   const char       *GetSvnBranch() const { return fGitBranch; }
   const char       *GetSvnDate() { return GetGitDate(); }
   const char       *GetGitCommit() const { return fGitCommit; }
   const char       *GetGitBranch() const { return fGitBranch; }
   const char       *GetGitDate();
   Int_t             GetVersionDate() const { return fVersionDate; }
   Int_t             GetVersionTime() const { return fVersionTime; }
   Int_t             GetVersionInt() const { return fVersionInt; }
   Int_t             GetVersionCode() const { return fVersionCode; }
   const char       *GetVersion() const { return fVersion; }
   TCollection      *GetListOfClasses() const { return fClasses; }
   TSeqCollection   *GetListOfColors() const { return fColors; }
   TCollection      *GetListOfTypes(Bool_t load = kFALSE);
   TCollection      *GetListOfGlobals(Bool_t load = kFALSE);
   TCollection      *GetListOfGlobalFunctions(Bool_t load = kFALSE);
   TSeqCollection   *GetListOfClosedObjects() const { return fClosedObjects; }
   TSeqCollection   *GetListOfFiles() const       { return fFiles; }
   TSeqCollection   *GetListOfMappedFiles() const { return fMappedFiles; }
   TSeqCollection   *GetListOfSockets() const     { return fSockets; }
   TSeqCollection   *GetListOfCanvases() const    { return fCanvases; }
   TSeqCollection   *GetListOfStyles() const      { return fStyles; }
   TCollection      *GetListOfFunctions() const   { return fFunctions; }
   TSeqCollection   *GetListOfGeometries() const  { return fGeometries; }
   TSeqCollection   *GetListOfBrowsers() const    { return fBrowsers; }
   TSeqCollection   *GetListOfSpecials() const    { return fSpecials; }
   TSeqCollection   *GetListOfTasks() const       { return fTasks; }
   TSeqCollection   *GetListOfCleanups() const    { return fCleanups; }
   TSeqCollection   *GetListOfStreamerInfo() const { return fStreamerInfo; }
   TSeqCollection   *GetListOfMessageHandlers() const { return fMessageHandlers; }
   TCollection      *GetListOfClassGenerators() const { return fClassGenerators; }
   TSeqCollection   *GetListOfSecContexts() const { return fSecContexts; }
   TSeqCollection   *GetListOfProofs() const { return fProofs; }
   TSeqCollection   *GetClipboard() const { return fClipboard; }
   TSeqCollection   *GetListOfDataSets() const { return fDataSets; }
   TList            *GetListOfBrowsables() const { return fBrowsables; }
   TDataType        *GetType(const char *name, Bool_t load = kFALSE) const;
   TFile            *GetFile() const { if (gDirectory != this) return gDirectory->GetFile(); else return 0;}
   TFile            *GetFile(const char *name) const;
   TStyle           *GetStyle(const char *name) const;
   TObject          *GetFunction(const char *name) const;
   TGlobal          *GetGlobal(const char *name, Bool_t load = kFALSE) const;
   TGlobal          *GetGlobal(const TObject *obj, Bool_t load = kFALSE) const;
   TFunction        *GetGlobalFunction(const char *name, const char *params = 0, Bool_t load = kFALSE);
   TFunction        *GetGlobalFunctionWithPrototype(const char *name, const char *proto = 0, Bool_t load = kFALSE);
   TObject          *GetGeometry(const char *name) const;
   const TObject    *GetSelectedPrimitive() const { return fPrimitive; }
   TVirtualPad      *GetSelectedPad() const { return fSelectPad; }
   Int_t             GetNclasses() const { return fClasses->GetSize(); }
   Int_t             GetNtypes() const { return fTypes->GetSize(); }
   TFolder          *GetRootFolder() const { return fRootFolder; }
   TProcessUUID     *GetUUIDs() const { return fUUIDs; }
   void              Idle(UInt_t idleTimeInSec, const char *command = 0);
   Int_t             IgnoreInclude(const char *fname, const char *expandedfname);
   Bool_t            IsBatch() const { return fBatch; }
   Bool_t            IsExecutingMacro() const { return fExecutingMacro; }
   Bool_t            IsFolder() const { return kTRUE; }
   Bool_t            IsInterrupted() const { return fInterrupt; }
   Bool_t            IsEscaped() const { return fEscape; }
   Bool_t            IsLineProcessing() const { return fLineIsProcessing ? kTRUE : kFALSE; }
   Bool_t            IsProofServ() const { return fName == "proofserv" ? kTRUE : kFALSE; }
   void              ls(Option_t *option = "") const;
   Int_t             LoadClass(const char *classname, const char *libname, Bool_t check = kFALSE);
   TClass           *LoadClass(const char *name, Bool_t silent = kFALSE) const;
   Int_t             LoadMacro(const char *filename, Int_t *error = 0, Bool_t check = kFALSE);
   Long_t            Macro(const char *filename, Int_t *error = 0, Bool_t padUpdate = kTRUE);
   TCanvas          *MakeDefCanvas() const;
   void              Message(Int_t id, const TObject *obj);
   Bool_t            MustClean() const { return fMustClean; }
   Long_t            ProcessLine(const char *line, Int_t *error = 0);
   Long_t            ProcessLineSync(const char *line, Int_t *error = 0);
   Long_t            ProcessLineFast(const char *line, Int_t *error = 0);
   Bool_t            ReadingObject() const;
   void              RefreshBrowsers();
   void              RemoveClass(TClass *);
   void              Reset(Option_t *option="");
   void              SaveContext();
   void              SetApplication(TApplication *app) { fApplication = app; }
   void              SetBatch(Bool_t batch = kTRUE) { fBatch = batch; }
   void              SetCutClassName(const char *name = "TCutG");
   void              SetDefCanvasName(const char *name = "c1") { fDefCanvasName = name; }
   void              SetEditHistograms(Bool_t flag = kTRUE) { fEditHistograms = flag; }
   void              SetEditorMode(const char *mode = "");
   void              SetExecutingMacro(Bool_t flag = kTRUE) { fExecutingMacro = flag; }
   void              SetFromPopUp(Bool_t flag = kTRUE) { fFromPopUp = flag; }
   void              SetInterrupt(Bool_t flag = kTRUE) { fInterrupt = flag; }
   void              SetEscape(Bool_t flag = kTRUE) { fEscape = flag; }
   void              SetLineIsProcessing() { fLineIsProcessing++; }
   void              SetLineHasBeenProcessed() { if (fLineIsProcessing) fLineIsProcessing--; }
   void              SetReadingObject(Bool_t flag = kTRUE);
   void              SetMustClean(Bool_t flag = kTRUE) { fMustClean=flag; }
   void              SetSelectedPrimitive(const TObject *obj) { fPrimitive = obj; }
   void              SetSelectedPad(TVirtualPad *pad) { fSelectPad = pad; }
   void              SetStyle(const char *stylename = "Default");
   void              Time(Int_t casetime=1) { fTimer = casetime; }
   Int_t             Timer() const { return fTimer; }

   //---- static functions
   static Int_t       DecreaseDirLevel();
   static Int_t       GetDirLevel();
   static const char *GetMacroPath();
   static void        SetMacroPath(const char *newpath);
   static Int_t       IncreaseDirLevel();
   static void        IndentLevel();
   static Bool_t      Initialized();
   static Bool_t      MemCheck();
   static void        SetDirLevel(Int_t level = 0);
   static Int_t       ConvertVersionCode2Int(Int_t code);
   static Int_t       ConvertVersionInt2Code(Int_t v);
   static Int_t       RootVersionCode();
   static const char *GetTutorialsDir();

   ClassDef(TROOT,0)  //Top level (or root) structure for all classes
};


R__EXTERN TROOT *gROOT;
namespace ROOT {
   TROOT *GetROOT();
}
#endif
 TROOT.h:1
 TROOT.h:2
 TROOT.h:3
 TROOT.h:4
 TROOT.h:5
 TROOT.h:6
 TROOT.h:7
 TROOT.h:8
 TROOT.h:9
 TROOT.h:10
 TROOT.h:11
 TROOT.h:12
 TROOT.h:13
 TROOT.h:14
 TROOT.h:15
 TROOT.h:16
 TROOT.h:17
 TROOT.h:18
 TROOT.h:19
 TROOT.h:20
 TROOT.h:21
 TROOT.h:22
 TROOT.h:23
 TROOT.h:24
 TROOT.h:25
 TROOT.h:26
 TROOT.h:27
 TROOT.h:28
 TROOT.h:29
 TROOT.h:30
 TROOT.h:31
 TROOT.h:32
 TROOT.h:33
 TROOT.h:34
 TROOT.h:35
 TROOT.h:36
 TROOT.h:37
 TROOT.h:38
 TROOT.h:39
 TROOT.h:40
 TROOT.h:41
 TROOT.h:42
 TROOT.h:43
 TROOT.h:44
 TROOT.h:45
 TROOT.h:46
 TROOT.h:47
 TROOT.h:48
 TROOT.h:49
 TROOT.h:50
 TROOT.h:51
 TROOT.h:52
 TROOT.h:53
 TROOT.h:54
 TROOT.h:55
 TROOT.h:56
 TROOT.h:57
 TROOT.h:58
 TROOT.h:59
 TROOT.h:60
 TROOT.h:61
 TROOT.h:62
 TROOT.h:63
 TROOT.h:64
 TROOT.h:65
 TROOT.h:66
 TROOT.h:67
 TROOT.h:68
 TROOT.h:69
 TROOT.h:70
 TROOT.h:71
 TROOT.h:72
 TROOT.h:73
 TROOT.h:74
 TROOT.h:75
 TROOT.h:76
 TROOT.h:77
 TROOT.h:78
 TROOT.h:79
 TROOT.h:80
 TROOT.h:81
 TROOT.h:82
 TROOT.h:83
 TROOT.h:84
 TROOT.h:85
 TROOT.h:86
 TROOT.h:87
 TROOT.h:88
 TROOT.h:89
 TROOT.h:90
 TROOT.h:91
 TROOT.h:92
 TROOT.h:93
 TROOT.h:94
 TROOT.h:95
 TROOT.h:96
 TROOT.h:97
 TROOT.h:98
 TROOT.h:99
 TROOT.h:100
 TROOT.h:101
 TROOT.h:102
 TROOT.h:103
 TROOT.h:104
 TROOT.h:105
 TROOT.h:106
 TROOT.h:107
 TROOT.h:108
 TROOT.h:109
 TROOT.h:110
 TROOT.h:111
 TROOT.h:112
 TROOT.h:113
 TROOT.h:114
 TROOT.h:115
 TROOT.h:116
 TROOT.h:117
 TROOT.h:118
 TROOT.h:119
 TROOT.h:120
 TROOT.h:121
 TROOT.h:122
 TROOT.h:123
 TROOT.h:124
 TROOT.h:125
 TROOT.h:126
 TROOT.h:127
 TROOT.h:128
 TROOT.h:129
 TROOT.h:130
 TROOT.h:131
 TROOT.h:132
 TROOT.h:133
 TROOT.h:134
 TROOT.h:135
 TROOT.h:136
 TROOT.h:137
 TROOT.h:138
 TROOT.h:139
 TROOT.h:140
 TROOT.h:141
 TROOT.h:142
 TROOT.h:143
 TROOT.h:144
 TROOT.h:145
 TROOT.h:146
 TROOT.h:147
 TROOT.h:148
 TROOT.h:149
 TROOT.h:150
 TROOT.h:151
 TROOT.h:152
 TROOT.h:153
 TROOT.h:154
 TROOT.h:155
 TROOT.h:156
 TROOT.h:157
 TROOT.h:158
 TROOT.h:159
 TROOT.h:160
 TROOT.h:161
 TROOT.h:162
 TROOT.h:163
 TROOT.h:164
 TROOT.h:165
 TROOT.h:166
 TROOT.h:167
 TROOT.h:168
 TROOT.h:169
 TROOT.h:170
 TROOT.h:171
 TROOT.h:172
 TROOT.h:173
 TROOT.h:174
 TROOT.h:175
 TROOT.h:176
 TROOT.h:177
 TROOT.h:178
 TROOT.h:179
 TROOT.h:180
 TROOT.h:181
 TROOT.h:182
 TROOT.h:183
 TROOT.h:184
 TROOT.h:185
 TROOT.h:186
 TROOT.h:187
 TROOT.h:188
 TROOT.h:189
 TROOT.h:190
 TROOT.h:191
 TROOT.h:192
 TROOT.h:193
 TROOT.h:194
 TROOT.h:195
 TROOT.h:196
 TROOT.h:197
 TROOT.h:198
 TROOT.h:199
 TROOT.h:200
 TROOT.h:201
 TROOT.h:202
 TROOT.h:203
 TROOT.h:204
 TROOT.h:205
 TROOT.h:206
 TROOT.h:207
 TROOT.h:208
 TROOT.h:209
 TROOT.h:210
 TROOT.h:211
 TROOT.h:212
 TROOT.h:213
 TROOT.h:214
 TROOT.h:215
 TROOT.h:216
 TROOT.h:217
 TROOT.h:218
 TROOT.h:219
 TROOT.h:220
 TROOT.h:221
 TROOT.h:222
 TROOT.h:223
 TROOT.h:224
 TROOT.h:225
 TROOT.h:226
 TROOT.h:227
 TROOT.h:228
 TROOT.h:229
 TROOT.h:230
 TROOT.h:231
 TROOT.h:232
 TROOT.h:233
 TROOT.h:234
 TROOT.h:235
 TROOT.h:236
 TROOT.h:237
 TROOT.h:238
 TROOT.h:239
 TROOT.h:240
 TROOT.h:241
 TROOT.h:242
 TROOT.h:243
 TROOT.h:244
 TROOT.h:245
 TROOT.h:246
 TROOT.h:247
 TROOT.h:248
 TROOT.h:249
 TROOT.h:250
 TROOT.h:251
 TROOT.h:252
 TROOT.h:253
 TROOT.h:254
 TROOT.h:255
 TROOT.h:256
 TROOT.h:257
 TROOT.h:258
 TROOT.h:259
 TROOT.h:260
 TROOT.h:261
 TROOT.h:262
 TROOT.h:263
 TROOT.h:264
 TROOT.h:265
 TROOT.h:266
 TROOT.h:267
 TROOT.h:268
 TROOT.h:269
 TROOT.h:270
 TROOT.h:271
 TROOT.h:272
 TROOT.h:273
 TROOT.h:274
 TROOT.h:275
 TROOT.h:276
 TROOT.h:277
 TROOT.h:278
 TROOT.h:279
 TROOT.h:280
 TROOT.h:281
 TROOT.h:282
 TROOT.h:283
 TROOT.h:284
 TROOT.h:285
 TROOT.h:286
 TROOT.h:287
 TROOT.h:288
 TROOT.h:289
 TROOT.h:290
 TROOT.h:291
 TROOT.h:292
 TROOT.h:293
 TROOT.h:294
 TROOT.h:295
 TROOT.h:296
 TROOT.h:297
 TROOT.h:298
 TROOT.h:299