Ignore:
Timestamp:
08/05/02 16:12:14 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
5 edited

Legend:

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

    r1481 r1483  
    371371    out << "   MEvtLoop evtloop;" << endl;
    372372    if (fParList)
    373         out << "   evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;
     373        out << "   evtloop.SetParList(&" << fParList->GetUniqueName() << ");" << endl;
    374374    else
    375375        out << "   // fParList empty..." << endl;
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r1477 r1483  
    3737#include "MParContainer.h"
    3838
     39#include <ctype.h>       // isdigit
    3940#include <fstream.h>     // ofstream, AsciiWrite
    4041
     
    139140// --------------------------------------------------------------------------
    140141//
     142//  Return a unique name for this container. It is created from
     143//  the container name and the unique Id. (This is mostly used
     144//  in the StreamPrimitive member functions)
     145//
     146const TString MParContainer::GetUniqueName() const
     147{
     148    TString ret = ToLower(fName);
     149
     150    if (isdigit(ret[ret.Length()-1]))
     151        ret+="_";
     152
     153    ret+=GetUniqueID();
     154
     155    return ret;
     156}
     157
     158// --------------------------------------------------------------------------
     159//
    141160//  List MParContainer name and title.
    142161//
     
    359378void MParContainer::SavePrimitive(ofstream &out, Option_t *o)
    360379{
     380    static UInt_t uid = 0;
     381
    361382    if (IsSavedAsPrimitive())
    362383        return;
    363384
     385    SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/);
    364386    StreamPrimitive(out);
    365387    SetBit(kIsSavedAsPrimitive);
     
    373395{
    374396    out << "   // Using MParContainer::StreamPrimitive" << endl;
    375     out << "   " << ClassName() << " " << ToLower(fName) << "(\"";
     397    out << "   " << ClassName() << " " << GetUniqueName() << "(\"";
    376398    out << fName << "\", \"" << fTitle << "\");" << endl;
    377399}
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r1477 r1483  
    5555    virtual void        FillBuffer(char *&buffer);
    5656
    57     virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
    58     virtual const char *GetName() const       { return fName.Data(); }
    59     virtual const char *GetTitle() const      { return fTitle.Data(); }
    60     virtual ULong_t     Hash() const          { return fName.Hash(); }
    61     virtual Bool_t      IsSortable() const    { return kTRUE; }
     57    virtual const char   *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); }
     58    virtual const TString GetUniqueName() const;
     59    virtual const char   *GetName() const       { return fName.Data(); }
     60    virtual const char   *GetTitle() const      { return fTitle.Data(); }
     61    virtual ULong_t       Hash() const          { return fName.Hash(); }
     62    virtual Bool_t        IsSortable() const    { return kTRUE; }
    6263
    6364    virtual void        SetName(const char *name); // *MENU*
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1477 r1483  
    5252ClassImp(MParList);
    5353
     54static const TString gsDefName  = "MParList";
     55static const TString gsDefTitle = "A list of Parameter Containers";
     56
    5457// --------------------------------------------------------------------------
    5558//
     
    5962MParList::MParList(const char *name, const char *title)
    6063{
    61     fName  = name  ? name  : "MParList";
    62     fTitle = title ? title : "A list of Parameter Containers";
     64    fName  = name  ? name  : gsDefName.Data();
     65    fTitle = title ? title : gsDefTitle.Data();
    6366
    6467    //
     
    668671void MParList::StreamPrimitive(ofstream &out) const
    669672{
    670     out << "   MParList " << ToLower(fName) << "(\"";
    671     out << fName << "\", \"" << fTitle << "\");" << endl << endl;
     673    out << "   MParList " << GetUniqueName();
     674    if (fName!=gsDefName)
     675    {
     676        out << "(\"" << fName << "\"";
     677        if (fTitle!=gsDefTitle)
     678            out << ", \"" << fTitle << "\"";
     679        out <<")";
     680    }
     681    out << ";" << endl << endl;
    672682
    673683    TIter Next(fContainer);
    674684
    675     TObject *cont = NULL;
    676     while ((cont=Next()))
     685    MParContainer *cont = NULL;
     686    while ((cont=(MParContainer*)Next()))
    677687    {
    678688        cont->SavePrimitive(out, "");
    679689
    680         out << "   " << ToLower(fName) << ".AddToList(&";
    681         out << ToLower(cont->GetName()) << ");" << endl << endl;
    682     }
    683 }
    684 
     690        out << "   " << GetUniqueName() << ".AddToList(&";
     691        out << cont->GetUniqueName() << ");" << endl << endl;
     692    }
     693}
     694
     695// --------------------------------------------------------------------------
     696//
     697// Adds one TNamed object per object in the list. The TNamed object must
     698// be deleted by the user.
     699//
    685700void MParList::GetNames(TObjArray &arr) const
    686701{
     
    689704}
    690705
     706// --------------------------------------------------------------------------
     707//
     708// Sets name and title of each object in the list from the objects in
     709// the array.
     710//
    691711void MParList::SetNames(TObjArray &arr)
    692712{
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1477 r1483  
    7171ClassImp(MTaskList);
    7272
     73static const TString gsDefName  = "MTaskList";
     74static const TString gsDefTitle = "A list for tasks to be executed";
    7375// --------------------------------------------------------------------------
    7476//
     
    7981MTaskList::MTaskList(const char *name, const char *title)
    8082{
    81     fName  = name  ? name  : "MTaskList";
    82     fTitle = title ? title : "A list for tasks to be executed";
     83    fName  = name  ? name  : gsDefName.Data();
     84    fTitle = title ? title : gsDefTitle.Data();
    8385
    8486    fTasks = new TList;
     
    522524void MTaskList::StreamPrimitive(ofstream &out) const
    523525{
    524     out << "   MTaskList " << ToLower(fName) << "(\"";
    525     out << fName << "\", \"" << fTitle << "\");" << endl << endl;
     526    out << "   MTaskList " << GetUniqueName();
     527    if (fName!=gsDefName)
     528    {
     529        out << "(\"" << fName << "\"";
     530        if (fTitle!=gsDefTitle)
     531            out << ", \"" << fTitle << "\"";
     532        out <<")";
     533    }
     534    out << ";" << endl << endl;
    526535
    527536    TIter Next(fTasks);
    528537
    529     TObject *cont = NULL;
    530     while ((cont=Next()))
     538    MParContainer *cont = NULL;
     539    while ((cont=(MParContainer*)Next()))
    531540    {
    532541        cont->SavePrimitive(out, "");
    533         out << "   " << ToLower(fName) << ".AddToList(&";
    534         out << ToLower(cont->GetName()) << ");" << endl << endl;
     542        out << "   " << GetUniqueName() << ".AddToList(&";
     543        out << cont->GetUniqueName() << ");" << endl << endl;
    535544    }
    536545}
Note: See TracChangeset for help on using the changeset viewer.