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

Last change on this file was 1574, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 4.6 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 TDataMember;
26class TMethodCall;
27
28class MParContainer : public TObject
29{
30protected:
31 TString fName; // parameter container identifier (name)
32 TString fTitle; // parameter container title
33
34 MLog *fLog; // The general log facility for this object, initialized with the global object
35
36private:
37 enum {
38 kIsSavedAsPrimitive = BIT(15)
39 };
40
41 Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow
42
43 virtual void StreamPrimitive(ofstream &out) const;
44
45public:
46 MParContainer(const char *name="", const char *title="") : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
47 MParContainer(const TString &name, const TString &title) : fName(name), fTitle(title), fLog(&gLog), fReadyToSave(kFALSE) { }
48 MParContainer(const MParContainer &named);
49 MParContainer& operator=(const MParContainer& rhs);
50 virtual ~MParContainer() {}
51
52 virtual TObject *Clone(const char *newname="") const;
53 virtual Int_t Compare(const TObject *obj) const;
54 virtual void Copy(TObject &named);
55 virtual void FillBuffer(char *&buffer);
56
57 virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
58 virtual const TString GetUniqueName() const;
59 virtual const char *GetName() const { return fName.Data(); }
60 virtual const char *GetTitle() const { return fTitle.Data(); }
61 virtual ULong_t Hash() const { return fName.Hash(); }
62 virtual Bool_t IsSortable() const { return kTRUE; }
63
64 virtual void SetName(const char *name); // *MENU*
65 virtual void SetObject(const char *name, const char *title);
66 virtual void SetTitle(const char *title=""); // *MENU*
67 virtual void ls(Option_t *option="") const;
68 virtual void Print(Option_t *option="") const;
69 virtual Int_t Sizeof() const;
70 virtual void SavePrimitive(ofstream &out, Option_t *o="");
71
72 virtual MParContainer *New() const;
73 virtual void SetLogStream(MLog *lg) { fLog = lg; }
74 virtual void Reset() { }
75 virtual Bool_t IsReadyToSave() const { return fReadyToSave; }
76 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
77 virtual Bool_t IsSavedAsPrimitive() const { return TestBit(kIsSavedAsPrimitive); }
78
79 TMethodCall *GetterMethod(const char *name) const;
80
81 Bool_t WriteDataMember(ostream &out, const char *member, Double_t scale=1) const;
82 Bool_t WriteDataMember(ostream &out, const TDataMember *member, Double_t scale=1) const;
83 Bool_t WriteDataMember(ostream &out, const TList *list) const;
84
85 virtual void AsciiRead(ifstream &fin);
86 virtual Bool_t AsciiWrite(ostream &out) const;
87
88 virtual void GetNames(TObjArray &arr) const;
89 virtual void SetNames(TObjArray &arr);
90
91 ClassDef(MParContainer, 0) //The basis for all parameter containers
92};
93
94/*
95class MParContainer : public TNamed
96{
97protected:
98 MLog *fLog; //! The general log facility for this object, initialized with the global object
99
100private:
101 Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
102
103public:
104 MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
105 MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
106
107 void SetLogStream(MLog *lg) { fLog = lg; }
108
109 virtual void Reset() { }
110
111 virtual Bool_t IsReadyToSave() { return fReadyToSave; }
112 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
113
114 virtual void AsciiRead(ifstream &fin);
115 virtual void AsciiWrite(ofstream &fout) const;
116
117 ClassDef(MParContainer, 0) //The basis for all parameter containers
118};
119*/
120#endif
121
122
Note: See TracBrowser for help on using the repository browser.