Ignore:
Timestamp:
05/02/03 08:56:31 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
6 edited

Legend:

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

    r2042 r2052  
    190190        fDisplay->SetWindowName(TString("Status Display: ")+fName);
    191191        fDisplay->SetIconName(fName);
    192         // Set status lines
    193         fDisplay->SetStatusLine1("PreProcessing...");
    194         fDisplay->SetStatusLine2("");
    195192        // Start automatic update
    196193        fDisplay->StartUpdate();
     
    207204    if (!fTaskList->PreProcess(fParList))
    208205    {
    209         *fLog << err << "Error detected while PreProcessing" << endl;
     206        *fLog << err << "Error detected while PreProcessing." << endl;
    210207        return kFALSE;
    211208    }
     
    422419    //  execute the post process of all tasks
    423420    //
    424     if (fDisplay)
    425     {
    426         // Set status lines
    427         fDisplay->SetStatusLine1("PostProcessing...");
    428         fDisplay->SetStatusLine2("");
    429     }
    430421    return fTaskList->PostProcess();
    431422}
     
    433424// --------------------------------------------------------------------------
    434425//
    435 //  See class description above.
     426// See class description above. Returns kTRUE if PreProcessing,
     427// Processing and PostProcessing was successfull, otherwise kFALSE.
    436428//
    437429Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist)
     
    446438
    447439    //
    448     // Now postprocess all tasks. Only successfully preprocessed tasks are
    449     // postprocessed. If the Postprocessing of one task fail return an error.
     440    // Now postprocess all tasks. Only successfully preprocessed tasks
     441    // are postprocessed. If the Postprocessing of one task fails
     442    // return an error.
    450443    //
    451444    if (!PostProcess())
    452         return kFALSE;
     445    {
     446        *fLog << err << "Error detected while PostProcessing." << endl;
     447        rc = kFALSE;
     448    }
    453449
    454450    if (!fDisplay)
     
    457453    // Set status lines
    458454    fDisplay->SetStatusLine1(fName);
    459     fDisplay->SetStatusLine2(rc ? "Done." : "ERROR");
     455    fDisplay->SetStatusLine2(rc ? "Done." : "Error!");
    460456    // Stop automatic update
    461457    fDisplay->StopUpdate();
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r1895 r2052  
    175175MLog::MLog(MLog &log)
    176176{
    177     fOutputLevel  = log.fOutputLevel;
    178     fDebugLevel   = log.fDebugLevel;
    179     fDevice       = log.fDevice;
     177    fOutputLevel = log.fOutputLevel;
     178    fDebugLevel  = log.fDebugLevel;
     179    fDevice      = log.fDevice;
    180180}
    181181
     
    208208    if (fDevice&eGui && fgui)
    209209    {
    210         char **newstr = new char*[fNumLines+1];
    211 
    212         for (int i=0; i<fNumLines; i++)
    213             newstr[i] = fGuiLines[i];
    214 
    215         if (fNumLines>0)
    216             delete fGuiLines;
    217 
    218         char *dummy = new char[len];
    219         memcpy(dummy, fBase, len-1);
    220         dummy[len-1]='\0';
    221 
    222         newstr[fNumLines++] = dummy;
    223 
    224         fGuiLines = newstr;
     210        // check whether the current text was flushed or endl'ed
     211        const Bool_t flushed = fBase[len-1]!='\n';
     212
     213        // for the gui remove trailing characters ('\n' or '\0')
     214        fBase[len-1]='\0';
     215
     216        // add new text to line storage
     217        fGuiLine += fBase;
     218
     219        if (!flushed)
     220        {
     221            // add a new TString* to the array of gui lines
     222            TString **newstr = new TString*[fNumLines+1];
     223            memcpy(newstr, fGuiLines, fNumLines*sizeof(TString*));
     224            if (fNumLines>0)
     225                delete fGuiLines;
     226            fGuiLines = newstr;
     227
     228            // add Gui line as last line of array
     229            fGuiLines[fNumLines++] = new TString(fGuiLine);
     230            fGuiLine = "";
     231        }
    225232    }
    226233}
     
    231238        return;
    232239
     240    // lock mutex
    233241    Lock();
    234242
     243    // copy lines to TGListBox
    235244    for (int i=0; i<fNumLines; i++)
    236245    {
    237         fgui->AddEntry(fGuiLines[i], fGuiLineId++);
     246        // Replace all tabs by 7 white spaces
     247        fGuiLines[i]->ReplaceAll("\t", "       ");
     248        fgui->AddEntry(*fGuiLines[i], fGuiLineId++);
    238249        delete fGuiLines[i];
    239250    }
    240 
    241251    delete fGuiLines;
    242252
    243253    fNumLines=0;
    244254
     255    // cut list box top 1000 lines
    245256    fgui->RemoveEntries(0, fGuiLineId-1000);
     257    // show last entry
    246258    fgui->SetTopEntry(fGuiLineId-1);
     259    // tell a main loop, that list box contents have changed
    247260    fgui->SetBit(kHasChanged);
    248261
     262    // release mutex
    249263    UnLock();
    250264}
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r1895 r2052  
    44#ifndef ROOT_TObject
    55#include <TObject.h>
     6#endif
     7#ifndef ROOT_TString
     8#include <TString.h>
    69#endif
    710
     
    2326
    2427private:
    25     char        fBuffer;     //!
    26     char        fBase[bsz]; //! Buffer to store the data in
    27     char       *fPPtr;       //! Pointer to present position in buffer
    28     const char *fEPtr;       //! Pointer to end of buffer
     28    char        fBuffer;      //!
     29    char        fBase[bsz+1]; //! Buffer to store the data in
     30    char       *fPPtr;        //! Pointer to present position in buffer
     31    const char *fEPtr;        //! Pointer to end of buffer
    2932
    30     UInt_t fOutputLevel;     //! Present output level of the stream
    31     UInt_t fDebugLevel;      //! Present global debug level
    32     UInt_t fDevice;          //! Flag to indicate the present streams
     33    UInt_t fOutputLevel;      //! Present output level of the stream
     34    UInt_t fDebugLevel;       //! Present global debug level
     35    UInt_t fDevice;           //! Flag to indicate the present streams
    3336
    34     Bool_t fIsNull;          //! Switch output completely off
     37    Bool_t fIsNull;           //! Switch output completely off
    3538
    36     Int_t fGuiLineId;
     39    Int_t fGuiLineId;         //!
    3740
    3841    ofstream  *fout;          //! possible file output stream
     
    4043    TGListBox *fgui;          //! Listbox output
    4144
    42     Bool_t fIsDirectGui;      //! Pipe text directly to the GUI (for single threaded environments)
    43     char   **fGuiLines;      //! Lines to pipe to gui
    44     Int_t     fNumLines;
     45    Bool_t     fIsDirectGui;  //! Pipe text directly to the GUI (for single threaded environments)
     46    TString  **fGuiLines;     //! Lines to pipe to gui
     47    Int_t      fNumLines;     //!
     48//    Bool_t     fGuiLineFlushed;
     49    TString    fGuiLine;  //!
    4550
    4651#ifdef _REENTRANT
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1965 r2052  
    222222        return;
    223223
    224     TObjArrayIter Next(list);
     224    MIter Next(list);
    225225
    226226    MParContainer *cont = NULL;
    227     while ((cont=(MParContainer*)Next()))
     227    while ((cont=Next()))
    228228        AddToList(cont);
    229229}
     
    505505    *fLog << all << " " << GetDescriptor() << endl;
    506506    *fLog << setfill('-') << setw(strlen(GetDescriptor())+2) << "" << endl;
     507
    507508    MParContainer *obj = NULL;
    508     TIter Next(fContainer);
    509     while ((obj=(MParContainer*)Next()))
     509    MIter Next(fContainer);
     510    while ((obj=Next()))
    510511    {
    511512        *fLog << " " << obj->GetDescriptor();
     
    802803    MParContainer *cont = NULL;
    803804
    804     TIter Next(fContainer);
    805     while ((cont=(MParContainer*)Next()))
     805    MIter Next(fContainer);
     806    while ((cont=Next()))
    806807    {
    807808        if (cont->InheritsFrom("MTaskList"))
     
    878879    MParContainer *cont = NULL;
    879880
    880     TIter Next(fContainer);
    881     while ((cont=(MParContainer*)Next()))
     881    MIter Next(fContainer);
     882    while ((cont=Next()))
    882883        if (!cont->WriteEnv(env, prefix, print))
    883884            return kFALSE;
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r2015 r2052  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz <mailto:tbretz@uni-sw.gwdg.de>, 12/2000
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
     
    7676#include "MFilter.h"
    7777#include "MGGroupFrame.h"
     78#include "MStatusDisplay.h"
    7879
    7980ClassImp(MTask);
     
    166167    fNumExecutions = 0;
    167168
     169    *fLog << all << fName << "... " << flush;
     170    if (fDisplay)
     171        fDisplay->SetStatusLine2(*this);
     172
    168173    switch (PreProcess(plist))
    169174    {
     
    220225
    221226    fIsPreprocessed = kFALSE;
     227
     228    *fLog << all << fName << "... " << flush;
     229    if (fDisplay)
     230        fDisplay->SetStatusLine2(*this);
    222231
    223232    return PostProcess();
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r2015 r2052  
    6565#include "MLogManip.h"
    6666
     67#include "MIter.h"
    6768#include "MFilter.h"
    6869#include "MParList.h"
     
    288289    MTask *task=NULL;
    289290    //
    290     // loop over all tasks for preproccesing
     291    // loop over all tasks for reinitialization
    291292    //
    292293    while ((task=(MTask*)Next()))
     
    330331{
    331332    *fLog << all << "Preprocessing... " << flush;
     333    if (fDisplay)
     334    {
     335        // Set status lines
     336        fDisplay->SetStatusLine1("PreProcessing...");
     337        fDisplay->SetStatusLine2("");
     338    }
    332339
    333340    fParList = pList;
     
    347354    while ((task=(MTask*)Next()))
    348355    {
    349         *fLog << all << task->GetName() << "... " << flush;
    350         if (fDisplay)
    351             fDisplay->SetStatusLine2(*task);
    352 
    353356        //
    354357        // PreProcess the task and check for it's return value.
     
    494497{
    495498    *fLog << all << "Postprocessing... " << flush;
     499    if (fDisplay)
     500    {
     501        // Set status lines
     502        fDisplay->SetStatusLine1("PostProcessing...");
     503        fDisplay->SetStatusLine2("");
     504    }
    496505
    497506    //
     
    518527    while ( (task=(MTask*)Next()) )
    519528    {
    520         *fLog << all << task->GetName() << "... " << flush;
    521         if (fDisplay)
    522             fDisplay->SetStatusLine2(*task);
    523 
    524529        if (!task->CallPostProcess())
    525530            return kFALSE;
     
    602607    out << ";" << endl << endl;
    603608
    604     TIter Next(fTasks);
     609    MIter Next(fTasks);
    605610
    606611    MParContainer *cont = NULL;
    607     while ((cont=(MParContainer*)Next()))
     612    while ((cont=Next()))
    608613    {
    609614        cont->SavePrimitive(out, "");
     
    654659    MParContainer *cont = NULL;
    655660
    656     TIter Next(fTasks);
    657     while ((cont=(MParContainer*)Next()))
     661    MIter Next(fTasks);
     662    while ((cont=Next()))
    658663    {
    659664        if (cont->InheritsFrom("MTaskList"))
     
    730735    MParContainer *cont = NULL;
    731736
    732     TIter Next(fTasks);
    733     while ((cont=(MParContainer*)Next()))
     737    MIter Next(fTasks);
     738    while ((cont=Next()))
    734739        if (!cont->WriteEnv(env, prefix, print))
    735740            return kFALSE;
Note: See TracChangeset for help on using the changeset viewer.