| 1 | #ifndef MARS_MArgs
|
|---|
| 2 | #define MARS_MArgs
|
|---|
| 3 |
|
|---|
| 4 | #ifndef ROOT_TNamed
|
|---|
| 5 | #include <TNamed.h>
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | #ifndef ROOT_TList
|
|---|
| 9 | #include <TList.h>
|
|---|
| 10 | #endif
|
|---|
| 11 |
|
|---|
| 12 | class MArgsEntry : public TString, public TObject
|
|---|
| 13 | {
|
|---|
| 14 | public:
|
|---|
| 15 | MArgsEntry(const char *c) : TString(c), TObject() {}
|
|---|
| 16 |
|
|---|
| 17 | void Print(const Option_t *o) const;
|
|---|
| 18 |
|
|---|
| 19 | ClassDef(MArgsEntry, 0)
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | class MArgs : public TNamed
|
|---|
| 23 | {
|
|---|
| 24 | private:
|
|---|
| 25 | Int_t fArgc;
|
|---|
| 26 | TList *fArgv; //->
|
|---|
| 27 |
|
|---|
| 28 | public:
|
|---|
| 29 | MArgs(int argc, char **argv);
|
|---|
| 30 | ~MArgs();
|
|---|
| 31 |
|
|---|
| 32 | void Print(const Option_t *o="") const;
|
|---|
| 33 |
|
|---|
| 34 | // FIXME: Add max, min option
|
|---|
| 35 | // FIXME: Add default option
|
|---|
| 36 |
|
|---|
| 37 | Int_t GetInt(const TString name) const;
|
|---|
| 38 | Double_t GetFloat(const TString name) const;
|
|---|
| 39 | TString GetString(const TString name) const;
|
|---|
| 40 |
|
|---|
| 41 | Int_t GetIntAndRemove(const TString name);
|
|---|
| 42 | Double_t GetFloatAndRemove(const TString name);
|
|---|
| 43 | TString GetStringAndRemove(const TString name);
|
|---|
| 44 |
|
|---|
| 45 | Bool_t Has(const TString name) const;
|
|---|
| 46 | Bool_t HasOnly(const TString name) const;
|
|---|
| 47 | Bool_t HasOption(const TString name) const;
|
|---|
| 48 | Bool_t HasOnlyAndRemove(const TString name);
|
|---|
| 49 |
|
|---|
| 50 | TString GetArgumentStr(Int_t i) const;
|
|---|
| 51 | Int_t GetArgumentInt(Int_t i) const;
|
|---|
| 52 | Float_t GetArgumentFloat(Int_t i) const;
|
|---|
| 53 | Int_t GetNumArguments() const;
|
|---|
| 54 | Int_t GetNumOptions() const;
|
|---|
| 55 | Int_t GetNumEntries() const;
|
|---|
| 56 |
|
|---|
| 57 | ClassDef(MArgs, 0) //Class to parse command line arguments
|
|---|
| 58 | };
|
|---|
| 59 |
|
|---|
| 60 | #endif
|
|---|