Changeset 1187


Ignore:
Timestamp:
01/16/02 13:29:10 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1186 r1187  
    1010   * manalysis/MMcPedestalNSBAdd.cc:
    1111     - small changes to output
     12 
     13   * mbase/MParList.[h,cc]:
     14     - added FindObject with class type argument
     15   
     16   * mbase/MWriteAsciiFile.cc
     17     - replaced call to InheritsFrom by new FindObject
    1218 
    1319 
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1117 r1187  
    234234// --------------------------------------------------------------------------
    235235//
     236//  Find an object in the list and check for the correct inheritance.
     237//  'name' is the name of the object you are searching for.
     238//
     239TObject *MParList::FindObject(const char *name, const char *classname) const
     240{
     241    TObject *obj = fContainer->FindObject(name);
     242
     243    if (!obj)
     244        return NULL;
     245
     246    if (obj->InheritsFrom(classname))
     247        return obj;
     248
     249    *fLog << dbginf << warn << "Found object '" << name << "' doesn't ";
     250    *fLog << "inherit from " << "'" << classname << "'" << endl;
     251    return NULL;
     252}
     253
     254// --------------------------------------------------------------------------
     255//
     256//  check if the object is in the list or not and check for the correct
     257//  inheritance
     258//
     259TObject *MParList::FindObject(const TObject *obj, const char *classname) const
     260{
     261    TObject *nobj = fContainer->FindObject(obj);
     262
     263    if (!nobj)
     264        return NULL;
     265
     266    if (nobj->InheritsFrom(classname))
     267        return nobj;
     268
     269    *fLog << dbginf << warn << "Found object '" << nobj->GetName() << "' ";
     270    *fLog << "doesn't inherit from " << "'" << classname << "'" << endl;
     271    return NULL;
     272}
     273
     274// --------------------------------------------------------------------------
     275//
    236276//  returns the ClassName without anything which is behind that last ';' in
    237277//  string.
  • trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc

    r1182 r1187  
    176176        const char *name = obj->GetName();
    177177
    178         MParContainer *cont = (MParContainer*)pList->FindObject(name);
     178        MParContainer *cont = (MParContainer*)pList->FindObject(name, "MParContainer");
    179179        if (!cont)
    180180        {
     
    183183        }
    184184
    185         if (!cont->InheritsFrom(MParContainer::Class()))
    186         {
    187             *fLog << err << dbginf << "'" << name << "' doesn't inherit from MParContainer." << endl;
    188             return kFALSE;
    189 
    190         }
    191 
    192185        AddContainer(cont);
    193186    }
Note: See TracChangeset for help on using the changeset viewer.