Ignore:
Timestamp:
01/13/04 15:41:12 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/BaseLinkDef.h

    r2617 r2784  
    55#pragma link off all functions;
    66
     7// Global constants
    78#pragma link C++ enum ParticleId_t;
    89
     
    1112//#pragma link C++ global kPI;
    1213
     14// Logging
    1315#pragma link C++ global gLog;
    1416
    1517#pragma link C++ class MLog+;
     18#pragma link C++ class MLogPlugin+;
     19#pragma link C++ class MLogHtml+;
     20
     21// Basic Network Tools
    1622#pragma link C++ class MReadSocket+;
    1723
     24// Basic Tools
    1825#pragma link C++ class MIter+;
    1926#pragma link C++ class MAstro+;
    2027#pragma link C++ class MDirIter+;
     28
     29// Mars core
     30#pragma link C++ class MInputStreamID+;
     31
     32#pragma link C++ class MParContainer+;
     33#pragma link C++ class MParList+;
    2134
    2235#pragma link C++ class MTask+;
     
    2437#pragma link C++ class MTaskList+;
    2538
    26 #pragma link C++ class MParContainer+;
    27 #pragma link C++ class MParList+;
    28 
    2939#pragma link C++ class MFilter+;
    3040
    3141#pragma link C++ class MEvtLoop+;
    3242
     43// Mars core (GUI part)
    3344#pragma link C++ class MStatusDisplay+;
    3445#pragma link C++ class MProgressBar+;
    3546#pragma link C++ class MSearch+;
    36 
    37 #pragma link C++ class MInputStreamID+;
    3847
    3948#pragma link C++ class MGTask+;
     
    4150#pragma link C++ class MGGroupFrame+;
    4251
    43 #pragma link C++ class MClone+;
    44 #pragma link C++ class MPrint+;
    45 #pragma link C++ class MContinue+;
    46 
     52// Basic containers
    4753#pragma link C++ class MArray;
    4854#pragma link C++ class MArrayB;
     
    5561#pragma link C++ class MArgsEntry+;
    5662
     63// Tool tasks
     64#pragma link C++ class MClone+;
     65#pragma link C++ class MPrint+;
     66#pragma link C++ class MContinue+;
     67
    5768#endif
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r2772 r2784  
    100100#include <iomanip>
    101101
     102#include <TROOT.h>      // gROOT->GetListOfCleanups()
     103
    102104#ifdef _REENTRANT
    103105#include <TMutex.h>
    104106#endif
    105107#include <TGTextView.h>
     108
     109#include "MLogPlugin.h"
    106110
    107111ClassImp(MLog);
     
    140144void MLog::Init()
    141145{
    142     setp(&fBuffer, &fBuffer+1);
    143     *this << '\0';
    144 
    145 #ifdef _REENTRANT
     146
    146147    //
    147148    // Creat drawing semaphore
    148149    //
     150#ifdef _REENTRANT
    149151    fMuxGui = new TMutex;
    150152#endif
     153
     154    fPlugins = new TList;
     155    gROOT->GetListOfCleanups()->Add(fPlugins);
     156
     157    setp(&fBuffer, &fBuffer+1);
     158    *this << '\0';
    151159}
    152160
     
    202210{
    203211    DeallocateFile();
     212
     213    delete fPlugins;
    204214#ifdef _REENTRANT
    205215    delete fMuxGui;
     
    223233{
    224234    SetBit(kIsUnderlined);
     235
     236    fPlugins->ForEach(MLogPlugin, Underline)();
    225237
    226238    if (TestBit(eNoColors))
     
    311323        fOut->write(fBase, len);
    312324
     325    fPlugins->ForEach(MLogPlugin, SetColor)(fOutputLevel);
     326    fPlugins->ForEach(MLogPlugin, WriteBuffer)(fBase, len);
     327
    313328    if (fDevice&eGui && fGui)
    314329    {
     
    490505    flag ? EnableOutputDevice(chk) : DisableOutputDevice(chk);
    491506}
     507
     508// --------------------------------------------------------------------------
     509//
     510// Add a plugin to which the output should be redirected, eg. MLogHtml
     511// The user has to take care of its deletion. If the plugin is deleted
     512// (and the kMustCleanup bit was not reset accidentaly) the plugin
     513// is automatically removed from the list of active plugins.
     514//
     515void MLog::AddPlugin(MLogPlugin *plug)
     516{
     517    fPlugins->Add(plug);
     518    plug->SetBit(kMustCleanup);
     519}
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r2519 r2784  
    1515class TMutex;
    1616class TGTextView;
     17
     18class MLogPlugin;
    1719
    1820class MLog : public std::streambuf, public std::ostream, public TObject
     
    7173#endif
    7274
     75    TList *fPlugins;
     76
    7377    void Init();
    7478
     
    192196    }
    193197
     198    void AddPlugin(MLogPlugin *plug);
     199
    194200    ClassDef(MLog, 0) // This is what we call 'The logging system'
    195201};
  • trunk/MagicSoft/Mars/mbase/Makefile

    r2604 r2784  
    3434
    3535SRCFILES = MLogo.cc \
    36            MLog.cc \
    3736           MArgs.cc \
    3837           MAstro.cc \
    39            MParContainer.cc \
     38           MLog.cc \
     39           MLogManip.cc \
     40           MLogPlugin.cc \
     41           MLogHtml.cc \
     42           MParContainer.cc \
    4043           MParList.cc \
    4144           MInputStreamID.cc \
     
    6265           MClone.cc \
    6366           MContinue.cc \
    64            MPrint.cc \
    65            MLogManip.cc
     67           MPrint.cc
    6668
    6769SRCS    = $(SRCFILES)
Note: See TracChangeset for help on using the changeset viewer.