]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/examples/TaskExchange.h
Fixed usage of exchange containers in a multiple producers/consumers schema.
[u/mrichter/AliRoot.git] / ANALYSIS / examples / TaskExchange.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 //______________________________________________________________________________
5 //
6 // Task that produces some generic data to be exchanged with some consumers
7 //
8 //______________________________________________________________________________
9
10 #ifndef TASKEXCHANGE_H
11 #define TASKEXCHANGE_H
12
13 #ifndef ALIANALYSISTASKSE_H
14 #include "AliAnalysisTaskSE.h"
15 #endif
16
17 class TList;
18 class TObjArray;
19
20 class TaskProducer : public AliAnalysisTaskSE {
21  public:
22     TaskProducer();
23     TaskProducer(const char *name);
24     virtual ~TaskProducer();
25     
26     virtual void     UserCreateOutputObjects();
27     virtual void     UserExec(Option_t *option);
28     
29  private:
30     TList           *fOutput;        //! Output list (do not stream)
31     TObjArray       *fExchangedData; //! Arbitrary data (do not stream)
32     
33     TaskProducer(const TaskProducer&); // not implemented
34     TaskProducer& operator=(const TaskProducer&); // not implemented
35     
36     ClassDef(TaskProducer, 1); // example of producer
37 };
38
39 //______________________________________________________________________________
40 //
41 // Task that uses generic data produced by other tasks
42 //
43 //______________________________________________________________________________
44
45 class TaskConsumer : public AliAnalysisTaskSE {
46  public:
47     TaskConsumer();
48     TaskConsumer(const char *name);
49     virtual ~TaskConsumer();
50     
51     virtual void     UserCreateOutputObjects();
52     virtual void     UserExec(Option_t *option);
53     
54  private:
55     TList           *fOutput;        //! Output list (do not stream)
56     TNamed          *fImported1;     //! Arbitrary data (do not stream)
57     TNamed          *fImported2;     //! Arbitrary data (do not stream)
58     
59     TaskConsumer(const TaskConsumer&); // not implemented
60     TaskConsumer& operator=(const TaskConsumer&); // not implemented
61     
62     ClassDef(TaskConsumer, 1); // example of consumer task
63 };
64
65 #endif
66