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

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