Ignore:
Timestamp:
11/04/03 17:08:27 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
6 edited

Legend:

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

    r2416 r2470  
    163163// --------------------------------------------------------------------------
    164164//
     165// Returns the name of the object. If the name of the object is not the
     166// class name it returns the object name and in []-brackets the class name.
     167//
     168const char *MParContainer::GetDescriptor() const
     169{
     170    //
     171    // Because it returns a (const char*) we cannot return a casted
     172    // local TString. The pointer would - immediatly after return -
     173    // point to a random memory segment, because the TString has gone.
     174    //
     175    return fName==ClassName() ? ClassName() : Form("%s [%s]", fName.Data(), ClassName());
     176}
     177
     178// --------------------------------------------------------------------------
     179//
    165180//  Return a unique name for this container. It is created from
    166181//  the container name and the unique Id. (This is mostly used
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r2416 r2470  
    7474    virtual void        FillBuffer(char *&buffer);
    7575
    76     virtual const char   *GetDescriptor() const { return fName==ClassName() ? ClassName() : Form("%s [%s]", fName.Data(), ClassName()); }
     76    virtual const char   *GetDescriptor() const;
    7777    virtual const TString GetUniqueName() const;
    7878    virtual const char   *GetName() const       { return fName.Data(); }
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r2206 r2470  
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 //   MTask                                                                 //
    28 //                                                                         //
    29 //   Base class for all tasks which can perfomed in a tasklist             //
    30 //   For each event processed in the eventloop all the different           //
    31 //   tasks in the tasklist will be processed.                              //
    32 //                                                                         //
    33 //   So all tasks must inherit from this baseclass.                        //
    34 //                                                                         //
    35 //   The inheritance from MInputStreamID is used to indicate the           //
    36 //   type of event that this task is for. If it is "All" it is executed    //
    37 //   independantly of the actual ID of the task list.                      //
    38 //                                                                         //
    39 //   Inside this abstract class, there are three fundamental function:     //
    40 //                                                                         //
    41 //   - PreProcess():   executed before the eventloop starts. Here you      //
    42 //                     can initiate different things, open files, etc.     //
    43 //                     As an argument this function gets a pointer to the  //
    44 //                     parameter list. You can stop the execution by       //
    45 //                     returning kFALSE instead of kTRUE. If an error      //
    46 //                     occured and you return kFALSE make sure, that       //
    47 //                     any action is closed correctly and all newly        //
    48 //                     created object are deleted. The PostProcess in      //
    49 //                     such a case won't be executed by the Tasklist or    //
    50 //                     Eventloop.                                          //
    51 //                                                                         //
    52 //   - Process():      executed for each event in the eventloop. Do it     //
    53 //                     one task after the other (as they occur in the      //
    54 //                     tasklist). Only the tasks with a Stream ID          //
    55 //                     which matches the actual ID of the tasklist         //
    56 //                     are executed. A task can return kFALSE to           //
    57 //                     stop the execuition of the tasklist or              //
    58 //                     kCONTINUE to skip the pending tasks. If you want    //
    59 //                     to stop the eventloop and wants the eventloop to    //
    60 //                     return the status 'failed' return kERROR.           //
    61 //                                                                         //
    62 //   - PostProcess():  executed after the eventloop. Here you can close    //
    63 //                     output files, start display of the run parameter,   //
    64 //                     etc. PostProcess is only executed in case of        //
    65 //                     PreProcess was successfull (returned kTRUE)         //
    66 //                                                                         //
     26//
     27//   MTask
     28//
     29//   Base class for all tasks which can perfomed in a tasklist
     30//   For each event processed in the eventloop all the different
     31//   tasks in the tasklist will be processed.
     32//
     33//   So all tasks must inherit from this baseclass.
     34//
     35//   The inheritance from MInputStreamID is used to indicate the
     36//   type of event that this task is for. If it is "All" it is executed
     37//   independantly of the actual ID of the task list.
     38//
     39//   Inside this abstract class, there are three fundamental function:
     40//
     41//   - PreProcess():   executed before the eventloop starts. Here you
     42//                     can initiate different things, open files, etc.
     43//                     As an argument this function gets a pointer to the
     44//                     parameter list. You can stop the execution by
     45//                     returning kFALSE instead of kTRUE. If an error
     46//                     occured and you return kFALSE make sure, that
     47//                     any action is closed correctly and all newly
     48//                     created object are deleted. The PostProcess in
     49//                     such a case won't be executed by the Tasklist or
     50//                     Eventloop.
     51//
     52//   - Process():      executed for each event in the eventloop. Do it
     53//                     one task after the other (as they occur in the
     54//                     tasklist). Only the tasks with a Stream ID
     55//                     which matches the actual ID of the tasklist
     56//                     are executed. A task can return kFALSE to
     57//                     stop the execuition of the tasklist or
     58//                     kCONTINUE to skip the pending tasks. If you want
     59//                     to stop the eventloop and wants the eventloop to
     60//                     return the status 'failed' return kERROR.
     61//
     62//   - PostProcess():  executed after the eventloop. Here you can close
     63//                     output files, start display of the run parameter,
     64//                     etc. PostProcess is only executed in case of
     65//                     PreProcess was successfull (returned kTRUE)
     66//
     67//  Version 1:
     68//  ----------
     69//   - first version
     70//
     71//  Version 2:
     72//  ----------
     73//   - added fSerialNumber
     74//
    6775/////////////////////////////////////////////////////////////////////////////
    6876#include "MTask.h"
     
    286294{
    287295    return kTRUE;
     296}
     297
     298// --------------------------------------------------------------------------
     299//
     300// Returns the name of the object. If the name of the object is not the
     301// class name it returns the object name and in []-brackets the class name.
     302// If a serial number is set (!=0) the serial number is added to the
     303// name (eg. ;1)
     304//
     305const char *MTask::GetDescriptor() const
     306{
     307    //
     308    // Because it returns a (const char*) we cannot return a casted
     309    // local TString. The pointer would - immediatly after return -
     310    // point to a random memory segment, because the TString has gone.
     311    //
     312    if (fName==ClassName())
     313        return fSerialNumber==0 ? ClassName() : Form("%s;%d", ClassName(), fSerialNumber);
     314
     315    return fSerialNumber>0 ?
     316        Form("%s;%d [%s]", fName.Data(), fSerialNumber, ClassName()) :
     317        Form("%s [%s]", fName.Data(), ClassName());
    288318}
    289319
     
    327357     fFilter->SavePrimitive(out);
    328358     */
    329      out << "   " << GetUniqueName() << ".SetFilter(&" << fFilter->GetUniqueName() <<");" << endl;
     359    out << "   " << GetUniqueName() << ".SetFilter(&" << fFilter->GetUniqueName() <<");" << endl;
     360    if (fSerialNumber>0)
     361        out << "   " << GetUniqueName() << ".SetSerialNumber(" << fSerialNumber <<");" << endl;
    330362}
    331363
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r2454 r2470  
    2525
    2626    MFilter *fFilter;       // Filter for conditional task execution
     27    Byte_t   fSerialNumber; // Serial number having more than one detector of the same type
    2728
    2829    Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
     
    6869    const MFilter *GetFilter() const      { return fFilter; }
    6970    MFilter *GetFilter()  { return fFilter; } // for MContinue only
     71
    7072    void SetDisplay(MStatusDisplay *d);
    7173    virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
     74
     75    virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }
     76    Byte_t  GetSerialNumber() const { return fSerialNumber; }
     77    TString AddSerialNumber(const char *str) const { TString s(str); if (fSerialNumber==0) return s; s += ";"; s += fSerialNumber; return s; }
     78    TString AddSerialNumber(const TString &str) const { return AddSerialNumber((const char*)str); }
     79
     80    const char *GetDescriptor() const;
    7281
    7382    UInt_t GetNumExecutions() const { return fNumExecutions; }
     
    8594    void SavePrimitive(ofstream &out, Option_t *o="");
    8695
    87     ClassDef(MTask, 1) //Abstract base class for a task
     96    ClassDef(MTask, 2) //Abstract base class for a task
    8897};
    8998
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r2454 r2470  
    145145}
    146146
     147// --------------------------------------------------------------------------
     148//
     149//  Set the display for the all tasks in the list and the tasklist itself.
     150//
    147151void MTaskList::SetDisplay(MStatusDisplay *d)
    148152{
    149153    fTasks->ForEach(MTask, SetDisplay)(d);
    150154    MTask::SetDisplay(d);
     155}
     156
     157// --------------------------------------------------------------------------
     158//
     159//  Set the serial number for the all tasks in the list and the tasklist
     160//  itself.
     161//
     162void MTaskList::SetSerialNumber(Byte_t num)
     163{
     164    fTasks->ForEach(MTask, SetSerialNumber)(num);
     165    MTask::SetSerialNumber(num);
    151166}
    152167
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r2206 r2470  
    4747    Bool_t AddToList(MTask *task, const char *tType="All");
    4848
     49    void SetSerialNumber(Byte_t num);
     50
    4951    Bool_t RemoveFromList(MTask *task);
    5052
Note: See TracChangeset for help on using the changeset viewer.