Ignore:
Timestamp:
11/16/01 15:59:05 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1080 r1086  
    221221    *fLog << all << "Ready!" << endl << endl;
    222222
    223     clock.Print();
    224 
    225223    *fLog << dec << endl << "CPU  - "
    226224        << "Time: " << clock.CpuTime() << "s"
  • trunk/MagicSoft/Mars/mbase/MGList.cc

    r1080 r1086  
    3838
    3939#include <TClass.h>
     40#include <TGClient.h>
    4041#include <TGWidget.h>
     42#include <TGPicture.h>
    4143
    4244
    4345ClassImp(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
     54MGList::~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}
    4471
    4572// --------------------------------------------------------------------------
     
    137164// --------------------------------------------------------------------------
    138165//
     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//
     169void 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//
     198const 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//
     217const 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//
    139225//  Search the list for a object derived from TGidget which has the given
    140226//  widget id. Returns a pointer to this object otherwise NULL.
  • trunk/MagicSoft/Mars/mbase/MGList.h

    r1076 r1086  
    77
    88class TGWidget;
     9class TGPicture;
    910
    1011class MGList : public TList
     
    1415    Bool_t    IsExisting(TObject *obj) const;
    1516
     17    void      AddPicture(const TGPicture *pic);
     18
    1619public:
    1720    MGList() : TList() {}
     21    virtual ~MGList();
    1822
    1923    void Add(TObject *obj);
    2024    void Add(TObject *obj, Option_t *opt);
    2125
     26    const TGPicture *GetPicture(const char *name);
     27    const TGPicture *GetPicture(const char *name, Int_t width, Int_t height);
    2228
    2329    TObject *FindWidget(Int_t id) const;
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r1077 r1086  
    2222class ofstream;
    2323class ifstream;
    24 /*
    25 class MParContainer : public TObject
    26 {
    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 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 
    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 containers
    81 };
    82 */
    8324
    8425class MParContainer : public TObject
  • trunk/MagicSoft/Mars/mbase/MReadTree.h

    r1084 r1086  
    2424    TList  *fNotify;           // List of TObjects to notify when switching files
    2525
    26     TGProgressBar *fProgress;  // Possible display of status
     26    TGProgressBar  *fProgress; //! Possible display of status
    2727
    2828    void SetBranchStatus(const TList *list, Bool_t status);
     
    3232    void EnableBranches(MParList *plist);
    3333    void EnableBranchChoosing();
     34
     35    virtual void SetReadyToSave(Bool_t flag=kTRUE);
    3436
    3537    enum { kIsOwner = BIT(14) };
     
    5860    virtual void   AddNotify(TObject *obj);
    5961    virtual void   SetOwner(Bool_t flag=kTRUE);
    60     virtual void   SetReadyToSave(Bool_t flag=kTRUE);
    6162    virtual void   Print(Option_t *opt="") const;
    6263
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r1084 r1086  
    1616!
    1717!
    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>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2001
     
    6767#include "MTask.h"
    6868
    69 #include <TMethod.h>
    70 #include <TOrdCollection.h>
    71 
    7269#include "MLog.h"
    7370#include "MLogManip.h"
     
    227224void MTask::PrintStatistics(const Int_t lvl) const
    228225{
    229     *fLog << setw(lvl) << " " << GetDescriptor() << "\t";
     226    *fLog << all << setw(lvl) << " " << GetDescriptor() << "\t";
    230227    *fLog << dec << fNumExecutions << endl;
    231228}
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1084 r1086  
    240240    }
    241241
    242     *fLog << endl;
     242    *fLog << all << endl;
    243243
    244244    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MWriteRootFile.cc

    r1080 r1086  
    7272    //
    7373    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();
    7581
    7682    //
     
    118124void MWriteRootFile::Print(Option_t *) const
    119125{
    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;
    124131    TIter Next(&fTrees);
    125132    while ((t=(TTree*)Next()))
    126         cout << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
     133        *fLog << t->GetName() << ": \t" << t->GetEntries() << " entries." << endl;
    127134}
    128135
Note: See TracChangeset for help on using the changeset viewer.