source: trunk/MagicSoft/Mars/mbase/MParContainer.h@ 1498

Last change on this file since 1498 was 1483, 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
36 virtual void StreamPrimitive(ofstream &out) const;
37
38private:
39 Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow
40
41 enum {
42 kIsSavedAsPrimitive = BIT(15)
43 };
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 void SetLogStream(MLog *lg) { fLog = lg; }
73 virtual void Reset() { }
74 virtual Bool_t IsReadyToSave() const { return fReadyToSave; }
75 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
76 virtual Bool_t IsSavedAsPrimitive() const { return TestBit(kIsSavedAsPrimitive); }
77
78 TMethodCall *GetterMethod(const char *name) const;
79
80 Bool_t WriteDataMember(ostream &out, const char *member, Double_t scale=1) const;
81 Bool_t WriteDataMember(ostream &out, const TDataMember *member, Double_t scale=1) const;
82 Bool_t WriteDataMember(ostream &out, const TList *list) const;
83
84 virtual void AsciiRead(ifstream &fin);
85 virtual Bool_t AsciiWrite(ostream &out) const;
86
87 virtual void GetNames(TObjArray &arr) const;
88 virtual void SetNames(TObjArray &arr);
89
90 ClassDef(MParContainer, 0) //The basis for all parameter containers
91};
92
93/*
94class MParContainer : public TNamed
95{
96protected:
97 MLog *fLog; //! The general log facility for this object, initialized with the global object
98
99private:
100 Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow
101
102public:
103 MParContainer(const char *name="", const char *title="") : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
104 MParContainer(const TString &name, const TString &title) : TNamed(name, title), fLog(&gLog), fReadyToSave(kFALSE) { }
105
106 void SetLogStream(MLog *lg) { fLog = lg; }
107
108 virtual void Reset() { }
109
110 virtual Bool_t IsReadyToSave() { return fReadyToSave; }
111 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; }
112
113 virtual void AsciiRead(ifstream &fin);
114 virtual void AsciiWrite(ofstream &fout) const;
115
116 ClassDef(MParContainer, 0) //The basis for all parameter containers
117};
118*/
119#endif
120
121
Note: See TracBrowser for help on using the repository browser.