Ignore:
Timestamp:
01/19/03 14:52:29 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
3 edited

Legend:

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

    r1600 r1715  
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 // MContinue                                                               //
    28 //                                                                         //
    29 // Does nothing than return kCONTINUE in the Process-function              //
    30 // (use with filters)                                                      //
    31 //                                                                         //
     26//
     27// MContinue
     28//
     29// Does nothing than return kCONTINUE in the Process-function
     30// (use with filters). For more details see the description of the
     31// constructors.
     32//
    3233/////////////////////////////////////////////////////////////////////////////
    3334#include "MContinue.h"
    3435
     36#include "MLog.h"
     37#include "MLogManip.h"
     38
     39#include "MF.h"
     40#include "MParList.h"
     41#include "MTaskList.h"
     42
    3543ClassImp(MContinue);
    3644
    37 MContinue::MContinue(const char *name, const char *title)
     45// --------------------------------------------------------------------------
     46//
     47// Use this constructor if a rule (see MF for more details) shell be used.
     48// MContinue will create a MF object and use it as a filter for the
     49// instance. The MF-Task is added to the tasklist in front of the MContinue
     50// instance and also automatically deleted, eg.
     51//   MContinue cont("MHillas.fSize<20");
     52//   tasklist.AddToList(&cont);
     53// would skip all events which fullfill "MHillas.fSize<20" from this point
     54// in the tasklist.
     55//
     56MContinue::MContinue(const TString rule, const char *name, const char *title)
    3857{
    3958    fName  = name  ? name  : "MContinue";
    4059    fTitle = title ? title : "Task returning kCONTINUE";
     60
     61    if (rule.IsNull())
     62        return;
     63
     64    SetBit(kIsOwner);
     65
     66    MTask::SetFilter(new MF(rule, TString("MF(")+fName+")"));
    4167}
    4268
     69// --------------------------------------------------------------------------
     70//
     71// Use this if you have a filter. Would be the same as if you would call:
     72//   MContinue cont;
     73//   cont.SetFilter(f);
     74//
    4375MContinue::MContinue(MFilter *f, const char *name, const char *title)
    4476{
     
    4880    SetFilter(f);
    4981}
     82
     83// --------------------------------------------------------------------------
     84//
     85//  Delete the filter if it was created automatically
     86//
     87MContinue::~MContinue()
     88{
     89    if (TestBit(kIsOwner))
     90        delete GetFilter();
     91}
     92
     93// --------------------------------------------------------------------------
     94//
     95//  In case the filter was created automatically, PreProcess tries to find
     96//  the tasklist MTaskList, adds the filter before this instance to the
     97//  tasklist and preprocesses the filter.
     98//
     99Bool_t MContinue::PreProcess(MParList *list)
     100{
     101    if (!TestBit(kIsOwner))
     102        return kTRUE;
     103
     104    MTaskList *tlist = (MTaskList*)list->FindObject("MTaskList");
     105    if (!tlist)
     106    {
     107        *fLog << err << dbginf << "ERROR - Tasklist 'MTaskList' not found... abort." << endl;
     108        return kFALSE;
     109    }
     110
     111    if (!GetFilter())
     112    {
     113        *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;
     114        return kFALSE;
     115    }
     116
     117    if (!tlist->AddToListBefore(GetFilter(), this))
     118    {
     119        *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl;
     120        return kFALSE;
     121    }
     122
     123    return GetFilter()->CallPreProcess(list);
     124}
     125
  • trunk/MagicSoft/Mars/mbase/MContinue.h

    r1538 r1715  
    2020{
    2121private:
     22    Bool_t PreProcess(MParList *list);
    2223    Bool_t Process() { return kCONTINUE; }
    2324
     25    enum { kIsOwner = BIT(14) };
     26
    2427public:
    25     MContinue(const char *name=NULL, const char *title=NULL);
     28    MContinue(const TString rule="", const char *name=NULL, const char *title=NULL);
    2629    MContinue(MFilter *f, const char *name=NULL, const char *title=NULL);
     30    ~MContinue();
     31
     32    void SetFilter(MFilter *filter) { if (!TestBit(kIsOwner)) MTask::SetFilter(filter); }
    2733
    2834    ClassDef(MContinue, 1) //Task returning kCONTINUE
  • trunk/MagicSoft/Mars/mbase/Makefile

    r1540 r1715  
    2020# @endcode
    2121
    22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain
     22INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain -I../mfilter
    2323
    2424# @code
Note: See TracChangeset for help on using the changeset viewer.