| 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 | private:
|
|---|
| 28 | void Init(const char *name, const char *title)
|
|---|
| 29 | {
|
|---|
| 30 | fName = new TString;
|
|---|
| 31 | (*fName) = name;
|
|---|
| 32 | fTitle = new TString;
|
|---|
| 33 | (*fTitle) = title;
|
|---|
| 34 |
|
|---|
| 35 | cout << " <***> " << flush;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | protected:
|
|---|
| 39 | MLog *fLog; //! The general log facility for this object, initialized with the global object
|
|---|
| 40 |
|
|---|
| 41 | TString *fName; //! parameter container identifier (name)
|
|---|
| 42 | TString *fTitle; //! parameter container title
|
|---|
| 43 |
|
|---|
| 44 | Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
|
|---|
| 45 |
|
|---|
| 46 | public:
|
|---|
| 47 | MParContainer(const char *name="", const char *title="") : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
|
|---|
| 48 | MParContainer(const TString &name, const TString &title) : fLog(&gLog), fReadyToSave(kFALSE) { Init(name, title); }
|
|---|
| 49 | MParContainer(const MParContainer &named);
|
|---|
| 50 | MParContainer& operator=(const MParContainer& rhs);
|
|---|
| 51 |
|
|---|
| 52 | void SetLogStream(MLog *lg) { fLog = lg; }
|
|---|
| 53 |
|
|---|
| 54 | virtual ~MParContainer() {
|
|---|
| 55 | //delete fName; delete fTitle;
|
|---|
| 56 | }
|
|---|
| 57 | virtual TObject *Clone(const char *newname) const;
|
|---|
| 58 | virtual Int_t Compare(const TObject *obj) const;
|
|---|
| 59 | virtual void Copy(TObject &named);
|
|---|
| 60 | virtual void FillBuffer(char *&buffer);
|
|---|
| 61 | virtual const char *GetName() const {return fName->Data();}
|
|---|
| 62 | virtual const char *GetTitle() const {return fTitle->Data();}
|
|---|
| 63 | virtual ULong_t Hash() { return fName->Hash(); }
|
|---|
| 64 | virtual Bool_t IsSortable() const { return kTRUE; }
|
|---|
| 65 | virtual void SetName(const char *name); // *MENU*
|
|---|
| 66 | virtual void SetObject(const char *name, const char *title);
|
|---|
| 67 | virtual void SetTitle(const char *title=""); // *MENU*
|
|---|
| 68 | virtual void ls(Option_t *option="") const;
|
|---|
| 69 | virtual void Print(Option_t *option="") const;
|
|---|
| 70 | virtual Int_t Sizeof() const;
|
|---|
| 71 |
|
|---|
| 72 | virtual void Reset() {};
|
|---|
| 73 |
|
|---|
| 74 | virtual Bool_t IsReadyToSave() { return fReadyToSave; }
|
|---|
| 75 | virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
|
|---|
| 76 |
|
|---|
| 77 | virtual void AsciiRead(ifstream &fin);
|
|---|
| 78 | virtual void AsciiWrite(ofstream &fout) const;
|
|---|
| 79 |
|
|---|
| 80 | ClassDef(MParContainer, 0) //The basis for all parameter containers
|
|---|
| 81 | };
|
|---|
| 82 | */
|
|---|
| 83 |
|
|---|
| 84 | class MParContainer : public TObject
|
|---|
| 85 | {
|
|---|
| 86 | protected:
|
|---|
| 87 | TString fName; // parameter container identifier (name)
|
|---|
| 88 | TString fTitle; // parameter container title
|
|---|
| 89 |
|
|---|
| 90 | MLog *fLog; // The general log facility for this object, initialized with the global object
|
|---|
| 91 |
|
|---|
| 92 | private:
|
|---|
| 93 | Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow
|
|---|
| 94 |
|
|---|
| 95 | public:
|
|---|
| 96 | MParContainer(const char *name="", const char *title="") : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 97 | MParContainer(const TString &name, const TString &title) : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 98 | MParContainer(const MParContainer &named);
|
|---|
| 99 | MParContainer& operator=(const MParContainer& rhs);
|
|---|
| 100 | virtual ~MParContainer() {}
|
|---|
| 101 |
|
|---|
| 102 | virtual TObject *Clone(const char *newname="") const;
|
|---|
| 103 | virtual Int_t Compare(const TObject *obj) const;
|
|---|
| 104 | virtual void Copy(TObject &named);
|
|---|
| 105 | virtual void FillBuffer(char *&buffer);
|
|---|
| 106 |
|
|---|
| 107 | virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
|
|---|
| 108 | virtual const char *GetName() const { return fName.Data(); }
|
|---|
| 109 | virtual const char *GetTitle() const { return fTitle.Data(); }
|
|---|
| 110 | virtual ULong_t Hash() const { return fName.Hash(); }
|
|---|
| 111 | virtual Bool_t IsSortable() const { return kTRUE; }
|
|---|
| 112 |
|
|---|
| 113 | virtual void SetName(const char *name); // *MENU*
|
|---|
| 114 | virtual void SetObject(const char *name, const char *title);
|
|---|
| 115 | virtual void SetTitle(const char *title=""); // *MENU*
|
|---|
| 116 | virtual void ls(Option_t *option="") const;
|
|---|
| 117 | virtual void Print(Option_t *option="") const;
|
|---|
| 118 | virtual Int_t Sizeof() const;
|
|---|
| 119 |
|
|---|
| 120 | virtual void SetLogStream(MLog *lg) { fLog = lg; }
|
|---|
| 121 | virtual void Reset() { }
|
|---|
| 122 | virtual Bool_t IsReadyToSave() { return fReadyToSave; }
|
|---|
| 123 | virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
|
|---|
| 124 |
|
|---|
| 125 | virtual void AsciiRead(ifstream &fin);
|
|---|
| 126 | virtual void AsciiWrite(ofstream &fout) const;
|
|---|
| 127 |
|
|---|
| 128 | ClassDef(MParContainer, 0) //The basis for all parameter containers
|
|---|
| 129 | };
|
|---|
| 130 |
|
|---|
| 131 | /*
|
|---|
| 132 | class MParContainer : public TNamed
|
|---|
| 133 | {
|
|---|
| 134 | protected:
|
|---|
| 135 | MLog *fLog; //! The general log facility for this object, initialized with the global object
|
|---|
| 136 |
|
|---|
| 137 | private:
|
|---|
| 138 | Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
|
|---|
| 139 |
|
|---|
| 140 | public:
|
|---|
| 141 | MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 142 | MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
|
|---|
| 143 |
|
|---|
| 144 | void SetLogStream(MLog *lg) { fLog = lg; }
|
|---|
| 145 |
|
|---|
| 146 | virtual void Reset() { }
|
|---|
| 147 |
|
|---|
| 148 | virtual Bool_t IsReadyToSave() { return fReadyToSave; }
|
|---|
| 149 | virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
|
|---|
| 150 |
|
|---|
| 151 | virtual void AsciiRead(ifstream &fin);
|
|---|
| 152 | virtual void AsciiWrite(ofstream &fout) const;
|
|---|
| 153 |
|
|---|
| 154 | ClassDef(MParContainer, 0) //The basis for all parameter containers
|
|---|
| 155 | };
|
|---|
| 156 | */
|
|---|
| 157 | #endif
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|