source: tags/Mars-V0.5/mbase/MParContainer.h

Last change on this file was 1030, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 5.9 KB
Line 
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
22class ofstream;
23class ifstream;
24/*
25class MParContainer : public TObject
26{
27private:
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
38protected:
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
46public:
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
84class MParContainer : public TObject
85{
86protected:
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
92private:
93 Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow
94
95public:
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 *GetName() const { return fName.Data(); }
108 virtual const char *GetTitle() const { return fTitle.Data(); }
109 virtual ULong_t Hash() { return fName.Hash(); }
110 virtual Bool_t IsSortable() const { return kTRUE; }
111
112 virtual void SetName(const char *name); // *MENU*
113 virtual void SetObject(const char *name, const char *title);
114 virtual void SetTitle(const char *title=""); // *MENU*
115 virtual void ls(Option_t *option="") const;
116 virtual void Print(Option_t *option="") const;
117 virtual Int_t Sizeof() const;
118
119 virtual void SetLogStream(MLog *lg) { fLog = lg; }
120 virtual void Reset() { }
121 virtual Bool_t IsReadyToSave() { return fReadyToSave; }
122 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
123
124 virtual void AsciiRead(ifstream &fin);
125 virtual void AsciiWrite(ofstream &fout) const;
126
127 ClassDef(MParContainer, 0) //The basis for all parameter containers
128};
129
130/*
131class MParContainer : public TNamed
132{
133protected:
134 MLog *fLog; //! The general log facility for this object, initialized with the global object
135
136private:
137 Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
138
139public:
140 MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
141 MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
142
143 void SetLogStream(MLog *lg) { fLog = lg; }
144
145 virtual void Reset() { }
146
147 virtual Bool_t IsReadyToSave() { return fReadyToSave; }
148 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
149
150 virtual void AsciiRead(ifstream &fin);
151 virtual void AsciiWrite(ofstream &fout) const;
152
153 ClassDef(MParContainer, 0) //The basis for all parameter containers
154};
155*/
156#endif
157
158
Note: See TracBrowser for help on using the repository browser.