TROOT.h

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TROOT.h 32970 2010-04-13 16:36:38Z rdm $
00002 // Author: Rene Brun   08/12/94
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TROOT
00013 #define ROOT_TROOT
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TROOT                                                                //
00019 //                                                                      //
00020 // The TROOT object is the entry point to the system.                   //
00021 // The single instance of TROOT is accessable via the global gROOT.     //
00022 // Using the gROOT pointer one has access to basically every object     //
00023 // created in a ROOT based program. The TROOT object is essentially a   //
00024 // "dispatcher" with several lists pointing to the ROOT main objects.   //
00025 //                                                                      //
00026 //////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef ROOT_TDirectory
00029 #include "TDirectory.h"
00030 #endif
00031 #ifndef ROOT_TList
00032 #include "TList.h"
00033 #endif
00034 
00035 class TClass;
00036 class TCanvas;
00037 class TColor;
00038 class TDataType;
00039 class TFile;
00040 class TStyle;
00041 class TVirtualPad;
00042 class TApplication;
00043 class TInterpreter;
00044 class TBrowser;
00045 class TGlobal;
00046 class TFunction;
00047 class TFolder;
00048 class TPluginManager;
00049 class TProcessUUID;
00050 class TClassGenerator;
00051 class TVirtualMutex;
00052 
00053 
00054 
00055 R__EXTERN TVirtualMutex *gROOTMutex;
00056 
00057 class TROOT : public TDirectory {
00058 
00059 friend class TCint;
00060 friend class TCling;
00061 
00062 private:
00063    Int_t           fLineIsProcessing;     //To synchronize multi-threads
00064 
00065    static Int_t    fgDirLevel;            //Indentation level for ls()
00066    static Bool_t   fgRootInit;            //Singleton initialization flag
00067    static Bool_t   fgMemCheck;            //Turn on memory leak checker
00068 
00069    TROOT(const TROOT&);                   //Not implemented
00070    TROOT& operator=(const TROOT&);        //Not implemented
00071 
00072 protected:
00073    TString         fConfigOptions;        //ROOT ./configure set build options
00074    TString         fConfigFeatures;       //ROOT ./configure detected build features
00075    TString         fVersion;              //ROOT version (from CMZ VERSQQ) ex 0.05/01
00076    Int_t           fVersionInt;           //ROOT version in integer format (501)
00077    Int_t           fVersionCode;          //ROOT version code as used in RVersion.h
00078    Int_t           fVersionDate;          //Date of ROOT version (ex 951226)
00079    Int_t           fVersionTime;          //Time of ROOT version (ex 1152)
00080    Int_t           fBuiltDate;            //Date of ROOT built
00081    Int_t           fBuiltTime;            //Time of ROOT built
00082    Int_t           fSvnRevision;          //Subversion revision number of built
00083    TString         fSvnBranch;            //Subversion branch
00084    TString         fSvnDate;              //Date and time when make was run
00085    Int_t           fTimer;                //Timer flag
00086    TApplication    *fApplication;         //Pointer to current application
00087    TInterpreter    *fInterpreter;         //Command interpreter
00088    Bool_t          fBatch;                //True if session without graphics
00089    Bool_t          fEditHistograms;       //True if histograms can be edited with the mouse
00090    Bool_t          fFromPopUp;            //True if command executed from a popup menu
00091    Bool_t          fMustClean;            //True if object destructor scans canvases
00092    Bool_t          fReadingObject;        //True while reading an object [Deprecated (will be removed in next release)
00093    Bool_t          fForceStyle;           //Force setting of current style when reading objects
00094    Bool_t          fInterrupt;            //True if macro should be interrupted
00095    Bool_t          fEscape;               //True if ESC has been pressed
00096    Bool_t          fExecutingMacro;       //True while executing a TMacro
00097    Int_t           fEditorMode;           //Current Editor mode
00098    const TObject   *fPrimitive;           //Currently selected primitive
00099    TVirtualPad     *fSelectPad;           //Currently selected pad
00100    TCollection     *fClasses;             //List of classes definition
00101    TCollection     *fTypes;               //List of data types definition
00102    TCollection     *fGlobals;             //List of global variables
00103    TCollection     *fGlobalFunctions;     //List of global functions
00104    TSeqCollection  *fFiles;               //List of files
00105    TSeqCollection  *fMappedFiles;         //List of memory mapped files
00106    TSeqCollection  *fSockets;             //List of network sockets
00107    TSeqCollection  *fCanvases;            //List of canvases
00108    TSeqCollection  *fStyles;              //List of styles
00109    TCollection     *fFunctions;           //List of analytic functions
00110    TSeqCollection  *fTasks;               //List of tasks
00111    TSeqCollection  *fColors;              //List of colors
00112    TSeqCollection  *fGeometries;          //List of geometries
00113    TSeqCollection  *fBrowsers;            //List of browsers
00114    TSeqCollection  *fSpecials;            //List of special objects
00115    TSeqCollection  *fCleanups;            //List of recursiveRemove collections
00116    TSeqCollection  *fMessageHandlers;     //List of message handlers
00117    TSeqCollection  *fStreamerInfo;        //List of active StreamerInfo classes
00118    TCollection     *fClassGenerators;     //List of user defined class generators;
00119    TSeqCollection  *fSecContexts;         //List of security contexts (TSecContext)
00120    TSeqCollection  *fProofs;              //List of proof sessions
00121    TSeqCollection  *fClipboard;           //List of clipbard objects
00122    TSeqCollection  *fDataSets;            //List of data sets (TDSet or TChain)
00123    TProcessUUID    *fUUIDs;               //Pointer to TProcessID managing TUUIDs
00124    TFolder         *fRootFolder;          //top level folder //root
00125    TList           *fBrowsables;          //List of browsables
00126    TPluginManager  *fPluginManager;       //Keeps track of plugin library handlers
00127    TString         fCutClassName;         //Name of default CutG class in graphics editor
00128    TString         fDefCanvasName;        //Name of default canvas
00129 
00130                   TROOT();                //Only used by Dictionary
00131    void           InitSystem();           //Operating System interface
00132    void           InitThreads();          //Initialize threads library
00133    void           ReadSvnInfo();          //Read Subversion revision number and branch name
00134    void          *operator new(size_t l) { return TObject::operator new(l); }
00135 
00136 public:
00137                      TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc = 0);
00138    virtual           ~TROOT();
00139    void              AddClass(TClass *cl);
00140    void              AddClassGenerator(TClassGenerator *gen);
00141    void              Browse(TBrowser *b);
00142    Bool_t            ClassSaved(TClass *cl);
00143    virtual TObject  *FindObject(const char *name) const;
00144    virtual TObject  *FindObject(const TObject *obj) const;
00145    virtual TObject  *FindObjectAny(const char *name) const;
00146    TObject          *FindSpecialObject(const char *name, void *&where);
00147    const char       *FindObjectClassName(const char *name) const;
00148    const char       *FindObjectPathName(const TObject *obj) const;
00149    TClass           *FindSTLClass(const char *name, Bool_t load, Bool_t silent = kFALSE) const;
00150    void              ForceStyle(Bool_t force = kTRUE) { fForceStyle = force; }
00151    Bool_t            FromPopUp() const { return fFromPopUp; }
00152    TPluginManager   *GetPluginManager() const { return fPluginManager; }
00153    TApplication     *GetApplication() const { return fApplication; }
00154    TInterpreter     *GetInterpreter() const { return fInterpreter; }
00155    TClass           *GetClass(const char *name, Bool_t load = kTRUE, Bool_t silent = kFALSE) const;
00156    TClass           *GetClass(const type_info &typeinfo, Bool_t load = kTRUE, Bool_t silent = kFALSE) const;
00157    TColor           *GetColor(Int_t color) const;
00158    const char       *GetConfigOptions() const { return fConfigOptions; }
00159    const char       *GetConfigFeatures() const { return fConfigFeatures; }
00160    const char       *GetCutClassName() const { return fCutClassName; }
00161    const char       *GetDefCanvasName() const { return fDefCanvasName; }
00162    Bool_t            GetEditHistograms() const { return fEditHistograms; }
00163    Int_t             GetEditorMode() const { return fEditorMode; }
00164    Bool_t            GetForceStyle() const { return fForceStyle; }
00165    Int_t             GetBuiltDate() const { return fBuiltDate; }
00166    Int_t             GetBuiltTime() const { return fBuiltTime; }
00167    Int_t             GetSvnRevision() const { return fSvnRevision; }
00168    const char       *GetSvnBranch() const { return fSvnBranch; }
00169    const char       *GetSvnDate();
00170    Int_t             GetVersionDate() const { return fVersionDate; }
00171    Int_t             GetVersionTime() const { return fVersionTime; }
00172    Int_t             GetVersionInt() const { return fVersionInt; }
00173    Int_t             GetVersionCode() const { return fVersionCode; }
00174    const char       *GetVersion() const { return fVersion; }
00175    TCollection      *GetListOfClasses() const { return fClasses; }
00176    TSeqCollection   *GetListOfColors() const { return fColors; }
00177    TCollection      *GetListOfTypes(Bool_t load = kFALSE);
00178    TCollection      *GetListOfGlobals(Bool_t load = kFALSE);
00179    TCollection      *GetListOfGlobalFunctions(Bool_t load = kFALSE);
00180    TSeqCollection   *GetListOfFiles() const       { return fFiles; }
00181    TSeqCollection   *GetListOfMappedFiles() const { return fMappedFiles; }
00182    TSeqCollection   *GetListOfSockets() const     { return fSockets; }
00183    TSeqCollection   *GetListOfCanvases() const    { return fCanvases; }
00184    TSeqCollection   *GetListOfStyles() const      { return fStyles; }
00185    TCollection      *GetListOfFunctions() const   { return fFunctions; }
00186    TSeqCollection   *GetListOfGeometries() const  { return fGeometries; }
00187    TSeqCollection   *GetListOfBrowsers() const    { return fBrowsers; }
00188    TSeqCollection   *GetListOfSpecials() const    { return fSpecials; }
00189    TSeqCollection   *GetListOfTasks() const       { return fTasks; }
00190    TSeqCollection   *GetListOfCleanups() const    { return fCleanups; }
00191    TSeqCollection   *GetListOfStreamerInfo() const { return fStreamerInfo; }
00192    TSeqCollection   *GetListOfMessageHandlers() const { return fMessageHandlers; }
00193    TCollection      *GetListOfClassGenerators() const { return fClassGenerators; }
00194    TSeqCollection   *GetListOfSecContexts() const { return fSecContexts; }
00195    TSeqCollection   *GetListOfProofs() const { return fProofs; }
00196    TSeqCollection   *GetClipboard() const { return fClipboard; }
00197    TSeqCollection   *GetListOfDataSets() const { return fDataSets; }
00198    TList            *GetListOfBrowsables() const { return fBrowsables; }
00199    TDataType        *GetType(const char *name, Bool_t load = kFALSE) const;
00200    TFile            *GetFile() const { if (gDirectory != this) return gDirectory->GetFile(); else return 0;}
00201    TFile            *GetFile(const char *name) const;
00202    TStyle           *GetStyle(const char *name) const;
00203    TObject          *GetFunction(const char *name) const;
00204    TGlobal          *GetGlobal(const char *name, Bool_t load = kFALSE) const;
00205    TGlobal          *GetGlobal(const TObject *obj, Bool_t load = kFALSE) const;
00206    TFunction        *GetGlobalFunction(const char *name, const char *params = 0, Bool_t load = kFALSE);
00207    TFunction        *GetGlobalFunctionWithPrototype(const char *name, const char *proto = 0, Bool_t load = kFALSE);
00208    TObject          *GetGeometry(const char *name) const;
00209    const TObject    *GetSelectedPrimitive() const { return fPrimitive; }
00210    TVirtualPad      *GetSelectedPad() const { return fSelectPad; }
00211    Int_t             GetNclasses() const { return fClasses->GetSize(); }
00212    Int_t             GetNtypes() const { return fTypes->GetSize(); }
00213    TFolder          *GetRootFolder() const { return fRootFolder; }
00214    TProcessUUID     *GetUUIDs() const { return fUUIDs; }
00215    void              Idle(UInt_t idleTimeInSec, const char *command = 0);
00216    Int_t             IgnoreInclude(const char *fname, const char *expandedfname);
00217    Bool_t            IsBatch() const { return fBatch; }
00218    Bool_t            IsExecutingMacro() const { return fExecutingMacro; }
00219    Bool_t            IsFolder() const { return kTRUE; }
00220    Bool_t            IsInterrupted() const { return fInterrupt; }
00221    Bool_t            IsEscaped() const { return fEscape; }
00222    Bool_t            IsLineProcessing() const { return fLineIsProcessing ? kTRUE : kFALSE; }
00223    Bool_t            IsProofServ() const { return fName == "proofserv" ? kTRUE : kFALSE; }
00224    void              ls(Option_t *option = "") const;
00225    Int_t             LoadClass(const char *classname, const char *libname, Bool_t check = kFALSE);
00226    TClass           *LoadClass(const char *name, Bool_t silent = kFALSE) const;
00227    Int_t             LoadMacro(const char *filename, Int_t *error = 0, Bool_t check = kFALSE);
00228    Long_t            Macro(const char *filename, Int_t *error = 0, Bool_t padUpdate = kTRUE);
00229    TCanvas          *MakeDefCanvas() const;
00230    void              Message(Int_t id, const TObject *obj);
00231    Bool_t            MustClean() const { return fMustClean; }
00232    Long_t            ProcessLine(const char *line, Int_t *error = 0);
00233    Long_t            ProcessLineSync(const char *line, Int_t *error = 0);
00234    Long_t            ProcessLineFast(const char *line, Int_t *error = 0);
00235    Bool_t            ReadingObject() const { /* Deprecated (will be removed in next release) */ return fReadingObject; }
00236    void              RefreshBrowsers();
00237    void              RemoveClass(TClass *);
00238    void              Reset(Option_t *option="");
00239    void              SaveContext();
00240    void              SetApplication(TApplication *app) { fApplication = app; }
00241    void              SetBatch(Bool_t batch = kTRUE) { fBatch = batch; }
00242    void              SetCutClassName(const char *name = "TCutG");
00243    void              SetDefCanvasName(const char *name = "c1") { fDefCanvasName = name; }
00244    void              SetEditHistograms(Bool_t flag = kTRUE) { fEditHistograms = flag; }
00245    void              SetEditorMode(const char *mode = "");
00246    void              SetExecutingMacro(Bool_t flag = kTRUE) { fExecutingMacro = flag; }
00247    void              SetFromPopUp(Bool_t flag = kTRUE) { fFromPopUp = flag; }
00248    void              SetInterrupt(Bool_t flag = kTRUE) { fInterrupt = flag; }
00249    void              SetEscape(Bool_t flag = kTRUE) { fEscape = flag; }
00250    void              SetLineIsProcessing() { fLineIsProcessing++; }
00251    void              SetLineHasBeenProcessed() { if (fLineIsProcessing) fLineIsProcessing--; }
00252    void              SetReadingObject(Bool_t flag = kTRUE) { fReadingObject = flag; }
00253    void              SetMustClean(Bool_t flag = kTRUE) { fMustClean=flag; }
00254    void              SetSelectedPrimitive(const TObject *obj) { fPrimitive = obj; }
00255    void              SetSelectedPad(TVirtualPad *pad) { fSelectPad = pad; }
00256    void              SetStyle(const char *stylename = "Default");
00257    void              Time(Int_t casetime=1) { fTimer = casetime; }
00258    Int_t             Timer() const { return fTimer; }
00259 
00260    //---- static functions
00261    static Int_t       DecreaseDirLevel();
00262    static Int_t       GetDirLevel();
00263    static const char *GetMacroPath();
00264    static void        SetMacroPath(const char *newpath);
00265    static Int_t       IncreaseDirLevel();
00266    static void        IndentLevel();
00267    static Bool_t      Initialized();
00268    static Bool_t      MemCheck();
00269    static void        SetDirLevel(Int_t level = 0);
00270    static Int_t       ConvertVersionCode2Int(Int_t code);
00271    static Int_t       ConvertVersionInt2Code(Int_t v);
00272    static Int_t       RootVersionCode();
00273 
00274    ClassDef(TROOT,0)  //Top level (or root) structure for all classes
00275 };
00276 
00277 
00278 R__EXTERN TROOT *gROOT;
00279 namespace ROOT {
00280    TROOT *GetROOT();
00281 }
00282 #endif

Generated on Tue Jul 5 14:10:29 2011 for ROOT_528-00b_version by  doxygen 1.5.1