Changeset 1086 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 11/16/01 15:59:05 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1080 r1086 221 221 *fLog << all << "Ready!" << endl << endl; 222 222 223 clock.Print();224 225 223 *fLog << dec << endl << "CPU - " 226 224 << "Time: " << clock.CpuTime() << "s" -
trunk/MagicSoft/Mars/mbase/MGList.cc
r1080 r1086 38 38 39 39 #include <TClass.h> 40 #include <TGClient.h> 40 41 #include <TGWidget.h> 42 #include <TGPicture.h> 41 43 42 44 43 45 ClassImp(MGList); 46 47 // -------------------------------------------------------------------------- 48 // 49 // Before destroying the list with all its contents free all TGPicture 50 // objects in the list. 51 // 52 #include <TRefCnt.h> 53 54 MGList::~MGList() 55 { 56 TObject *obj; 57 TIter Next(this); 58 while ((obj=Next())) 59 { 60 if (!obj->InheritsFrom(TGPicture::Class())) 61 continue; 62 63 // 64 // Remove the object first. Otherwise we would remove 65 // a non existing object... 66 // 67 Remove(obj); 68 gClient->FreePicture((TGPicture*)obj); 69 } 70 } 44 71 45 72 // -------------------------------------------------------------------------- … … 137 164 // -------------------------------------------------------------------------- 138 165 // 166 // Adds the picture physically to the list. The list takes care of that 167 // - The picture is freed as often as it was retrieved from gClient 168 // 169 void MGList::AddPicture(const TGPicture *pic) 170 { 171 // 172 // Check whether the picture exists 173 // 174 if (!pic) 175 { 176 cout << "Warning: Requested picture not found... ignored." << endl; 177 return; 178 } 179 180 // 181 // Add the picture to the list 182 // 183 TList::Add(const_cast<TGPicture*>(pic)); 184 } 185 186 // -------------------------------------------------------------------------- 187 // 188 // This gets a picture from the picture pool of the TGClient-object. 189 // The pictures are freed automatically in the dstructor of the list. 190 // The picture counts itself how often it got used, so that only 191 // the first call to GetPicture will craete it and the last call to 192 // FreePicture will destroy it. If you access the picture only via 193 // MGList::GetPicture you don't have to care about. 194 // 195 // Don't try to call FreePicture by yourself for a picture gotten by 196 // GetPicture. This is independant of the kIsOwner bit. 197 // 198 const TGPicture *MGList::GetPicture(const char *name) 199 { 200 const TGPicture *pic = gClient->GetPicture(name); 201 AddPicture(pic); 202 return pic; 203 } 204 205 // -------------------------------------------------------------------------- 206 // 207 // This gets a picture from the picture pool of the TGClient-object. 208 // The pictures are freed automatically in the dstructor of the list. 209 // The picture counts itself how often it got used, so that only 210 // the first call to GetPicture will craete it and the last call to 211 // FreePicture will destroy it. If you access the picture only via 212 // MGList::GetPicture you don't have to care about. 213 // 214 // Don't try to call FreePicture by yourself for a picture gotten by 215 // GetPicture. This is independant of the kIsOwner bit. 216 // 217 const TGPicture *MGList::GetPicture(const char *name, Int_t width, Int_t height) 218 { 219 const TGPicture *pic = gClient->GetPicture(name, width, height); 220 AddPicture(pic); 221 return pic; 222 } 223 // -------------------------------------------------------------------------- 224 // 139 225 // Search the list for a object derived from TGidget which has the given 140 226 // widget id. Returns a pointer to this object otherwise NULL. -
trunk/MagicSoft/Mars/mbase/MGList.h
r1076 r1086 7 7 8 8 class TGWidget; 9 class TGPicture; 9 10 10 11 class MGList : public TList … … 14 15 Bool_t IsExisting(TObject *obj) const; 15 16 17 void AddPicture(const TGPicture *pic); 18 16 19 public: 17 20 MGList() : TList() {} 21 virtual ~MGList(); 18 22 19 23 void Add(TObject *obj); 20 24 void Add(TObject *obj, Option_t *opt); 21 25 26 const TGPicture *GetPicture(const char *name); 27 const TGPicture *GetPicture(const char *name, Int_t width, Int_t height); 22 28 23 29 TObject *FindWidget(Int_t id) const; -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1077 r1086 22 22 class ofstream; 23 23 class ifstream; 24 /*25 class MParContainer : public TObject26 {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 object40 41 TString *fName; //! parameter container identifier (name)42 TString *fTitle; //! parameter container title43 44 Bool_t fReadyToSave; //! should be set to true if the contents of the container is changed somehow45 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 containers81 };82 */83 24 84 25 class MParContainer : public TObject -
trunk/MagicSoft/Mars/mbase/MReadTree.h
r1084 r1086 24 24 TList *fNotify; // List of TObjects to notify when switching files 25 25 26 TGProgressBar *fProgress; //Possible display of status26 TGProgressBar *fProgress; //! Possible display of status 27 27 28 28 void SetBranchStatus(const TList *list, Bool_t status); … … 32 32 void EnableBranches(MParList *plist); 33 33 void EnableBranchChoosing(); 34 35 virtual void SetReadyToSave(Bool_t flag=kTRUE); 34 36 35 37 enum { kIsOwner = BIT(14) }; … … 58 60 virtual void AddNotify(TObject *obj); 59 61 virtual void SetOwner(Bool_t flag=kTRUE); 60 virtual void SetReadyToSave(Bool_t flag=kTRUE);61 62 virtual void Print(Option_t *opt="") const; 62 63 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r1084 r1086 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2001 … … 67 67 #include "MTask.h" 68 68 69 #include <TMethod.h>70 #include <TOrdCollection.h>71 72 69 #include "MLog.h" 73 70 #include "MLogManip.h" … … 227 224 void MTask::PrintStatistics(const Int_t lvl) const 228 225 { 229 *fLog << setw(lvl) << " " << GetDescriptor() << "\t";226 *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t"; 230 227 *fLog << dec << fNumExecutions << endl; 231 228 } -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1084 r1086 240 240 } 241 241 242 *fLog << endl;242 *fLog << all << endl; 243 243 244 244 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc
r1080 r1086 72 72 // 73 73 fBranches.SetOwner(); 74 fTrees.SetOwner(); 74 75 // 76 // Believing the root user guide, TTree instanced are owned by the 77 // directory (file) in which they are. This means we don't have to 78 // care about their destruction. 79 // 80 //fTrees.SetOwner(); 75 81 76 82 // … … 118 124 void MWriteRootFile::Print(Option_t *) const 119 125 { 120 cout << all << " File: " << GetFileName() << endl; 121 cout << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl; 122 123 TTree *t; 126 *fLog << all << " File: " << GetFileName() << endl; 127 *fLog << setfill('-') << setw(strlen(GetFileName())+8) << "" << endl; 128 *fLog << setfill(' '); // FIXME: not resetting setfill results in strange output??? 129 130 TTree *t = NULL; 124 131 TIter Next(&fTrees); 125 132 while ((t=(TTree*)Next())) 126 cout<< t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;133 *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl; 127 134 } 128 135
Note:
See TracChangeset
for help on using the changeset viewer.