2 // splitted from AliHLTConfiguration.cxx,v 1.25 2007/10/12 13:24:47
3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTTask.cxx
20 @author Matthias Richter
22 @brief Implementation of HLT tasks.
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 #include "AliHLTTask.h"
41 #include "AliHLTConfiguration.h"
42 #include "AliHLTConfigurationHandler.h"
43 #include "AliHLTComponent.h"
44 #include "AliHLTComponentHandler.h"
47 /** ROOT macro for the implementation of ROOT specific class methods */
50 AliHLTTask::AliHLTTask()
52 fpConfiguration(NULL),
59 // see header file for class documentation
61 // refer to README to build package
63 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
66 AliHLTTask::AliHLTTask(AliHLTConfiguration* pConf)
68 fpConfiguration(pConf),
75 // see header file for function documentation
78 AliHLTTask::~AliHLTTask()
80 // see header file for function documentation
81 TObjLink* lnk=fListDependencies.FirstLink();
84 AliHLTTask* pTask=(AliHLTTask*)lnk->GetObject();
85 pTask->UnsetTarget(this);
88 lnk=fListTargets.FirstLink();
91 AliHLTTask* pTask=(AliHLTTask*)lnk->GetObject();
92 pTask->UnsetDependency(this);
96 if (fpComponent) delete fpComponent;
100 int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
102 // see header file for function documentation
104 if (fpConfiguration!=NULL && pConf!=NULL && fpConfiguration!=pConf) {
105 HLTWarning("overriding existing reference to configuration object %p by %p",
106 fpConfiguration, pConf);
108 if (pConf!=NULL) fpConfiguration=pConf;
109 iResult=CreateComponent(fpConfiguration, pCH, fpComponent);
111 iResult=CustomInit(pCH);
116 int AliHLTTask::CreateComponent(AliHLTConfiguration* pConfiguration, AliHLTComponentHandler* pCH, AliHLTComponent*& pComponent) const
118 // see header file for class documentation
120 if (!pConfiguration) return -EINVAL;
122 const AliHLTConfiguration* pConf=AliHLTConfigurationHandler::FindSubstitution(*pConfiguration);
123 if (!pConf) pConf=pConfiguration;
127 const char** argv=NULL;
128 if ((iResult=pConf->GetArguments(&argv))>=0) {
129 argc=iResult; // just to make it clear
130 // TODO: we have to think about the optional environment parameter,
131 // currently just set to NULL.
132 iResult=pCH->CreateComponent(pConf->GetComponentID(), pComponent);
133 if (pComponent && iResult>=0) {
135 description.Form("chainid=%s", GetName());
136 pComponent->SetComponentDescription(description.Data());
137 const AliHLTAnalysisEnvironment* pEnv=pCH->GetEnvironment();
138 if ((iResult=pComponent->Init(pEnv, NULL, argc, argv))>=0) {
139 //HLTDebug("component %s (%p) created", pComponent->GetComponentID(), pComponent);
141 HLTError("Initialization of component \"%s\" failed with error %d", pComponent->GetComponentID(), iResult);
144 //HLTError("can not find component \"%s\" (%d)", pConf->GetComponentID(), iResult);
147 HLTError("can not get argument list for configuration %s (%s)", pConf->GetName(), pConf->GetComponentID());
151 HLTError("component handler instance needed for task initialization");
155 HLTError("configuration object instance needed for task initialization");
161 int AliHLTTask::Deinit()
163 // see header file for function documentation
166 AliHLTComponent* pComponent=GetComponent();
169 //HLTDebug("delete component %s (%p)", pComponent->GetComponentID(), pComponent);
170 pComponent->Deinit();
173 HLTWarning("task doesn't seem to be in initialized");
178 const char *AliHLTTask::GetName() const
180 // see header file for function documentation
182 return fpConfiguration->GetName();
183 return TObject::GetName();
186 AliHLTConfiguration* AliHLTTask::GetConf() const
188 // see header file for function documentation
189 return fpConfiguration;
192 AliHLTComponent* AliHLTTask::GetComponent() const
194 // see header file for function documentation
198 AliHLTTask* AliHLTTask::FindDependency(const char* id)
200 // see header file for function documentation
201 AliHLTTask* pTask=NULL;
203 pTask=(AliHLTTask*)fListDependencies.FindObject(id);
208 int AliHLTTask::FollowDependency(const char* id, TList* pTgtList)
210 // see header file for function documentation
213 AliHLTTask* pDep=NULL;
214 if ((pDep=(AliHLTTask*)fListDependencies.FindObject(id))!=NULL) {
215 if (pTgtList) pTgtList->Add(pDep);
218 TObjLink* lnk=fListDependencies.FirstLink();
219 while (lnk && iResult==0) {
220 pDep=(AliHLTTask*)lnk->GetObject();
222 if ((iResult=pDep->FollowDependency(id, pTgtList))>0) {
223 if (pTgtList) pTgtList->AddFirst(pDep);
238 void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration)
240 // see header file for function documentation
241 HLTLogKeyword("task dependencies");
244 if (bFromConfiguration) {
246 iResult=fpConfiguration->FollowDependency(id, &tgtList);
250 iResult=FollowDependency(id, &tgtList);
252 HLTMessage(" dependency level %d ", iResult);
253 TObjLink* lnk=tgtList.FirstLink();
255 char* pSpace = new char[iResult+1];
257 memset(pSpace, 32, iResult);
260 TObject* obj=lnk->GetObject();
261 HLTMessage(" %s^-- %s ", &pSpace[i--], obj->GetName());
271 int AliHLTTask::SetDependency(AliHLTTask* pDep)
273 // see header file for function documentation
276 if (FindDependency(pDep->GetName())==NULL) {
277 fListDependencies.Add(pDep);
287 int AliHLTTask::UnsetDependency(AliHLTTask* pDep)
289 // see header file for function documentation
290 fListDependencies.Remove(pDep);
291 if (fpConfiguration) {
292 fpConfiguration->InvalidateSources();
297 int AliHLTTask::CheckDependencies()
299 // see header file for function documentation
301 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
303 if (FindDependency(pSrc->GetName())==NULL) {
304 //HLTDebug("dependency \"%s\" unresolved", pSrc->GetName());
307 pSrc=fpConfiguration->GetNextSource();
313 int AliHLTTask::Depends(AliHLTTask* pTask)
315 // see header file for function documentation
318 if (fpConfiguration) {
319 iResult=fpConfiguration->GetSource(pTask->GetName())!=NULL;
321 //HLTDebug("task \"%s\" depends on \"%s\"", GetName(), pTask->GetName());
323 //HLTDebug("task \"%s\" independend of \"%s\"", GetName(), pTask->GetName());
334 AliHLTTask* AliHLTTask::FindTarget(const char* id)
336 // see header file for function documentation
337 AliHLTTask* pTask=NULL;
339 pTask=(AliHLTTask*)fListTargets.FindObject(id);
344 int AliHLTTask::SetTarget(AliHLTTask* pTgt)
346 // see header file for function documentation
349 if (FindTarget(pTgt->GetName())==NULL) {
350 fListTargets.Add(pTgt);
360 int AliHLTTask::UnsetTarget(AliHLTTask* pTarget)
362 // see header file for function documentation
363 fListTargets.Remove(pTarget);
367 int AliHLTTask::StartRun()
369 // see header file for function documentation
371 int iNofInputDataBlocks=0;
372 AliHLTComponent* pComponent=GetComponent();
374 // determine the number of input data blocks provided from the source tasks
375 { // set scope for lnk as a local variable
376 TObjLink* lnk=fListDependencies.FirstLink();
377 while (lnk && iResult>=0) {
378 AliHLTTask* pSrcTask=(AliHLTTask*)lnk->GetObject();
380 if ((iResult=pSrcTask->GetNofMatchingDataTypes(this))>0) {
381 iNofInputDataBlocks+=iResult;
382 } else if (iResult==0) {
383 HLTWarning("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
385 HLTError("task %s (%p): error getting matching data types for source task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
393 if (fBlockDataArray.size()>0) {
394 HLTWarning("block data array for task %s (%p) was not cleaned", GetName(), this);
395 fBlockDataArray.clear();
399 // the initialization of the component is done by the ComponentHandler after creation
401 //iResult=Init( AliHLTAnalysisEnvironment* environ, void* environ_param, int argc, const char** argv );
403 // allocate the data buffer, which controls the output buffer and subscriptions
405 fpDataBuffer=new AliHLTDataBuffer;
406 if (fpDataBuffer!=NULL) {
407 fpDataBuffer->SetLocalLoggingLevel(GetLocalLoggingLevel());
408 HLTDebug("created data buffer %p for task %s (%p)", fpDataBuffer, GetName(), this);
409 TObjLink* lnk=fListTargets.FirstLink();
410 while (lnk && iResult>=0) {
411 AliHLTTask* pTgtTask=(AliHLTTask*)lnk->GetObject();
413 if ((iResult=fpDataBuffer->SetConsumer(pTgtTask->GetComponent()))>=0) {
422 HLTFatal("can not create data buffer object, memory allocation failed");
428 // send the SOR event
432 HLTError("task %s (%p) does not have a component", GetName(), this);
438 int AliHLTTask::EndRun()
440 // see header file for function documentation
442 if (fBlockDataArray.size()>0) {
443 fBlockDataArray.clear();
446 AliHLTDataBuffer* pBuffer=fpDataBuffer;
453 int AliHLTTask::ProcessTask(Int_t eventNo, AliHLTUInt32_t eventType, AliHLTUInt64_t trgMask)
455 // see header file for function documentation
457 AliHLTComponent* pComponent=GetComponent();
458 if (pComponent && fpDataBuffer) {
459 HLTDebug("Processing task %s (%p) fpDataBuffer %p", GetName(), this, fpDataBuffer);
460 fpDataBuffer->Reset();
461 int iSourceDataBlock=0;
462 int iInputDataVolume=0;
464 AliHLTTask* pSrcTask=NULL;
465 AliHLTTaskPList subscribedTaskList;
466 TObjLink* lnk=fListDependencies.FirstLink();
468 // instances of SOR and EOR events to be kept
472 // generalize handling of the special blocks to be forwarded on SOR and EOR
473 // just adding a new specific handling for the ECS parameter block as a quick
477 // subscribe to all source tasks
478 fBlockDataArray.clear();
479 while (lnk && iResult>=0) {
480 pSrcTask=(AliHLTTask*)lnk->GetObject();
482 int iMatchingDB=pSrcTask->GetNofMatchingDataBlocks(this);
484 HLTError("task %s (%p): error getting no of matching data blocks from task %s (%p), error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iMatchingDB);
487 } else if (iMatchingDB==0) {
488 HLTDebug("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
490 if ((iResult=pSrcTask->Subscribe(this, fBlockDataArray))>=0) {
492 AliHLTComponentBlockDataList::iterator block=fBlockDataArray.begin();
493 for (int i=0; block!=fBlockDataArray.end(); i++) {
495 bRemove|=(*block).fDataType==kAliHLTDataTypeSOR && !(iSOR<0 && (iSOR=i)>=0);
496 bRemove|=(*block).fDataType==kAliHLTDataTypeEOR && !(iEOR<0 && (iEOR=i)>=0);
497 bRemove|=(*block).fDataType==kAliHLTDataTypeECSParam && !(iECS<0 && (iECS=i)>=0);
498 //HLTInfo("block %d, iSOR=%d iEOR=%d remove=%d", i, iSOR, iEOR, bRemove);
499 if (i<iSourceDataBlock) {
501 } else if (bRemove) {
502 HLTDebug("remove duplicated event %s (%d)", AliHLTComponent::DataType2Text((*block).fDataType).c_str(), i);
503 pSrcTask->Release(&(*block), this);
504 block=fBlockDataArray.erase(block);
507 iInputDataVolume+=(*block).fSize;
508 // put the source task as many times into the list as it provides data blocks
509 // makes the bookkeeping for the data release easier
510 subscribedTaskList.push_back(pSrcTask);
514 HLTDebug("Task %s (%p) successfully subscribed to %d data block(s) of task %s (%p)", GetName(), this, iResult, pSrcTask->GetName(), pSrcTask);
515 iSourceDataBlock=fBlockDataArray.size();
518 HLTError("Task %s (%p): subscription to task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iResult);
522 HLTFatal("fatal internal error in ROOT list handling");
529 int iNofTrial=0; // repeat processing if component returns -ENOSPC
530 AliHLTUInt32_t iLastOutputDataSize=0;
533 long unsigned int iOutputDataSize=0;
534 AliHLTConfiguration* pConf=GetConf();
535 // check if there was a buffer size specified, query output size
536 // estimator from component otherwize
537 if (pConf && pConf->GetOutputBufferSize()>=0) {
538 iOutputDataSize=pConf->GetOutputBufferSize();
540 long unsigned int iConstBase=0;
541 double fInputMultiplier=0;
542 if (pComponent->GetComponentType()!=AliHLTComponent::kSink) {
543 pComponent->GetOutputDataSize(iConstBase, fInputMultiplier);
544 // add a small margin to the buffer to allow optional component
547 #if defined(__DEBUG) || defined(HLT_COMPONENT_STATISTICS)
548 for (AliHLTComponentBlockDataList::iterator element=fBlockDataArray.begin();
549 element!=fBlockDataArray.end(); element++) {
550 if (element->fDataType==kAliHLTDataTypeComponentStatistics) {
551 iConstBase+=element->fSize;
556 if (fInputMultiplier<0) {
557 HLTWarning("ignoring negative input multiplier");
560 iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
561 //HLTDebug("task %s: reqired output size %d", GetName(), iOutputDataSize);
564 // dont process again if the buffer size is the same
565 if (iLastOutputDataSize==iOutputDataSize) break;
566 HLTImportant("processing event %d again with buffer size %d", eventNo, iOutputDataSize);
568 AliHLTUInt8_t* pTgtBuffer=NULL;
569 if (iOutputDataSize>0) pTgtBuffer=fpDataBuffer->GetTargetBuffer(iOutputDataSize);
570 //HLTDebug("provided raw buffer %p", pTgtBuffer);
571 AliHLTComponentEventData evtData;
572 AliHLTComponent::FillEventData(evtData);
574 evtData.fEventID=(AliHLTEventID_t)eventNo;
575 evtData.fEventCreation_s=static_cast<AliHLTUInt32_t>(time(NULL));
576 AliHLTComponentTriggerData trigData;
577 AliHLTEventTriggerData evtTrigData;
578 trigData.fStructSize=sizeof(trigData);
579 trigData.fDataSize=sizeof(AliHLTEventTriggerData);
580 memset(&evtTrigData, 0, trigData.fDataSize);
581 evtTrigData.fCommonHeaderWordCnt=gkAliHLTCommonHeaderCount;
582 evtTrigData.fCommonHeader[5]=trgMask&0xffffffff;
584 evtTrigData.fCommonHeader[6]=trgMask&0x3ffff;
585 trigData.fData=&evtTrigData;
586 iLastOutputDataSize=iOutputDataSize;
587 AliHLTUInt32_t size=iOutputDataSize;
588 AliHLTUInt32_t outputBlockCnt=0;
589 AliHLTComponentBlockData* outputBlocks=NULL;
590 AliHLTComponentEventDoneData* edd=NULL;
591 if (pTgtBuffer!=NULL || iOutputDataSize==0) {
592 // add event type data block
593 // the block is removed immediately after processing from the list
594 AliHLTComponentBlockData eventTypeBlock;
595 AliHLTComponent::FillBlockData(eventTypeBlock);
597 eventTypeBlock.fDataType=kAliHLTDataTypeEvent;
598 eventTypeBlock.fSpecification=eventType;
599 fBlockDataArray.push_back(eventTypeBlock);
602 evtData.fBlockCnt=fBlockDataArray.size();
603 iResult=pComponent->ProcessEvent(evtData, &fBlockDataArray[0], trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
604 HLTDebug("component %s ProcessEvent finnished (%d): size=%d blocks=%d", pComponent->GetComponentID(), iResult, size, outputBlockCnt);
606 // EventDoneData is for the moment ignored in AliHLTSystem
608 HLTDebug("got EventDoneData size %d", edd->fDataSize);
609 delete [] reinterpret_cast<char*>(edd);
613 // remove event data block
614 fBlockDataArray.pop_back();
616 // check for forwarded blocks.
617 // loop over all output blocks and check
618 // 1. for duplicate blocks (pointing to same location in output buffer
619 // or to the same buffer)
620 // 2. for blocks forwarded from the input.
621 if (iResult>=0 && outputBlocks) {
622 if (fListTargets.First()!=NULL) {
623 AliHLTComponentBlockDataList segments;
624 for (AliHLTUInt32_t oblock=0; oblock<outputBlockCnt; oblock++) {
625 // consistency check for data reference
626 if (outputBlocks[oblock].fPtr!=NULL && outputBlocks[oblock].fPtr!=pTgtBuffer &&
627 outputBlocks[oblock].fOffset!=0) {
628 HLTWarning("output block %s 0x%08x has inconsistent data reference ptr=%p offset=0x%08x: "
629 "for new blocks use offset only, forwarded blocks have fPtr set only",
630 AliHLTComponent::DataType2Text(outputBlocks[oblock].fDataType).c_str(),
631 outputBlocks[oblock].fSpecification,
632 outputBlocks[oblock].fPtr, outputBlocks[oblock].fOffset);
635 // check for duplicates in the output
636 AliHLTUInt32_t checkblock=0;
637 for (; checkblock<oblock; checkblock++) {
638 if (outputBlocks[oblock].fPtr!=NULL && outputBlocks[oblock].fPtr!=pTgtBuffer &&
639 outputBlocks[checkblock].fPtr==outputBlocks[oblock].fPtr) {
640 if (outputBlocks[checkblock].fSize!=outputBlocks[oblock].fSize ||
641 outputBlocks[checkblock].fDataType!=outputBlocks[oblock].fDataType) {
642 HLTWarning("output blocks %d (%s 0x%08x) and %d (%s 0x%08x) have identical data references ptr=%p "
643 "but differ in data type and/or size: %d vs. %d",
645 AliHLTComponent::DataType2Text(outputBlocks[oblock].fDataType).c_str(),
646 outputBlocks[oblock].fSpecification,
648 AliHLTComponent::DataType2Text(outputBlocks[checkblock].fDataType).c_str(),
649 outputBlocks[checkblock].fSpecification,
650 outputBlocks[oblock].fPtr,
651 outputBlocks[oblock].fSize,
652 outputBlocks[checkblock].fSize);
654 // ignore from the second copy
658 if (checkblock<oblock) continue;
660 // search for the forwarded data blocks
661 // new data blocks are announced to the data buffer, forwarded data blocks
662 // to the publisher task. The publisher task of a forwarded data block is
663 // removed from the list in order to keep the buffer open. It will be releases
664 // when the subscribing task releases it
665 AliHLTUInt32_t iblock=0;
666 for (; iblock<fBlockDataArray.size(); iblock++) {
667 if (outputBlocks[oblock].fDataType==kAliHLTDataTypeEvent) {
668 // the event type data block is ignored if it was forwarded
671 if (fBlockDataArray[iblock].fPtr==outputBlocks[oblock].fPtr) {
672 assert(subscribedTaskList[iblock]!=NULL);
673 if (subscribedTaskList[iblock]==NULL) continue;
674 HLTDebug("forward segment %d (source task %s %p) to data buffer %p", iblock, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
675 fpDataBuffer->Forward(subscribedTaskList[iblock], &fBlockDataArray[iblock]);
676 subscribedTaskList[iblock]=NULL; // not to be released in the loop further down
680 if (iblock==fBlockDataArray.size()) segments.push_back(outputBlocks[oblock]);
682 if (pTgtBuffer && segments.size()>0) {
683 iResult=fpDataBuffer->SetSegments(pTgtBuffer, &segments[0], segments.size());
686 // no forwarding, actually we dont even need to keep the data, this is a
687 // dead end (fListTargets empty)
688 //iResult=fpDataBuffer->SetSegments(pTgtBuffer, outputBlocks, outputBlockCnt);
690 delete [] outputBlocks; outputBlocks=NULL; outputBlockCnt=0;
692 fpDataBuffer->Reset();
694 if (fListTargets.First()!=NULL) {
695 if (iSOR>=0 && subscribedTaskList[iSOR]!=NULL) {
696 HLTDebug("forward SOR event segment %d (source task %s %p) to data buffer %p", iSOR, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
697 fpDataBuffer->Forward(subscribedTaskList[iSOR], &fBlockDataArray[iSOR]);
698 subscribedTaskList[iSOR]=NULL; // not to be released in the loop further down
700 if (iEOR>=0 && subscribedTaskList[iEOR]!=NULL) {
701 HLTDebug("forward EOR event (%s) segment %d (source task %s %p) to data buffer %p", AliHLTComponent::DataType2Text(fBlockDataArray[iEOR].fDataType).c_str(), iEOR, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
702 fpDataBuffer->Forward(subscribedTaskList[iEOR], &fBlockDataArray[iEOR]);
703 subscribedTaskList[iEOR]=NULL; // not to be released in the loop further down
705 if (iECS>=0 && subscribedTaskList[iECS]!=NULL) {
706 HLTDebug("forward EOR event (%s) segment %d (source task %s %p) to data buffer %p", AliHLTComponent::DataType2Text(fBlockDataArray[iECS].fDataType).c_str(), iECS, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
707 fpDataBuffer->Forward(subscribedTaskList[iECS], &fBlockDataArray[iECS]);
708 subscribedTaskList[iECS]=NULL; // not to be released in the loop further down
712 HLTError("no target buffer available");
715 } while (iResult==-ENOSPC && iNofTrial++<1);
718 // now release all buffers which we have subscribed to
720 AliHLTTaskPList::iterator element;
721 while ((element=subscribedTaskList.begin())!=subscribedTaskList.end()) {
725 if ((iTempRes=pSrcTask->Release(&fBlockDataArray[iSourceDataBlock], this))>=0) {
726 HLTDebug("successfully released segment of task %s (%p)", pSrcTask->GetName(), pSrcTask);
728 HLTError("realease of task %s (%p) failed with error %d", pSrcTask->GetName(), pSrcTask, iTempRes);
731 subscribedTaskList.erase(element);
734 if (subscribedTaskList.size()>0) {
735 HLTError("could not release all data buffers");
738 HLTError("internal failure (not initialized component %p, data buffer %p)", fpComponent, fpDataBuffer);
744 int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const
746 // see header file for function documentation
750 iResult=fpDataBuffer->FindMatchingDataBlocks(pConsumerTask->GetComponent(), NULL);
752 HLTFatal("internal data buffer missing");
761 int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const
763 // see header file for function documentation
766 AliHLTComponent* pComponent=GetComponent();
769 HLTError("component not initialized");
773 iResult=pComponent->FindMatchingDataTypes(pConsumerTask->GetComponent(), NULL);
775 HLTFatal("task initialization failed");
784 int AliHLTTask::Subscribe(const AliHLTTask* pConsumerTask, AliHLTComponentBlockDataList& blockDescList)
786 // see header file for function documentation
790 iResult=fpDataBuffer->Subscribe(pConsumerTask->GetComponent(), blockDescList);
792 HLTFatal("internal data buffer missing");
801 int AliHLTTask::Release(AliHLTComponentBlockData* pBlockDesc, const AliHLTTask* pConsumerTask)
803 // see header file for function documentation
805 if (pConsumerTask && pBlockDesc) {
807 iResult=fpDataBuffer->Release(pBlockDesc, pConsumerTask->GetComponent(), this);
809 HLTFatal("internal data buffer missing");
818 void AliHLTTask::PrintStatus()
820 // see header file for function documentation
821 HLTLogKeyword("task properties");
822 AliHLTComponent* pComponent=GetComponent();
824 HLTMessage(" component: %s (%p)", pComponent->GetComponentID(), pComponent);
826 HLTMessage(" no component set!");
828 if (fpConfiguration) {
829 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
831 const char* pQualifier="unresolved";
832 if (FindDependency(pSrc->GetName()))
833 pQualifier="resolved";
834 HLTMessage(" source: %s (%s)", pSrc->GetName(), pQualifier);
835 pSrc=fpConfiguration->GetNextSource();
837 TObjLink* lnk = fListTargets.FirstLink();
839 TObject *obj = lnk->GetObject();
840 HLTMessage(" target: %s", obj->GetName());
844 HLTMessage(" task not initialized");
848 int AliHLTTask::CustomInit(AliHLTComponentHandler* /*pCH*/)
850 // default implementation nothing to do
854 int AliHLTTask::CustomCleanup()
856 // default implementation nothing to do
860 int AliHLTTask::LoggingVarargs(AliHLTComponentLogSeverity severity,
861 const char* originClass, const char* originFunc,
862 const char* file, int line, ... ) const
864 // see header file for function documentation
868 va_start(args, line);
870 AliHLTLogging::SetLogString(this, " (%p)", "%s_pfmt_: ", GetName());
871 iResult=SendMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args, true /*append*/));