]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTTask.h
Corrected pragma: no need for newObj to access the target data members
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTask.h
index 3a10909e3727233aab9b381c256971b86f53aefa..23d19fe8645cca4ff64eb37c151a450c44c9d75c 100644 (file)
@@ -3,32 +3,32 @@
 
 #ifndef ALIHLTTASK_H
 #define ALIHLTTASK_H
-/* This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- * See cxx source for full Copyright notice                               */
-
-/** @file   AliHLTTask.h
-    @author Matthias Richter
-    @date   
-    @brief  base class for HLT tasks
-*/
-
-// see below for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
-
-#include <cerrno>
+///* This file is property of and copyright by the                          * 
+///* ALICE Experiment at CERN, All rights reserved.                         *
+///* See cxx source for full Copyright notice                               *
+
+/// @file   AliHLTTask.h
+/// @author Matthias Richter
+/// @date   
+/// @brief  base class for HLT tasks
+///
+
+#include <vector>
 #include <TObject.h>
 #include <TList.h>
 #include "AliHLTDataTypes.h"
 #include "AliHLTLogging.h"
 #include "AliHLTDataBuffer.h"
 
+using std::vector;
+
 struct AliHLTComponentBlockData;
 class AliHLTComponent;
 class AliHLTComponentHandler;
+class AliHLTConfiguration;
+class AliHLTTask;
+
+typedef vector<AliHLTTask*> AliHLTTaskPList;
 
 /******************************************************************************/
 
@@ -73,6 +73,15 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH);
 
+  /**
+   * Create the component.
+   * @param pConf    configuration descritption
+   * @param pCH      component handler
+   * @param pComponent [OUT] target to get the component instance
+   * @return component instance
+   */
+  virtual int CreateComponent(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH, AliHLTComponent*& pComponent) const;
+
   /**
    * De-Initialize the task.
    * Final cleanup after the run. The @ref AliHLTComponent::Deinit method of
@@ -193,7 +202,9 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * processing, the data blocks are released. <br>
    * The @ref StartRun method must be called before.
    */
-  int ProcessTask(Int_t eventNo);
+  int ProcessTask(Int_t eventNo, AliHLTUInt32_t eventType,
+                 AliHLTTriggerMask_t trgMask, AliHLTUInt32_t timestamp,
+                 AliHLTUInt32_t participatingDetectors = 0);
 
   /**
    * Determine the number of matching data block between the component and the
@@ -222,12 +233,10 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * returns the number of blocks which would be prepared in case the target
    * array is big enough.
    * @param pConsumerTask   the task which subscribes to the data
-   * @param arrayBlockDesc  pointer to block descriptor to be filled
-   * @param iArraySize      size of the block descriptor array
+   * @param blockDescList   block descriptor list to be filled
    * @return number of matching data blocks, negative error code if failed
    */
-  int Subscribe(const AliHLTTask* pConsumerTask,
-               AliHLTComponentBlockData* arrayBlockDesc, int iArraySize);
+  int Subscribe(const AliHLTTask* pConsumerTask, AliHLTComponentBlockDataList& blockDescList);
 
   /**
    * Release a block descriptor.
@@ -239,11 +248,27 @@ class AliHLTTask : public TObject, public AliHLTLogging {
   int Release(AliHLTComponentBlockData* pBlockDesc,
              const AliHLTTask* pConsumerTask);
 
+  /**
+   * Cleanup function if the event processing is in error state.
+   * In order to handle in particular forwarded segments in the source
+   * tasks correctly the tasks of the chain have to subscribe to the
+   * parents even if the event is already in error state. This function
+   * is used instead of ProcessTask.
+   * Subscribes to all source tasks and releases them with out any event
+   * processing
+   */
+  int SubscribeSourcesAndSkip();
+
   /**
    * Print the status of the task with component, dependencies and targets.
    */
   void PrintStatus();
 
+  /**
+   * Overloaded from TObject
+   */
+  void Print(const char* options) const;
+
   /**
    * Search task dependency list recursively to find a dependency.
    * @param id              id of the task to search for
@@ -272,18 +297,39 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int GetNofSources() const {return fListDependencies.GetSize();}
 
+  /**
+   * Customized logging function.
+   * The task id and pointer is added at the beginning of each message.
+   */
+  int LoggingVarargs(AliHLTComponentLogSeverity severity, 
+                    const char* originClass, const char* originFunc,
+                    const char* file, int line, ... ) const;
+
  private:
   /** prohibited copy constructor */
   AliHLTTask(const AliHLTTask&);
   /** prohibited assignment operator */
   AliHLTTask& operator=(const AliHLTTask&);
 
+  /**
+   * Custom initialization for child tasks.
+   */
+  virtual int CustomInit(AliHLTComponentHandler* pCH);
+
+  /**
+   * Custom clean up for child tasks.
+   */
+  virtual int CustomCleanup();
+
+ protected:
   /** the configuration descriptor (external pointer) */
   AliHLTConfiguration* fpConfiguration;                           //! transient
   /** the component described by this task (created and deleted internally) */
   AliHLTComponent* fpComponent;                                   //! transient
   /** the data buffer for the component processing */
   AliHLTDataBuffer* fpDataBuffer;                                 //! transient
+
+ private:
   /** the list of targets (tasks which depend upon the current one) */
   TList fListTargets;                                             // see above
   /** the list of sources (tasks upon which the current one depends) */ 
@@ -296,7 +342,7 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   vector<AliHLTComponentBlockData> fBlockDataArray;               //! transient
 
-  ClassDef(AliHLTTask, 2);
+  ClassDef(AliHLTTask, 0);
 };
 
 #endif