Changeset 5910 for trunk/MagicSoft


Ignore:
Timestamp:
01/20/05 14:21:25 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

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

    r4833 r5910  
    5555// --------------------------------------------------------------------------
    5656//
     57// Default constructor.
     58//
    5759// Use this constructor if a rule (see MF for more details) shell be used.
    5860// MContinue will create a MF object and use it as a filter for the
     
    6769// is added to the tasklist in front of MContinue.
    6870//
     71// Use the default constructor (or an empty rule) if you want to read the
     72// rule from a resource file.
     73//
    6974MContinue::MContinue(const TString rule, const char *name, const char *title)
    7075{
     
    147152}
    148153
     154// --------------------------------------------------------------------------
     155//
     156// Propagate display to filter (if set)
     157//
    149158void MContinue::SetDisplay(MStatusDisplay *d)
    150159{
     
    155164}
    156165
     166// --------------------------------------------------------------------------
     167//
     168// Propagate log stream to filter (if set)
     169//
    157170void MContinue::SetLogStream(MLog *lg)
    158171{
     
    181194}
    182195
     196// --------------------------------------------------------------------------
     197//
     198// If a filter is setup, call its 'IsInverted' to invert its meaning
     199// (boolean "not")
     200//
    183201void MContinue::SetInverted(Bool_t i)
    184202{
    185     GetFilter()->SetInverted(i);
    186 }
    187 
     203    if (GetFilter())
     204        GetFilter()->SetInverted(i);
     205}
     206
     207// --------------------------------------------------------------------------
     208//
     209// If a filter is setup, its IsInverted status is returned. If now filter
     210// has been setup yet, kFALSE is returned.
     211//
    188212Bool_t MContinue::IsInverted() const
    189213{
    190     return GetFilter()->IsInverted();
    191 }
     214    return GetFilter() ? GetFilter()->IsInverted() : kFALSE;
     215}
     216
     217// --------------------------------------------------------------------------
     218//
     219// Check for corresponding entries in resource file and setup filters.
     220// Avoid trailing 0's!
     221//
     222// Example:
     223//   test.C:
     224//     MContinue cont("", "MyContinue");
     225//
     226//   test.rc:
     227//     MyContinue.Condition: {0} && {1}
     228//     MyContinue.Inverted: yes
     229//     MyContinue.0: MHillas.fSize>1000
     230//     MyContinue.1: MHillas.fSize<10000
     231//
     232// For more details see MF::ReadEnv
     233//
     234Int_t MContinue::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     235{
     236    MF *f = new MF;
     237    f->SetName(fName);
     238
     239    const Bool_t rc = f->ReadEnv(env, prefix, print);
     240    if (rc!=kTRUE)
     241    {
     242        delete f;
     243        return rc;
     244    }
     245
     246    if (TestBit(kIsOwner))
     247        delete GetFilter();
     248
     249    SetBit(kIsOwner);
     250    MTask::SetFilter(f);
     251
     252    f->SetName(Form("MF:%s", fName.Data()));
     253
     254    return kTRUE;
     255}
  • trunk/MagicSoft/Mars/mbase/MContinue.h

    r2206 r5910  
    2525    MTaskList *fTaskList;  //! pointer to the present tasklist
    2626
     27    // MTask
    2728    Int_t PreProcess(MParList *list);
    2829    Int_t Process() { return kCONTINUE; }
     
    3940    Bool_t IsInverted() const;
    4041
     42    // MParContainer
    4143    void SetDisplay(MStatusDisplay *d);
    4244    void SetLogStream(MLog *lg);
     45    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    4346
    4447    ClassDef(MContinue, 1) //Task returning kCONTINUE
Note: See TracChangeset for help on using the changeset viewer.