Re: gPad

From: Alexnder Zvyagin (zvyagin@mail.cern.ch)
Date: Tue Feb 29 2000 - 10:28:38 MET


Hi,

>    in the current version gPad is actually a function with the name Pad().
> So you can use if (Pad())... However, due to possible name clashes with
> other global functions from other libraries we've changed Pad() to R__Pad()
> in the coming release. So, use Pad() now and change to R__Pad() when you 
> get the next release.
> 
> Cheers, Fons.

It seems that static method of class TPad will be good here, something 
like this:

class TPad : public TVirtualPad
{
 ....
 public:
   static TPad * Pad(void);  // or another, better name of this method
 ....
};

And user have to use TPad::Pad() instead of gPad.
The benefits are
1) this is good C++/OO construction (global property of the class)
2) it does not pollute global namespace.

What do you think about replacing ALL global
ROOT variables (gDirectory, gFile, ...) by static methods of theirs
classes:   TDirectory::Dir(), TFile::File(), ...

Of course this is not necessary. But if this thing (using static methods
of classes instead of global variables) will be intoduced, ROOT code will
be more flexible (for such modifications like supporting threads).

P.S. Please remember, moving all ROOT classes in ROOT namespace will
eliminate problem with
"name clashes with  other global functions from other libraries"

With best wishes,
Alexander Zvyagin.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET