Changeset 754 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/19/01 11:17:19 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r752 r754  
    152152//  'name' is the name of the object you are searching for.
    153153//  If the object doesn't exist we try to create one from the
    154 //  dictionary. If this isn't possible NULL is returned
     154//  dictionary. If this isn't possible NULL is returned.
     155//
     156//  By default (you don't specify an object name) the object name is
     157//  the same as the classname
     158//
     159//  If the classname (default classname) is of the structure
     160//  "Name;something" - containing a semicolon - evarything which is
     161//  after the last appearance of a semicolon is stripped to get the
     162//  Name of the Class. Normally this is used to number your objects.
     163//  "Name;1", "Name;2", ...
    155164//
    156165MParContainer *MParList::FindCreateObj(const char *classname, const char *objname)
     
    164173
    165174    //
     175    // Check if the classname is a 'numbered' name (like: "MTime;2")
     176    // if so strip the number from the classname.
     177    //
     178    // Becareful: We check for the last occurance of a ';' only and we
     179    // also don't check if a number follows or something else.
     180    //
     181    // Rem: I use a TString to make the code more readyble and to get
     182    // the new object deleted automatically
     183    //
     184    TString cname(classname);
     185    const char *semicolon = strrchr(cname, ';');
     186
     187    if (semicolon)
     188        cname.Remove(semicolon-cname);
     189
     190    //
    166191    // Try to find a object with this object name which is already
    167192    // in the List. If we can find one we are done.
     
    175200    // if object is not existing in the list try to create one
    176201    //
    177     *fLog << dbginf << "'" << classname << "' not found... creating." << endl;
     202    *fLog << dbginf << "Object '" << objname << "' of type '" << cname << "' not found... creating." << endl;
    178203
    179204    //
    180205    // try to get class from root environment
    181206    //
    182     TClass *cls = gROOT->GetClass(classname);
     207    TClass *cls = gROOT->GetClass(cname);
    183208
    184209    if (!cls)
     
    187212        // if class is not existing in the root environment
    188213        //
    189         *fLog << dbginf << "Class '" << classname << "' not existing in dictionary." << endl;
     214        *fLog << dbginf << "Class '" << cname << "' not existing in dictionary." << endl;
    190215        return NULL;
    191216    }
Note: See TracChangeset for help on using the changeset viewer.