Logo ROOT   6.12/07
Reference Guide
TGlobal.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Rene Brun 13/11/95
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 #ifndef ROOT_TGlobal
13 #define ROOT_TGlobal
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGlobal //
19 // //
20 // Global variables class (global variables are obtained from CINT). //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TDictionary.h"
25 
26 
27 class TGlobal : public TDictionary {
28 
29 private:
30  DataMemberInfo_t *fInfo; //!pointer to CINT data member info
31 
32 public:
33  TGlobal(DataMemberInfo_t *info = 0);
34  TGlobal (const TGlobal &);
35  TGlobal &operator=(const TGlobal &);
36 
37  virtual ~TGlobal();
38  virtual Int_t GetArrayDim() const;
39  virtual DeclId_t GetDeclId() const;
40  virtual Int_t GetMaxIndex(Int_t dim) const;
41  virtual void *GetAddress() const;
42  virtual const char *GetTypeName() const;
43  virtual const char *GetFullTypeName() const;
44  virtual Bool_t IsValid();
45  virtual Long_t Property() const;
46  virtual bool Update(DataMemberInfo_t *info);
47 
48  ClassDef(TGlobal,2) //Global variable class
49 };
50 
51  //Class to map the "funcky" globals and be able to add them to the list of globals.
53  public:
54  typedef void* (*GlobalFunc_t)();
55  TGlobalMappedFunction(const char* name, const char* type,
56  GlobalFunc_t funcPtr):fFuncPtr(funcPtr)
57  {
58  SetNameTitle(name, type);
59  }
61  Int_t GetArrayDim() const { return 0;}
62  DeclId_t GetDeclId() const { return (DeclId_t)(fFuncPtr); } // Used as DeclId because of uniqueness
63  Int_t GetMaxIndex(Int_t /*dim*/) const { return -1; }
64  void *GetAddress() const { return (*fFuncPtr)(); }
65  const char *GetTypeName() const { return fTitle; }
66  const char *GetFullTypeName() const { return fTitle; }
67  Long_t Property() const { return 0; }
68  virtual bool Update(DataMemberInfo_t * /*info*/) { return false; }
69  static void Add(TGlobalMappedFunction* gmf);
70 
71  private:
72 
73  GlobalFunc_t fFuncPtr; // Function to call to get the address
74 
75  TGlobalMappedFunction &operator=(const TGlobal &); // not implemented.
76  // Some of the special ones are created before the list is create e.g gFile
77  // We need to buffer them.
78  static TList& GetEarlyRegisteredGlobals();
79 
80  friend class TROOT;
81  };
82 
83 #endif
TString fTitle
Definition: TNamed.h:33
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TGlobal.h:67
virtual DeclId_t GetDeclId() const
Definition: TGlobal.cxx:93
ROOT top level object description.
Definition: TROOT.h:100
DataMemberInfo_t * fInfo
Definition: TGlobal.h:30
virtual Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
Definition: TGlobal.cxx:101
virtual ~TGlobal()
TGlobal dtor deletes adopted CINT DataMemberInfo object.
Definition: TGlobal.cxx:69
virtual const char * GetFullTypeName() const
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TGlobal.cxx:120
const char * GetFullTypeName() const
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TGlobal.h:66
const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.h:65
virtual void * GetAddress() const
Return address of global.
Definition: TGlobal.cxx:77
DeclId_t GetDeclId() const
Definition: TGlobal.h:62
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition: TNamed.cxx:154
const void * DeclId_t
Definition: TDictionary.h:205
virtual Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TGlobal.cxx:148
#define ClassDef(name, id)
Definition: Rtypes.h:320
void * GetAddress() const
Return address of global.
Definition: TGlobal.h:64
A doubly linked list.
Definition: TList.h:44
TGlobalMappedFunction(const char *name, const char *type, GlobalFunc_t funcPtr)
Definition: TGlobal.h:55
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
virtual Bool_t IsValid()
Return true if this global object is pointing to a currently loaded global.
Definition: TGlobal.cxx:131
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:27
GlobalFunc_t fFuncPtr
Definition: TGlobal.h:73
virtual Int_t GetArrayDim() const
Return number of array dimensions.
Definition: TGlobal.cxx:85
virtual bool Update(DataMemberInfo_t *)
Update the TFunction to reflect the new info.
Definition: TGlobal.h:68
long Long_t
Definition: RtypesCore.h:50
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:308
Int_t GetArrayDim() const
Return number of array dimensions.
Definition: TGlobal.h:61
virtual const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.cxx:111
int type
Definition: TGX11.cxx:120
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
Definition: TGlobal.cxx:160
TGlobal & operator=(const TGlobal &)
Assignment operator.
Definition: TGlobal.cxx:53
Int_t GetMaxIndex(Int_t) const
Return maximum index for array dimension "dim".
Definition: TGlobal.h:63
TGlobal(DataMemberInfo_t *info=0)
pointer to CINT data member info
Definition: TGlobal.cxx:30
virtual ~TGlobalMappedFunction()
Definition: TGlobal.h:60
char name[80]
Definition: TGX11.cxx:109