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