Ignore:
Timestamp:
08/05/02 16:12:14 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.