]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTSystem.h
- AliHLTFileWriter added
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTSystem.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTSYSTEM_H
4 #define ALIHLTSYSTEM_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /** @file   AliHLTSystem.h
9     @author Matthias Richter
10     @date   
11     @brief  Global HLT module management and AliRoot integration.
12     @note   The class is used in Offline (AliRoot) context
13 */
14
15 /**
16  * @defgroup alihlt_system HLT integration into AliRoot
17  * This section describes the HLT integration into AliRoot.
18  */
19
20 #include "AliHLTLogging.h"
21 #include <TList.h>
22
23 class AliHLTComponentHandler;
24 class AliHLTConfiguration;
25 class AliHLTConfigurationHandler;
26 class AliHLTTask;
27
28 /**
29  * @class AliHLTSystem
30  * Main class for the HLT integration into AliRoot.
31  * The class handles a list of configurations. Configurations are translated
32  * into task lists which can be executed. 
33  *
34  * @note This class is only used for the @ref alihlt_system.
35  *
36  * @ingroup alihlt_system
37  */
38 class AliHLTSystem : public AliHLTLogging {
39  public:
40   /** default constructor */
41   AliHLTSystem();
42   /** not a valid copy constructor, defined according to effective C++ style */
43   AliHLTSystem(const AliHLTSystem&);
44   /** not a valid assignment op, but defined according to effective C++ style */
45   AliHLTSystem& operator=(const AliHLTSystem&);
46   /** destructor */
47   virtual ~AliHLTSystem();
48
49   /**
50    * Pointer to an instance of @ref AliHLTComponentHandler.
51    */
52   AliHLTComponentHandler* fpComponentHandler;
53
54   /**
55    * Pointer to an instance of @ref AliHLTConfigurationHandler.
56    */
57   AliHLTConfigurationHandler* fpConfigurationHandler;
58
59   /**
60    * Add a configuration to the end of the list.
61    * @param pConf    pointer to configuration to add
62    */
63   int AddConfiguration(AliHLTConfiguration* pConf);
64
65   /**
66    * Insert a configuration to the end of the list after the specified configuration.
67    * @param pConf    pointer to configuration to insert
68    * @param pPrec    pointer to configuration to insert the new one after
69    */
70   int InsertConfiguration(AliHLTConfiguration* pConf, AliHLTConfiguration* pPrec);
71
72   /**
73    * Remove a configuration from the list.
74    * @param pConf    pointer to configuration to delete
75    */
76   int DeleteConfiguration(AliHLTConfiguration* pConf);
77
78   /**
79    * Build a task list from a configuration object.
80    * This method is used to build the tasks from the 'master' configuration
81    * objects which are added to the HLT system handler. This is an iterative
82    * process since the task might depend upon other configurations. For each
83    * configuration object which has not yet been converted into a task, the
84    * method will be called iteratively. Finally, after building all tasks which
85    * the current one depends on have been created, the task is inserted to the
86    * list of tasks with the InsertTask method.
87    * @param pConf    pointer to configuration to build the task list from
88    */
89   int BuildTaskList(AliHLTConfiguration* pConf);
90
91   /**
92    * Clean the list of tasks and delete all the task objects.
93    */
94   int CleanTaskList();
95
96   /**
97    * Insert a task to the task list.
98    * The method first checks whether all dependencies are resolved (i.e. exist 
99    * already in the task list). During this iteration the cross links between the 
100    * tasks are set as well. If all dependencies are resolved, the task is added
101    * at the end of the list.
102    * @param pTask    pointer to task to add
103    */
104   int InsertTask(AliHLTTask* pTask);
105
106   /**
107    * Find a task with an id.
108    * @param id       CONFIGURATION id (not a COMPONENT id!)
109    */
110   AliHLTTask* FindTask(const char* id);
111
112   /**
113    * Print the task list.
114    */
115   void PrintTaskList();
116
117   /**
118    * Run the task list.
119    * The method checks whether the task list has already been build. If not,
120    * or the configuration list has been changed, the @ref BuildTaskList
121    * method is scalled
122    * All tasks of the list will be subsequently processed for each event.
123    * @param iNofEvents number of events
124    * @return neg error code if failed
125    */
126   int Run(Int_t iNofEvents=1);
127
128   /**
129    * Init all tasks from the list.
130    * The @ref AliHLTTask::Init method is called for each task, the components
131    * will be created.
132    * @return neg error code if failed
133    */
134   int InitTasks();
135
136   /**
137    * Start task list.
138    * The @ref AliHLTTask::StartRun method is called for each task, the components
139    * will be prepared for event processing.
140    * @return neg error code if failed
141    */
142   int StartTasks();
143
144   /**
145    * Process task list.
146    * The @ref AliHLTTask::ProcessTask method is called for each task.
147    * @return neg error code if failed
148    */
149   int ProcessTasks(Int_t eventNo);
150
151   /**
152    * Stop task list.
153    * The @ref AliHLTTask::EndRun method is called for each task, the components
154    * will be cleaned after event processing.
155    * @return neg error code if failed
156    */
157   int StopTasks();
158
159   /**
160    * De-init all tasks from the list.
161    * The @ref AliHLTTask::Deinit method is called for each task, the components
162    * will be deleted.
163    * @return neg error code if failed
164    */
165   int DeinitTasks();
166
167   /**
168    * The memory allocation function for components.
169    * This function is part of the running environment of the components.
170    */
171   static void* AllocMemory( void* param, unsigned long size );
172
173  protected:
174   int ProcessTask();
175   int StartEvent();
176   int ProcessEvent();
177   int StopEvent();
178  
179  private:
180 /*   TList fConfList; */
181 /*   int fbListChanged; */
182
183   TList fTaskList;
184
185  private:
186   ClassDef(AliHLTSystem, 1);
187 };
188 #endif
189