+//-*- 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;
/******************************************************************************/
@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();
*/
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
*/
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
*/
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
* 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
* 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.
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) */
* @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