Ignore:
Timestamp:
05/04/06 08:26:21 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

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

    r7685 r7688  
    338338// --------------------------------------------------------------------------
    339339//
     340// Add all objects in list to the tasklist after task where. If some of
     341// them do not inherit from MTask return kFALSE, also if AddToListAfter
     342// returns an error for one of the tasks
     343//
     344Bool_t MTaskList::AddToListAfter(const TList &list, const MTask *where, const char *tType)
     345{
     346    TIter Next(&list);
     347    TObject *obj=0;
     348    while ((obj=Next()))
     349    {
     350        if (!obj->InheritsFrom(MTask::Class()))
     351        {
     352            *fLog << err << "ERROR - Object " << obj->GetName() << " doesn't inherit from MTask..." << endl;
     353            return kFALSE;
     354        }
     355
     356        if (!AddToListAfter(static_cast<MTask*>(obj), where, tType))
     357            return kFALSE;
     358
     359        where = static_cast<MTask*>(obj);
     360    }
     361    return kTRUE;
     362}
     363
     364// --------------------------------------------------------------------------
     365//
     366// Add all objects in list to the tasklist before task where. If some of
     367// them do not inherit from MTask return kFALSE, also if AddToListBefore
     368// returns an error for one of the tasks
     369//
     370Bool_t MTaskList::AddToListBefore(const TList &list, const MTask *where, const char *tType)
     371{
     372    TIter Next(&list);
     373    TObject *obj=0;
     374    while ((obj=Next()))
     375    {
     376        if (!obj->InheritsFrom(MTask::Class()))
     377        {
     378            *fLog << err << "ERROR - Object " << obj->GetName() << " doesn't inherit from MTask..." << endl;
     379            return kFALSE;
     380        }
     381
     382        if (!AddToListBefore(static_cast<MTask*>(obj), where, tType))
     383            return kFALSE;
     384    }
     385    return kTRUE;
     386}
     387
     388// --------------------------------------------------------------------------
     389//
    340390//  Find an object in the list.
    341391//  'name' is the name of the object you are searching for.
     
    913963// --------------------------------------------------------------------------
    914964//
     965// Removes all task of the TList from the tasklist. Returns kFALSE if any
     966// of the objects was not an MTask or not found in the list.
     967//
     968Bool_t MTaskList::RemoveFromList(const TList &list)
     969{
     970    Bool_t rc = kTRUE;
     971
     972    TIter Next(&list);
     973    TObject *obj=0;
     974    while ((obj=Next()))
     975    {
     976        if (!obj->InheritsFrom(MTask::Class()))
     977        {
     978            *fLog << err << "ERROR - Object " << obj->GetName() << " doesn't inherit from MTask..." << endl;
     979            rc = kFALSE;
     980            continue;
     981        }
     982
     983        if (!RemoveFromList(static_cast<MTask*>(obj)))
     984            rc = kFALSE;
     985    }
     986    return rc;
     987}
     988
     989// --------------------------------------------------------------------------
     990//
    915991//  Find an object with the same name in the list and replace it with
    916992//  the new one. If the kIsOwner flag is set and the object was not
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r7685 r7688  
    4848    Bool_t AddToList(MTask *task, const char *tType="All");
    4949    Bool_t AddToList(const TList &list, const char *tType="All");
     50    Bool_t AddToListAfter(const TList &list, const MTask *where, const char *tType="All");
     51    Bool_t AddToListBefore(const TList &list, const MTask *where, const char *tType="All");
    5052
    5153    void SetSerialNumber(Byte_t num);
     
    5355    Bool_t Replace(MTask *obj);
    5456    Bool_t RemoveFromList(MTask *task);
     57    Bool_t RemoveFromList(const TList &list);
    5558
    5659    TObject *FindObject(const char *name) const;
Note: See TracChangeset for help on using the changeset viewer.