// -*- mode: c++ -*- // // $Id: BrAppOption.h,v 1.3 2001/12/14 15:28:16 cholm Exp $ // // $Log: BrAppOption.h,v $ // Revision 1.3 2001/12/14 15:28:16 cholm // BrAppOption sublcasses now adds them selves to BrAppOptionManager // automatically. Also, the int, float, and string option class can now // hold multiple values. It's all fairly well documented in 'The Guide'. // // Revision 1.2 2001/07/29 15:07:27 cholm // Default arugments to SetValue // // Revision 1.1.1.1 2001/06/21 14:55:15 hagel // Initial revision of brat2 // // Revision 1.4 2001/03/07 12:15:18 cholm // * Defined standard BrModule methods in BrIOModule. // * Add the (simple) class BrHistIOModule. // * BrAppOptionManager and BrAppOption classes changed to not use // BrExceptions. // * Added the method Int_t BrMainModule::Main() to do EVERYTHING. // * Made the method BrModule::Info() const obsolete in favour of // BrModule::Print(Option_t* option="B") const. Impact on other classes. // // Revision 1.3 2001/01/22 19:57:24 cholm // Corrected const-ness of BrAppOption::Compare for old ROOT versions. // Fixed BrModule::Streamer to work with new ROOT. Changed the avaliable // module status values to kStop, kFailure, kAbort, and updated // BrModuleContainer and BrModule accordingly. Also renamed BrIOModule::fStatus // to BrIOModule::fIOStatus. // // Revision 1.2 2001/01/19 16:35:57 cholm // Updated BrAppOption for const'ness of compare. // Added state and status information to BrModule. A container may inspect // these react accordingly, for example by aborting the processing of the // current event, sequnce, run, job, etc. // // Revision 1.1 2000/04/06 20:17:03 cholm // Added the classes BrAppOption, BrAppOptionManager, and // BrDetectorList. The first two are for command line processing, // the third for easy detector list, can be used for many purposes // // #ifndef BRAT_BrAppOption #define BRAT_BrAppOption class TString; class TObject; class BrAppOption : public TObject { protected: Int_t fNValues; Char_t fShortName; TString fLongName; TString fHelpString; public: BrAppOption(Char_t sName, const Char_t* lName, const Char_t* helpString); const Char_t* GetName(void) const { return fLongName.Data(); } const Char_t GetShortName(void) const { return fShortName; } const Char_t* GetLongName(void) const { return fLongName.Data(); } const Char_t* GetHelpString(void) const { return fHelpString.Data(); } virtual Int_t GetNValues() const { return (fNValues == 0 ? 1 : fNValues); } virtual Bool_t SetValue(const Char_t* value=0, Int_t i=-1) = 0; virtual Bool_t NeedValue(void) const = 0; Int_t Compare(const TObject* o) const; Int_t Compare(TObject* o); ULong_t Hash(void); ULong_t Hash(void) const; Bool_t IsSortable(void) const { return kTRUE; } virtual void Print(Option_t* option="") const; ClassDef(BrAppOption,0) // Application option ABC } ; class BrAppIntOption : public BrAppOption { private: Int_t* fValue; //[fNValues] public: BrAppIntOption(Char_t sName, const Char_t* lName, const Char_t* helpString, const Int_t defualtValue=0); operator Int_t () const { return fValue[0]; } Int_t GetValue(Int_t i=0) const; Bool_t SetValue(const Char_t* strValue=0, Int_t i=-1); Bool_t NeedValue(void) const { return kTRUE; } virtual void Print(Option_t* option="") const; ClassDef(BrAppIntOption,0) // Application option class for intergers } ; class BrAppFloatOption : public BrAppOption { private: Float_t* fValue; //[fNValues] public: BrAppFloatOption(Char_t sName, const Char_t* lName, const Char_t* helpString, const Float_t defualtValue=0); operator Float_t () const { return fValue[0]; } Float_t GetValue(Int_t = 0) const; Bool_t SetValue(const Char_t* strValue=0, Int_t i=-1); Bool_t NeedValue(void) const { return kTRUE; } virtual void Print(Option_t* option="") const; ClassDef(BrAppFloatOption,0) // Application option for floating point } ; class BrAppBoolOption : public BrAppOption { private: Bool_t fValue; public: BrAppBoolOption(Char_t sName, const Char_t* lName, const Char_t* helpString, const Bool_t defualtValue=0) : BrAppOption(sName,lName,helpString), fValue(defualtValue) { fNValues = 1; } operator Bool_t () const { return fValue; } Bool_t GetValue(Int_t i=0) const { return fValue; } Bool_t SetValue(const Char_t* strValue=0, Int_t i=-1); Bool_t NeedValue(void) const { return kFALSE; } virtual void Print(Option_t* option="") const; ClassDef(BrAppBoolOption,0) // Application option booleans } ; class BrAppStringOption : public BrAppOption { private: TString* fValue; //[fNValues] public: BrAppStringOption(Char_t sName, const Char_t* lName, const Char_t* helpString, const Char_t* defualtValue=0); operator const Char_t* () const { return fValue[0].Data(); } const Char_t* GetValue(Int_t i=0) const; Bool_t SetValue(const Char_t* strValue=0, Int_t i=-1); Bool_t NeedValue(void) const { return kTRUE; } virtual void Print(Option_t* option="") const; ClassDef(BrAppStringOption,0) // Application option strings } ; #endif