ROOT  6.06/09
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 #ifndef ROOT_TDictionary
25 #include "TDictionary.h"
26 #endif
27 
28 
29 class TGlobal : public TDictionary {
30 
31 private:
32  DataMemberInfo_t *fInfo; //!pointer to CINT data member info
33 
34 public:
35  TGlobal(DataMemberInfo_t *info = 0);
36  TGlobal (const TGlobal &);
37  TGlobal &operator=(const TGlobal &);
38 
39  virtual ~TGlobal();
40  virtual Int_t GetArrayDim() const;
41  virtual DeclId_t GetDeclId() const;
42  virtual Int_t GetMaxIndex(Int_t dim) const;
43  virtual void *GetAddress() const;
44  virtual const char *GetTypeName() const;
45  virtual const char *GetFullTypeName() const;
46  virtual Bool_t IsValid();
47  virtual Long_t Property() const;
48  virtual bool Update(DataMemberInfo_t *info);
49 
50  ClassDef(TGlobal,2) //Global variable class
51 };
52 
53  //Class to map the "funcky" globals and be able to add them to the list of globals.
55  public:
56  typedef void* (*GlobalFunc_t)();
57  TGlobalMappedFunction(const char* name, const char* type,
58  GlobalFunc_t funcPtr):fFuncPtr(funcPtr)
59  {
60  SetNameTitle(name, type);
61  }
63  Int_t GetArrayDim() const { return 0;}
64  DeclId_t GetDeclId() const { return (DeclId_t)(fFuncPtr); } // Used as DeclId because of uniqueness
65  Int_t GetMaxIndex(Int_t /*dim*/) const { return -1; }
66  void *GetAddress() const { return (*fFuncPtr)(); }
67  const char *GetTypeName() const { return fTitle; }
68  const char *GetFullTypeName() const { return fTitle; }
69  Long_t Property() const { return 0; }
70  virtual bool Update(DataMemberInfo_t * /*info*/) { return false; }
71  static void Add(TGlobalMappedFunction* gmf);
72 
73  private:
74 
75  GlobalFunc_t fFuncPtr; // Function to call to get the address
76 
77  TGlobalMappedFunction &operator=(const TGlobal &); // not implemented.
78  // Some of the special ones are created before the list is create e.g gFile
79  // We need to buffer them.
81 
82  friend class TROOT;
83  };
84 
85 #endif
TString fTitle
Definition: TNamed.h:37
virtual const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.cxx:111
ROOT top level object description.
Definition: TROOT.h:80
DataMemberInfo_t * fInfo
Definition: TGlobal.h:32
virtual ~TGlobal()
TGlobal dtor deletes adopted CINT DataMemberInfo object.
Definition: TGlobal.cxx:69
Int_t GetMaxIndex(Int_t) const
Return maximum index for array dimension "dim".
Definition: TGlobal.h:65
const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.h:67
virtual Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
Definition: TGlobal.cxx:101
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t GetArrayDim() const
Return number of array dimensions.
Definition: TGlobal.cxx:85
virtual void SetNameTitle(const char *name, const char *title)
Change (i.e. set) all the TNamed parameters (name and title).
Definition: TNamed.cxx:142
const void * DeclId_t
Definition: TDictionary.h:209
static TList & GetEarlyRegisteredGlobals()
Definition: TGlobal.cxx:171
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual DeclId_t GetDeclId() const
Definition: TGlobal.cxx:93
void * GetAddress() const
Return address of global.
Definition: TGlobal.h:66
A doubly linked list.
Definition: TList.h:47
TGlobalMappedFunction(const char *name, const char *type, GlobalFunc_t funcPtr)
Definition: TGlobal.h:57
virtual const char * GetFullTypeName() const
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TGlobal.cxx:120
DeclId_t GetDeclId() const
Definition: TGlobal.h:64
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:162
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TGlobal.h:69
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:29
GlobalFunc_t fFuncPtr
Definition: TGlobal.h:75
TGlobalMappedFunction & operator=(const TGlobal &)
virtual bool Update(DataMemberInfo_t *)
Update the TFunction to reflect the new info.
Definition: TGlobal.h:70
long Long_t
Definition: RtypesCore.h:50
static void Add(TGlobalMappedFunction *gmf)
Definition: TGlobal.cxx:178
int type
Definition: TGX11.cxx:120
virtual void * GetAddress() const
Return address of global.
Definition: TGlobal.cxx:77
virtual bool Update(DataMemberInfo_t *info)
Update the TFunction to reflect the new info.
Definition: TGlobal.cxx:160
const char * GetFullTypeName() const
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TGlobal.h:68
#define name(a, b)
Definition: linkTestLib0.cpp:5
Int_t GetArrayDim() const
Return number of array dimensions.
Definition: TGlobal.h:63
TGlobal & operator=(const TGlobal &)
Assignment operator.
Definition: TGlobal.cxx:53
TGlobal(DataMemberInfo_t *info=0)
pointer to CINT data member info
void *(* GlobalFunc_t)()
Definition: TGlobal.h:56
virtual ~TGlobalMappedFunction()
Definition: TGlobal.h:62
virtual Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TGlobal.cxx:148