| 1 | #ifndef MARS_MTaskInteractive | 
|---|
| 2 | #define MARS_MTaskInteractive | 
|---|
| 3 |  | 
|---|
| 4 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 5 | //                                                                         // | 
|---|
| 6 | // MTaskInteractive                                                               // | 
|---|
| 7 | //                                                                         // | 
|---|
| 8 | // Does nothing than return kCONTINUE in the Process-fucntion              // | 
|---|
| 9 | // (use with filters)                                                      // | 
|---|
| 10 | //                                                                         // | 
|---|
| 11 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 12 |  | 
|---|
| 13 | #ifndef MARS_MTask | 
|---|
| 14 | #include "MTask.h" | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 | class MFilter; | 
|---|
| 18 | class MTaskList; | 
|---|
| 19 |  | 
|---|
| 20 | class MTaskInteractive : public MTask | 
|---|
| 21 | { | 
|---|
| 22 | private: | 
|---|
| 23 | TMethodCall *fCall[3]; | 
|---|
| 24 |  | 
|---|
| 25 | Int_t (*fPreProcess)(MParList *list); | 
|---|
| 26 | Int_t (*fProcess)(); | 
|---|
| 27 | Int_t (*fPostProcess)(); | 
|---|
| 28 |  | 
|---|
| 29 | Int_t PreProcess(MParList *list) { if (fCall[0]) return Return(0, &list); return fPreProcess  ? (*fPreProcess)(list) : kTRUE; } | 
|---|
| 30 | Int_t Process()                  { if (fCall[1]) return Return(1);        return fProcess     ? (*fProcess)()        : kTRUE; } | 
|---|
| 31 | Int_t PostProcess()              { if (fCall[2]) return Return(2);        return fPostProcess ? (*fPostProcess)()    : kTRUE; } | 
|---|
| 32 |  | 
|---|
| 33 | Int_t Return(Int_t no, void *param=NULL); | 
|---|
| 34 | Bool_t Set(void *fcn, Int_t no, const char *params); | 
|---|
| 35 | void   Free(Int_t no); | 
|---|
| 36 |  | 
|---|
| 37 | public: | 
|---|
| 38 | MTaskInteractive(const char *name=NULL, const char *title=NULL); | 
|---|
| 39 | ~MTaskInteractive(); | 
|---|
| 40 |  | 
|---|
| 41 | // This is to be used in compiled code | 
|---|
| 42 | void SetPreProcess(Int_t (*func)(MParList *list)) { fPreProcess = func;  Free(0); } | 
|---|
| 43 | void SetProcess(Int_t (*func)())                  { fProcess = func;     Free(1);  } | 
|---|
| 44 | void SetPostProcess(Int_t (*func)())              { fPostProcess = func; Free(2);  } | 
|---|
| 45 |  | 
|---|
| 46 | // This is for usage in CINT | 
|---|
| 47 | void SetPreProcess(void *fcn)  { Set(fcn, 0, "MParList*"); fPreProcess =0; } | 
|---|
| 48 | void SetProcess(void *fcn)     { Set(fcn, 1, "");          fProcess    =0; } | 
|---|
| 49 | void SetPostProcess(void *fcn) { Set(fcn, 2, "");          fPostProcess=0; } | 
|---|
| 50 |  | 
|---|
| 51 | ClassDef(MTaskInteractive, 0) // Interactive task | 
|---|
| 52 | }; | 
|---|
| 53 |  | 
|---|
| 54 | #endif | 
|---|