Ignore:
Timestamp:
09/16/02 10:10:17 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
6 edited

Legend:

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

    r1481 r1524  
    101101TString MFilter::GetRule() const
    102102{
    103     return "<GetRule not available for " + fName + ">";
     103    return "<GetRule n/a for " + fName + ">";
    104104}
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r1268 r1524  
    7575// which is used for the output (i)
    7676//
    77 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL)
     77MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL)
    7878{
    7979    Init();
     
    8585// ofstream as the default output device
    8686//
    87 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fGuiLineId(0),  fout(&out), fOutAllocated(kFALSE), fgui(NULL)
     87MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fout(&out), fOutAllocated(kFALSE), fgui(NULL)
    8888{
    8989    Init();
     
    106106// or not.
    107107//
    108 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fGuiLineId(0),  fgui(NULL)
     108MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0),  fgui(NULL)
    109109{
    110110    Init();
     
    132132void MLog::WriteBuffer()
    133133{
     134    //
     135    // restart writing to the buffer at its first char
     136    //
    134137    const int len = fPPtr - fBase;
     138
     139    fPPtr = fBase;
     140
     141    if (fIsNull)
     142        return;
    135143
    136144    if (fDevice&eStdout)
     
    153161        delete dummy;
    154162    }
    155 
    156     //
    157     // restart writing to the buffer at its first char
    158     //
    159     fPPtr = fBase;
    160163}
    161164
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r1014 r1524  
    3131    UInt_t fDebugLevel;      //! Present global debug level
    3232    UInt_t fDevice;          //! Flag to indicate the present streams
     33
     34    Bool_t fIsNull;          //! Switch output completely off
    3335
    3436    Int_t fGuiLineId;
     
    122124    }
    123125
     126    void SetNullOutput(Bool_t n=kTRUE) { fIsNull = n; }
     127
    124128    ClassDef(MLog, 0) // This is what we call 'The logging system'
    125129};
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1487 r1524  
    5050#include "MLogManip.h"
    5151
     52#include "MIter.h"
     53
    5254ClassImp(MParList);
    5355
     
    105107    //     automatically deleted.
    106108    //
    107     TestBit(kIsOwner) ? fContainer->SetOwner() : fAutodelete->SetOwner();
     109    IsOwner() ? fContainer->SetOwner() : fAutodelete->SetOwner();
     110
     111    // FIXME? If fContainer is owner do we have to remove the object
     112    //   from fAutodelete due to the acces when checking for a
     113    //   garbage collection?
    108114
    109115    delete fContainer;
     
    236242    {
    237243        *fLog << warn << "No object with the same name '";
    238         *fLog << cont->GetName() << "' in list... ignored." << endl;
    239         return kFALSE;
     244        *fLog << cont->GetName() << "' in list... adding." << endl;
     245        return AddToList(cont);
    240246    }
    241247
    242248    fContainer->Remove(obj);
    243249
    244     if (TestBit(kIsOwner) && !fAutodelete->FindObject(obj))
     250    if (IsOwner() && !fAutodelete->FindObject(obj))
    245251        delete obj;
    246252
    247     *fLog << inf << "MParContainer '" << obj->GetName() << "' found and replaced..." << endl;
     253    *fLog << inf << "MParContainer '" << cont->GetName() << "' found and replaced..." << endl;
    248254
    249255    return AddToList(cont);
     256}
     257
     258// --------------------------------------------------------------------------
     259//
     260//  Find an object with the same name in the list and remove it.
     261//  If the kIsOwner flag is set and the object was not created
     262//  automatically, the object is deleted.
     263//
     264void MParList::Remove(MParContainer *cont)
     265{
     266    //
     267    //  check if the object (you want to add) exists
     268    //
     269    if (!cont)
     270        return;
     271
     272    TObject *obj = fContainer->Remove(cont);
     273    if (!obj)
     274    {
     275        *fLog << warn << "Object not found in list..." << endl;
     276        return;
     277    }
     278
     279    *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
     280
     281    if (IsOwner() && !fAutodelete->FindObject(obj))
     282        delete obj;
    250283}
    251284
     
    470503    TIter Next(fContainer);
    471504    while ((obj=(MParContainer*)Next()))
    472         *fLog << " " << obj->GetDescriptor() << endl;
     505    {
     506        *fLog << " " << obj->GetDescriptor();
     507        if (fAutodelete->FindObject(obj))
     508            *fLog << " <autodel>";
     509        *fLog << endl;
     510    }
    473511    *fLog << endl;
    474512}
     
    492530{
    493531    fContainer->ForEach(MParContainer, Reset)();
    494 }
     532 }
    495533
    496534// --------------------------------------------------------------------------
     
    663701}
    664702
     703void MParList::SavePrimitive(ofstream &out, Option_t *o)
     704{
     705    Bool_t saved = IsSavedAsPrimitive();
     706
     707    MParContainer::SavePrimitive(out);
     708
     709    MIter Next(fContainer);
     710
     711    MParContainer *cont = NULL;
     712    while ((cont=Next()))
     713    {
     714        //
     715        // Because it was automatically created don't store its primitive
     716        // I guess it will be automatically created again
     717        //
     718        if (fAutodelete->FindObject(cont) || cont->IsSavedAsPrimitive())
     719            continue;
     720
     721        cont->SavePrimitive(out, "");
     722
     723        out << "   " << GetUniqueName() << ".";
     724        out << (cont->InheritsFrom("MTaskList") && saved ? "Replace" : "AddToList");
     725        out << "(&" << cont->GetUniqueName() << ");" << endl << endl;
     726    }
     727}
     728
    665729// --------------------------------------------------------------------------
    666730//
     
    680744    }
    681745    out << ";" << endl << endl;
    682 
    683     TIter Next(fContainer);
    684 
    685     MParContainer *cont = NULL;
    686     while ((cont=(MParContainer*)Next()))
    687     {
    688         cont->SavePrimitive(out, "");
    689 
    690         out << "   " << GetUniqueName() << ".AddToList(&";
    691         out << cont->GetUniqueName() << ");" << endl << endl;
    692     }
    693746}
    694747
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r1477 r1524  
    3636
    3737public:
     38    enum { kDoNotReset = BIT(15) };
     39
    3840    MParList(const char *name=NULL, const char *title=NULL);
    3941    MParList(MParList &ts);
     
    4547
    4648    Bool_t Replace(MParContainer *obj);
     49    void   Remove(MParContainer *obj);
    4750
    4851    void SetLogStream(MLog *log);
     
    7881
    7982    void SetOwner(Bool_t enable=kTRUE);
     83    Bool_t IsOwner() const { return TestBit(kIsOwner); }
    8084
    8185    void Print(Option_t *t = NULL) const;
     
    8488    void SetNames(TObjArray &arr);
    8589
     90    void SavePrimitive(ofstream &out, Option_t *o="");
     91
    8692    ClassDef(MParList, 1) // list of parameter containers (MParContainer)
    8793};
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1501 r1524  
    372372    // Reset all containers.
    373373    //
    374     // FIXME: To run a tasklist as a single task in another tasklist we
    375     //        have to make sure, that the Parameter list isn't reset.
    376     //
    377     fParList->SetReadyToSave(kFALSE);
    378     fParList->Reset();
     374    // Make sure, that the parameter list is not reset from a tasklist
     375    // running as a task in another tasklist.
     376    //
     377    const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset);
     378    if (!noreset)
     379    {
     380        fParList->SetReadyToSave();
     381        fParList->Reset();
     382        fParList->SetBit(MParList::kDoNotReset);
     383    }
    379384
    380385    //
     
    428433    }
    429434
     435    if (!noreset)
     436        fParList->ResetBit(MParList::kDoNotReset);
     437
    430438    return kTRUE;
    431439}
Note: See TracChangeset for help on using the changeset viewer.