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

Legend:

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

    r9314 r9345  
    1818!   Author(s): Thomas Bretz  2/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2007
     20!   Copyright: MAGIC Software Development, 2000-2009
    2121!
    2222!
     
    4444// the including file.
    4545//
     46// Class Version 1:
     47// ----------------
     48//  + TString fName
     49//
    4650//////////////////////////////////////////////////////////////////////////////
    4751#include "MEnv.h"
     
    7175// is called which can then be checked by IsValid()
    7276//
    73 MEnv::MEnv(const char *name) : TEnv(name)
     77// The second argument is the default name. Usually as name of the MEnv
     78// the base name of the file is returned. By giving a default name
     79// you can overwrite this behavious. This is useful for I/O
     80// because it allows to use Read and Write without argument.
     81//
     82MEnv::MEnv(const char *name, const char *defname) : TEnv(name), fName(defname)
    7483{
    7584    fChecked.SetOwner();
     
    174183    inc = inc.Strip(TString::kBoth);
    175184
    176     // Set final resource, now as kEnvLocal (previously set as kEnvChnaged)
     185    // Set final resource, now as kEnvLocal (previously set as kEnvChanged)
    177186    SetValue("Include", inc, kEnvLocal);
    178187
     
    198207}
    199208
     209// --------------------------------------------------------------------------
     210//
     211// Read an object from the current directory. If no name is given
     212// the name of this object is used.
     213//
     214Int_t MEnv::Read(const char *name)
     215{
     216    const Int_t rc = TEnv::Read(name?name:(const char*)fName);
     217    //if (name)
     218    //    SetName(name);
     219    return rc;
     220}
     221
    200222//---------------------------------------------------------------------------
    201223//
     
    204226const char *MEnv::GetName() const
    205227{
     228    if (!fName.IsNull())
     229        return fName;
     230
    206231    const char *pos = strrchr(GetRcName(), '/');
    207232    return pos>0 ? pos+1 : GetRcName();
     
    10611086void MEnv::PrintEnv(EEnvLevel level) const
    10621087{
    1063     cout << "# Path: " << GetRcName() << endl;
    1064     cout << "# Name: " << GetName() << endl;
     1088    if (!TString(GetRcName()).IsNull())
     1089    {
     1090        cout << "# Path: " << GetRcName() << endl;
     1091        cout << "# File: " << gSystem->BaseName(GetRcName()) << endl;
     1092    }
     1093    if (!fName.IsNull())
     1094        cout << "# Name: " << fName << endl;
     1095
    10651096    TEnv::PrintEnv(level);
    10661097}
  • trunk/MagicSoft/Mars/mbase/MEnv.h

    r9301 r9345  
    2121{
    2222private:
    23     TOrdCollection fChecked;
     23    TOrdCollection fChecked; //!
     24
     25    TString fName;
    2426
    2527    TString Compile(TString str, const char *post) const;
     
    2729
    2830public:
    29     MEnv(const char *name="");
     31    MEnv(const char *name="", const char *defname=0);
    3032
    3133    Bool_t      IsValid() const { return !TString(GetRcName()).IsNull(); }
     
    4446
    4547    const char *GetName() const;
     48    void        SetName(const char *name=0) { fName = name; }
    4649
    4750    Int_t       GetColor(const char *name, Int_t dftl);
     
    7376    Bool_t      TakeEnv(MArgs &args, Bool_t print=kFALSE, Bool_t overwrite=kTRUE);
    7477
     78    Int_t       Read(const char *name=0);
    7579    Int_t       ReadFile(const char *fname, EEnvLevel level);
    7680
     
    8589    Int_t GetNumUntouched() const;
    8690
    87     ClassDef(MEnv, 0) // A slightly more advanced version of TEnv
     91    ClassDef(MEnv, 1) // A slightly more advanced version of TEnv
    8892};
    8993   
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r9268 r9345  
    245245// --------------------------------------------------------------------------
    246246//
    247 //  Add all entries of the TObjArray to the list.
     247// Add all entries which derive from MParContainer
     248// of the TObjArray to the list.
    248249//
    249250void MParList::AddToList(TObjArray *list)
     
    255256        return;
    256257
    257     MIter Next(list);
    258 
    259     MParContainer *cont = NULL;
     258    TIter Next(list);
     259
     260    TObject *cont = NULL;
    260261    while ((cont=Next()))
    261262    {
     263        if (!dynamic_cast<MParContainer*>(cont))
     264            continue;
     265
    262266        cont->SetBit(kMustCleanup);
    263267        AddToList(cont);
Note: See TracChangeset for help on using the changeset viewer.