#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;
/******************************************************************************/
*/
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
* 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
* 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 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
*/
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) */
*/
vector<AliHLTComponentBlockData> fBlockDataArray; //! transient
- ClassDef(AliHLTTask, 2);
+ ClassDef(AliHLTTask, 0);
};
#endif