]>
Commit | Line | Data |
---|---|---|
a9bbb414 | 1 | #ifndef ALIBASELOADER_H |
2 | #define ALIBASELOADER_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | //__________________________________________ | |
9 | //////////////////////////////////////////// | |
10 | // // | |
11 | // class AliBaseLoader // | |
12 | // // | |
13 | // Loader responsible for one data type // | |
14 | // i.e. Hits, Kine, etc. // | |
15 | // many objects type can be assciated // | |
16 | // with one data type: storing object // | |
17 | // (usually tree), task producing it, // | |
18 | // Quality Assurance(QA), QA Task, and // | |
19 | // others. // | |
20 | // // | |
21 | // // | |
22 | //////////////////////////////////////////// | |
23 | ||
c93255fe | 24 | class TObject; |
a9bbb414 | 25 | class TFolder; |
a9bbb414 | 26 | class AliDataLoader; |
c93255fe | 27 | |
28 | #include <TNamed.h> | |
29 | #include <TDirectory.h> | |
30 | #include <TString.h> | |
a9bbb414 | 31 | |
32 | class AliBaseLoader: public TNamed | |
33 | { | |
34 | public: | |
35 | AliBaseLoader(); | |
36 | AliBaseLoader(const TString& name, AliDataLoader* dl, Bool_t storeontop = kFALSE); | |
a9bbb414 | 37 | |
38 | virtual ~AliBaseLoader(){}; | |
39 | ||
40 | virtual Int_t Load(Option_t* opt=""); | |
41 | virtual void Unload(); | |
42 | virtual Int_t Reload(); | |
43 | virtual Int_t WriteData(Option_t* opt=""); | |
44 | virtual void Clean(); | |
45 | virtual Int_t Post();//Takes from file and sends to proper TFolder (Data Folder) | |
46 | virtual Int_t Post(TObject* data);//Sends to proper TFolder (Data Folder) | |
47 | virtual TObject* Get() const = 0; | |
48 | Bool_t IsLoaded()const{return fIsLoaded;} | |
49 | void SetDataLoader(AliDataLoader* dl){fDataLoader = dl;} | |
50 | void SetEventFolder(TFolder* /*ef*/){;} | |
51 | void SetDoNotReload(Bool_t flag){fDoNotReload = flag;} | |
52 | Bool_t DoNotReload() const {return fDoNotReload;} | |
53 | TDirectory* GetDirectory() const;//returns pointer to directory where data are stored. | |
54 | TObject* GetFromDirectory(const char *name) const | |
55 | {return (GetDirectory())?GetDirectory()->Get(name):0x0;} | |
56 | protected: | |
57 | ||
58 | virtual Int_t AddToBoard(TObject* obj) = 0;//add to white board - board can be TTask or TFolder | |
59 | virtual void RemoveFromBoard(TObject* obj) = 0; | |
60 | ||
61 | AliDataLoader* GetDataLoader() const; | |
62 | ||
63 | Bool_t fIsLoaded; //! flag indicating if data are loaded | |
64 | Bool_t fStoreInTopOfFile;// if true, data are stored in top of file ->Indicates fDoNotReload == kTRUE | |
65 | ||
66 | private: | |
dc86eb51 | 67 | |
68 | AliBaseLoader(const AliBaseLoader&); //Not implemented | |
69 | AliBaseLoader& operator=(const AliBaseLoader&); //Not implemented | |
70 | ||
a9bbb414 | 71 | Bool_t fDoNotReload; // if this flag is on object is not reloaded while GetEvent is called. |
72 | //Specially important for tasks. Task loops over events while producing data, | |
73 | //and has a base loader which writes it to file every processed event. | |
74 | //If this flag is not on, while taking next event, loader deletes task | |
75 | // and tries to get new one from file | |
76 | AliDataLoader* fDataLoader; //! pointer to Data Loader this Base Loader belongs to | |
77 | ||
78 | ClassDef(AliBaseLoader,1) | |
79 | }; | |
80 | ||
81 | ||
82 | #endif | |
83 | ||
84 |