Ignore:
Timestamp:
08/12/04 16:41:37 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 added
13 edited

Legend:

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

    r4081 r4601  
    3333
    3434#pragma link C++ class MTask+;
     35#pragma link C++ class MTaskEnv+;
    3536#pragma link C++ class MTaskInteractive+;
    3637#pragma link C++ class MTaskList+;
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r4452 r4601  
    936936//          all Mars classes.
    937937//
    938 Bool_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     938Int_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    939939{
    940940    if (!prefix.IsNull())
     
    946946    *fLog << inf << "Reading resources for " << prefix /*TEnv::fRcName << " from " << env.GetRcName()*/ << endl;
    947947
     948    fLog->ReadEnv(env, prefix, print);
     949
    948950    if (fParList->ReadEnv(env, prefix, print)==kERROR)
    949951    {
     
    951953        return kFALSE;
    952954    }
    953 
    954     fLog->ReadEnv(env, prefix, print);
    955955
    956956    return kTRUE;
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r4368 r4601  
    7777    void Print(Option_t *opt="") const;
    7878
    79     Bool_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
     79    Int_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
    8080    Bool_t WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
    8181
  • trunk/MagicSoft/Mars/mbase/MGList.cc

    r2173 r4601  
    3737#include <iostream>
    3838
     39#include <TROOT.h>
    3940#include <TClass.h>
    4041#include <TGClient.h>
     
    4546
    4647using namespace std;
     48
     49// --------------------------------------------------------------------------
     50//
     51//  Add the list to the global list of cleanups
     52//  objects in the list.
     53//
     54MGList::MGList() : TList()
     55{
     56    gROOT->GetListOfCleanups()->Add(this);
     57}
    4758
    4859// --------------------------------------------------------------------------
     
    159170
    160171    TList::Add(obj);
     172    obj->SetBit(kMustCleanup);
    161173}
    162174
     
    180192
    181193    TList::Add(obj, opt);
     194    obj->SetBit(kMustCleanup);
    182195}
    183196
     
    187200//   - The picture is freed as often as it was retrieved from gClient
    188201//
    189 void MGList::AddPicture(const TGPicture *pic, const char *name)
     202void MGList::AddPicture(TGPicture *pic, const char *name)
    190203{
    191204    //
     
    204217    // Add the picture to the list
    205218    //
    206     TList::Add(const_cast<TGPicture*>(pic));
     219    TList::Add(pic);
     220    pic->SetBit(kMustCleanup);
    207221}
    208222
     
    221235const TGPicture *MGList::GetPicture(const char *name)
    222236{
    223     const TGPicture *pic = gClient->GetPicture(name);
     237    TGPicture *pic = const_cast<TGPicture*>(gClient->GetPicture(name));
    224238    AddPicture(pic, name);
    225239    return pic;
     
    240254const TGPicture *MGList::GetPicture(const char *name, Int_t width, Int_t height)
    241255{
    242     const TGPicture *pic = gClient->GetPicture(name, width, height);
     256    TGPicture *pic = const_cast<TGPicture*>(gClient->GetPicture(name, width, height));
    243257    AddPicture(pic, name);
    244258    return pic;
  • trunk/MagicSoft/Mars/mbase/MGList.h

    r1108 r4601  
    1515    Bool_t    IsExisting(TObject *obj) const;
    1616
    17     void      AddPicture(const TGPicture *pic, const char *name);
     17    void      AddPicture(TGPicture *pic, const char *name);
    1818
    1919public:
    20     MGList() : TList() {}
    21     virtual ~MGList();
     20    MGList();
     21    ~MGList();
    2222
    2323    void Add(TObject *obj);
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r4461 r4601  
    544544void MLog::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    545545{
    546     if (!prefix.IsNull())
    547         prefix += ".";
    548     prefix += "MLog";
    549 
    550546    MParContainer mlog("MLog");
    551547
    552     if (mlog.IsEnvDefined(env, prefix, "VerbosityLevel", print))
    553         SetDebugLevel(mlog.GetEnvValue(env, prefix, "VerbosityLevel", 2));
    554 
    555     if (mlog.IsEnvDefined(env, prefix, "DebugLevel", print))
    556         gDebug = mlog.GetEnvValue(env, prefix, "DebugLevel", 0);
    557 
    558     if (mlog.IsEnvDefined(env, prefix, "NoColors", print))
    559         if (mlog.GetEnvValue(env, prefix, "NoColors", 1)>0)
    560             SetNoColors();
     548    if (mlog.IsEnvDefined(env, prefix+"MLog", "VerbosityLevel", print))
     549        SetDebugLevel(mlog.GetEnvValue(env, prefix+"MLog", "VerbosityLevel", 2));
     550    else
     551        if (mlog.IsEnvDefined(env, "MLog", "VerbosityLevel", print))
     552            SetDebugLevel(mlog.GetEnvValue(env, "MLog", "VerbosityLevel", 2));
     553
     554    if (mlog.IsEnvDefined(env, prefix+"MLog", "DebugLevel", print))
     555        gDebug = mlog.GetEnvValue(env, prefix+"MLog", "DebugLevel", 0);
     556    else
     557        if (mlog.IsEnvDefined(env, "MLog", "DebugLevel", print))
     558            gDebug = mlog.GetEnvValue(env, "MLog", "DebugLevel", 0);
     559
     560    if (mlog.IsEnvDefined(env, prefix+"MLog", "NoColors", print))
     561        SetNoColors(mlog.GetEnvValue(env, prefix+"MLog", "NoColors", kFALSE));
     562    else
     563        if (mlog.IsEnvDefined(env, "MLog", "NoColors", print))
     564            SetNoColors(mlog.GetEnvValue(env, "MLog", "NoColors", kFALSE));
    561565}
    562566
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r4081 r4601  
    569569//          all Mars classes.
    570570//
    571 Bool_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     571// Return values:
     572//  kTRUE:  Environment string found
     573//  kFALSE: Environment string not found
     574//  kERROR: Error occured, eg. environment invalid
     575//
     576// Overload this if you don't want to control the level of setup-string. In
     577// this case ReadEnv gets called with the different possibilities, see TestEnv.
     578//
     579Int_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    572580{
    573581    if (!IsEnvDefined(env, prefix, "", print))
     
    609617}
    610618
     619// --------------------------------------------------------------------------
     620//
     621// Take the prefix and call ReadEnv for:
     622//   prefix.containername
     623//   prefix.classname
     624//   containername
     625//   classname
     626//
     627//  The existance of an environment variable is done in this order. If
     628//  ReadEnv return kTRUE the existance of the container setup is assumed and
     629//  the other tests are skipped. If kFALSE is assumed the sequence is
     630//  continued. In case of kERROR failing of the setup from a file is assumed.
     631//
     632// Overload this if you want to control the handling of level of setup-string
     633// mentioned above. In this case ReadEnv gets never called if you don't call
     634// it explicitly.
     635//
     636Int_t MParContainer::TestEnv(const TEnv &env, TString prefix, Bool_t print)
     637{
     638    if (print)
     639        *fLog << all << "Testing Prefix+ContName: " << prefix+GetName() << endl;
     640    Int_t rc = ReadEnv(env, prefix+GetName(), print);
     641    if (rc==kERROR || rc==kTRUE)
     642        return rc;
     643
     644    // Check For: Job4.MClassName.Varname
     645    if (print)
     646        *fLog << all << "Testing Prefix+ClasName: " << prefix+ClassName() << endl;
     647    rc = ReadEnv(env, prefix+ClassName(), print);
     648    if (rc==kERROR || rc==kTRUE)
     649        return rc;
     650
     651    // Check For: ContainerName.Varname
     652    if (print)
     653        *fLog << all << "Testing ContName: " << GetName() << endl;
     654    rc = ReadEnv(env, GetName(), print);
     655    if (rc==kERROR || rc==kTRUE)
     656        return rc;
     657
     658    // Check For: MClassName.Varname
     659    if (print)
     660        *fLog << all << "Testing ClassName: " << ClassName() << endl;
     661    rc = ReadEnv(env, ClassName(), print);
     662    if (rc==kERROR || rc==kTRUE)
     663        return rc;
     664
     665    // Not found
     666    return kFALSE;
     667}
     668
    611669Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const
    612670{
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r3574 r4601  
    118118    virtual void SetNames(TObjArray &arr);
    119119
    120     virtual Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     120    virtual Int_t  TestEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     121    virtual Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    121122    virtual Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
    122123
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r4577 r4601  
    853853//          all Mars classes.
    854854//
    855 Bool_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     855Int_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    856856{
    857857    if (print)
     
    870870        }
    871871
    872         // Check For: Job4.ContainerName.Varname
    873         if (print)
    874             *fLog << all << "Testing: " << prefix+cont->GetName() << endl;
    875         Bool_t rc = cont->ReadEnv(env, prefix+cont->GetName(), print);
    876         if (rc==kERROR)
     872        if (cont->TestEnv(env, prefix, print)==kERROR)
    877873            return kERROR;
    878         if (rc==kTRUE)
    879             continue;
    880 
    881         // Check For: Job4.MClassName.Varname
    882         if (print)
    883             *fLog << all << "Testing: " << prefix+cont->ClassName() << endl;
    884         rc = cont->ReadEnv(env, prefix+cont->ClassName(), print);
    885         if (rc==kERROR)
    886             return kERROR;
    887         if (rc==kTRUE)
    888             continue;
    889 
    890         // Check For: ContainerName.Varname
    891         if (print)
    892             *fLog << all << "Testing: " << cont->GetName() << endl;
    893         rc = cont->ReadEnv(env, cont->GetName(), print);
    894         if (rc==kERROR)
    895             return kERROR;
    896         if (rc==kTRUE)
    897             continue;
    898 
    899         // Check For: MClassName.Varname
    900         if (print)
    901             *fLog << all << "Testing: " << cont->ClassName() << endl;
    902         rc = cont->ReadEnv(env, cont->ClassName(), print);
    903         if (rc==kERROR)
    904             return kERROR;
    905         if (rc==kTRUE)
    906             continue;
    907874    }
    908875
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r4577 r4601  
    9191    void SavePrimitive(ofstream &out, Option_t *o="");
    9292
    93     Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     93    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    9494    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
    9595
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r3788 r4601  
    734734//          all Mars classes.
    735735//
    736 Bool_t MTaskList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     736Int_t MTaskList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    737737{
    738738    if (print)
     
    751751        }
    752752
    753         // Check For: Job4.ContainerName.Varname
    754         if (print)
    755             *fLog << all << "Testing: " << prefix+cont->GetName() << endl;
    756         Bool_t rc = cont->ReadEnv(env, prefix+cont->GetName(), print);
    757         if (rc==kERROR)
     753        if (cont->TestEnv(env, prefix, print)==kERROR)
    758754            return kERROR;
    759         if (rc==kTRUE)
    760             continue;
    761 
    762         // Check For: Job4.MClassName.Varname
    763         if (print)
    764             *fLog << all << "Testing: " << prefix+cont->ClassName() << endl;
    765         rc = cont->ReadEnv(env, prefix+cont->ClassName(), print);
    766         if (rc==kERROR)
    767             return kERROR;
    768         if (rc==kTRUE)
    769             continue;
    770 
    771         // Check For: ContainerName.Varname
    772         if (print)
    773             *fLog << all << "Testing: " << cont->GetName() << endl;
    774         rc = cont->ReadEnv(env, cont->GetName(), print);
    775         if (rc==kERROR)
    776             return kERROR;
    777         if (rc==kTRUE)
    778             continue;
    779 
    780         // Check For: MClassName.Varname
    781         if (print)
    782             *fLog << all << "Testing: " << cont->ClassName() << endl;
    783         rc = cont->ReadEnv(env, cont->ClassName(), print);
    784         if (rc==kERROR)
    785             return kERROR;
    786         if (rc==kTRUE)
    787             continue;
    788755    }
    789756
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r3666 r4601  
    7878    void SetNames(TObjArray &arr);
    7979
    80     Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     80    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    8181    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
    8282
  • trunk/MagicSoft/Mars/mbase/Makefile

    r4081 r4601  
    3030           MInputStreamID.cc \
    3131           MTask.cc \
     32           MTaskEnv.cc \
    3233           MTaskInteractive.cc \
    3334           MTaskList.cc \
Note: See TracChangeset for help on using the changeset viewer.