]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTTask.h
- adding event type data block {EVENTTYP:PRIV} to component input blocks
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTask.h
index 0a1e80b57e9f1fb1616e1106db66621c8fa954d8..799f4901c624c5be429154454c4ae56b5642bed2 100644 (file)
@@ -1,8 +1,10 @@
+//-*- Mode: C++ -*-
 // $Id$
 
 #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
     @brief  base class for HLT tasks
 */
 
-#include <cerrno>
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#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;
 
 /******************************************************************************/
 
@@ -51,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();
 
@@ -69,6 +77,14 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH);
 
+  /**
+   * Create the component.
+   * @param pConf    configuration descritption
+   * @param pCH      component handler
+   * @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
@@ -117,6 +133,14 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int SetDependency(AliHLTTask* pDep);
 
+  /**
+   * Clear a dependency.
+   * The ROOT TList touches the object which is in the list, even though
+   * it shouldn't care about. Thats why all lists have to be cleared before
+   * objects are deleted.
+   */
+  int UnsetDependency(AliHLTTask* pDep);
+
   /**
    * Return number of unresolved dependencies.
    * Iterate through all the configurations the task depends on and check
@@ -150,6 +174,14 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int SetTarget(AliHLTTask* pDep);
 
+  /**
+   * Clear a target.
+   * The ROOT TList touches the object which is in the list, even though
+   * it shouldn't care about. Thats why all lists have to be cleared before
+   * objects are deleted.
+   */
+  int UnsetTarget(AliHLTTask* pTarget);
+
   /**
    * Prepare the task for event processing.
    * The method initializes the Data Buffer and calls the
@@ -173,7 +205,7 @@ 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=gkAliEventTypeData);
 
   /**
    * Determine the number of matching data block between the component and the
@@ -202,12 +234,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.
@@ -253,12 +283,30 @@ class AliHLTTask : public TObject, public AliHLTLogging {
   int GetNofSources() const {return fListDependencies.GetSize();}
 
  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) */ 
@@ -269,11 +317,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, 2);
 };
 
 #endif