Request: TROOT::GetBatch

Hi, we have a TROOT::SetBatch method to set batch mode, but there is no way (that I can tell) to programmatically determine if we are in batch mode or not. Unfortunately the fBatch data member of TROOT is protected, so we can’t check directly, and it can’t be made public without violating some OOP principles.

In line with the usual ROOT OOP style, I think we should have a “getter” method for TROOT:

Bool_t TROOT::GetBatch() const { return fBatch; };

This would allow (for example) a macro to switch into batch mode for some things, then switch back to whatever the “old mode” was before. Currently there is no way for a script to know what is the “old mode” without keeping track manually of all the SetBatch calls.

Thanks,
Jean-François

Hi Jean-François,

And what about TROOT::IsBatch()? :wink:

Cheers, Bertrand.

Blagh, alright, so I guess it’s still violating the GetX/SetX idiom that I have come to expect from ROOT. I thought the IsX methods would be for things you can’t directly set, like TFile::IsZombie().

I guess no one would be willing to add a GetBatch method that is a duplicate of IsBatch, given that TROOT already has way too many methods. At least now if people search for “GetBatch” and “fBatch” they will find this thread, and Bertrand’s answer.

Jean-François

I do not want to make this discussion too long but seems to me an IsX method is meant to request the “state” of an Object (in that case ROOT itself) whereas a GetX method is meant to Get a value from an Object. In that sense the IsBatch method seems the correct name. Of course I am sure you can find some counter examples in ROOT… :slight_smile: