]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTTask.h
Ignore
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTask.h
index b4075d2be962a5c400ff70e31bb478a9130affe6..fe77275e9d560a07771a0d6d8dbbf96413b27699 100644 (file)
@@ -3,7 +3,8 @@
 
 #ifndef ALIHLTTASK_H
 #define ALIHLTTASK_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* 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
@@ -18,7 +19,7 @@
 // or
 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
 
-#include <cerrno>
+#include <vector>
 #include <TObject.h>
 #include <TList.h>
 #include "AliHLTDataTypes.h"
 struct AliHLTComponentBlockData;
 class AliHLTComponent;
 class AliHLTComponentHandler;
+class AliHLTConfiguration;
+class AliHLTTask;
+
+typedef vector<AliHLTTask*> AliHLTTaskPList;
 
 /******************************************************************************/
 
@@ -58,10 +63,6 @@ class AliHLTTask : public TObject, public AliHLTLogging {
       @param pConf pointer to configuration descriptor
    */
   AliHLTTask(AliHLTConfiguration* pConf);
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTTask(const AliHLTTask&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTTask& operator=(const AliHLTTask&);
   /** destructor */
   virtual ~AliHLTTask();
 
@@ -76,6 +77,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
@@ -196,7 +206,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,
+                 AliHLTUInt64_t trgMask, AliHLTUInt32_t timestamp,
+                 AliHLTUInt32_t participatingDetectors = 0);
 
   /**
    * Determine the number of matching data block between the component and the
@@ -225,12 +237,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.
@@ -242,11 +252,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
@@ -275,13 +301,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) */ 
@@ -292,11 +344,9 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * @ref AliHLTComponent::ProcessEvent method. 
    * Filled through subscription to source tasks (@ref Subscribe).
    */
-  AliHLTComponentBlockData* fpBlockDataArray;                     //! transient
-  /** size of the block data array */
-  int fBlockDataArraySize;                                        // see above
+  vector<AliHLTComponentBlockData> fBlockDataArray;               //! transient
 
-  ClassDef(AliHLTTask, 1);
+  ClassDef(AliHLTTask, 0);
 };
 
 #endif