| 1 | #ifndef MARS_MParContainer
|
|---|
| 2 | #define MARS_MParContainer
|
|---|
| 3 |
|
|---|
| 4 | //////////////////////////////////////////////////////////////////////////
|
|---|
| 5 | // //
|
|---|
| 6 | // MParContainer //
|
|---|
| 7 | // //
|
|---|
| 8 | // The basis for all parameter containers //
|
|---|
| 9 | // //
|
|---|
| 10 | //////////////////////////////////////////////////////////////////////////
|
|---|
| 11 | #ifndef MARS_MAGIC
|
|---|
| 12 | #include "MAGIC.h"
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 | #ifndef ROOT_TObject
|
|---|
| 16 | #include <TObject.h>
|
|---|
| 17 | #endif
|
|---|
| 18 | #ifndef ROOT_TString
|
|---|
| 19 | #include <TString.h>
|
|---|
| 20 | #endif
|
|---|
| 21 |
|
|---|
| 22 | class ofstream;
|
|---|
| 23 | class ifstream;
|
|---|
| 24 |
|
|---|
| 25 | class MParContainer : public TObject
|
|---|
| 26 | {
|
|---|
| 27 | protected:
|
|---|
| 28 | TString fName; // parameter container identifier (name)
|
|---|
| 29 | TString fTitle; // parameter container title
|
|---|
| 30 |
|
|---|
| 31 | MLog *fLog; // The general log facility for this object, initialized with the global object
|
|---|
| 32 |
|
|---|
| 33 | private:
|
|---|
| 34 | Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow
|
|---|
| 35 |
|
|---|
| 36 | public:
|
|---|
| 37 | MParContainer(const char *name="", const char *title="") : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 38 | MParContainer(const TString &name, const TString &title) : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 39 | MParContainer(const MParContainer &named);
|
|---|
| 40 | MParContainer& operator=(const MParContainer& rhs);
|
|---|
| 41 | virtual ~MParContainer() {}
|
|---|
| 42 |
|
|---|
| 43 | virtual TObject *Clone(const char *newname="") const;
|
|---|
| 44 | virtual Int_t Compare(const TObject *obj) const;
|
|---|
| 45 | virtual void Copy(TObject &named);
|
|---|
| 46 | virtual void FillBuffer(char *&buffer);
|
|---|
| 47 |
|
|---|
| 48 | virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
|
|---|
| 49 | virtual const char *GetName() const { return fName.Data(); }
|
|---|
| 50 | virtual const char *GetTitle() const { return fTitle.Data(); }
|
|---|
| 51 | virtual ULong_t Hash() const { return fName.Hash(); }
|
|---|
| 52 | virtual Bool_t IsSortable() const { return kTRUE; }
|
|---|
| 53 |
|
|---|
| 54 | virtual void SetName(const char *name); // *MENU*
|
|---|
| 55 | virtual void SetObject(const char *name, const char *title);
|
|---|
| 56 | virtual void SetTitle(const char *title=""); // *MENU*
|
|---|
| 57 | virtual void ls(Option_t *option="") const;
|
|---|
| 58 | virtual void Print(Option_t *option="") const;
|
|---|
| 59 | virtual Int_t Sizeof() const;
|
|---|
| 60 |
|
|---|
| 61 | virtual void SetLogStream(MLog *lg) { fLog = lg; }
|
|---|
| 62 | virtual void Reset() { }
|
|---|
| 63 | virtual Bool_t IsReadyToSave() { return fReadyToSave; }
|
|---|
| 64 | virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
|
|---|
| 65 |
|
|---|
| 66 | virtual void AsciiRead(ifstream &fin);
|
|---|
| 67 | virtual void AsciiWrite(ofstream &fout) const;
|
|---|
| 68 |
|
|---|
| 69 | ClassDef(MParContainer, 0) //The basis for all parameter containers
|
|---|
| 70 | };
|
|---|
| 71 |
|
|---|
| 72 | /*
|
|---|
| 73 | class MParContainer : public TNamed
|
|---|
| 74 | {
|
|---|
| 75 | protected:
|
|---|
| 76 | MLog *fLog; //! The general log facility for this object, initialized with the global object
|
|---|
| 77 |
|
|---|
| 78 | private:
|
|---|
| 79 | Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
|
|---|
| 80 |
|
|---|
| 81 | public:
|
|---|
| 82 | MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 83 | MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 84 |
|
|---|
| 85 | void SetLogStream(MLog *lg) { fLog = lg; }
|
|---|
| 86 |
|
|---|
| 87 | virtual void Reset() { }
|
|---|
| 88 |
|
|---|
| 89 | virtual Bool_t IsReadyToSave() { return fReadyToSave; }
|
|---|
| 90 | virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
|
|---|
| 91 |
|
|---|
| 92 | virtual void AsciiRead(ifstream &fin);
|
|---|
| 93 | virtual void AsciiWrite(ofstream &fout) const;
|
|---|
| 94 |
|
|---|
| 95 | ClassDef(MParContainer, 0) //The basis for all parameter containers
|
|---|
| 96 | };
|
|---|
| 97 | */
|
|---|
| 98 | #endif
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|