documentation fixes
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTask.cxx
CommitLineData
7a436c89 1// $Id$
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. *
6 * *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
9 * *
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 **************************************************************************/
18
19/** @file AliHLTTask.cxx
20 @author Matthias Richter
21 @date
22 @brief Implementation of HLT tasks.
23*/
24
25// see header file for class documentation
26// or
27// refer to README to build package
28// or
29// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30
31#if __GNUC__>= 3
32using namespace std;
33#endif
34
35#include <cerrno>
b46ca65e 36#include <cassert>
7a436c89 37#include <iostream>
38#include <string>
39#include "AliHLTTask.h"
40#include "AliHLTConfiguration.h"
41#include "AliHLTComponent.h"
42#include "AliHLTComponentHandler.h"
43#include "TList.h"
44
45/** ROOT macro for the implementation of ROOT specific class methods */
46ClassImp(AliHLTTask)
47
48AliHLTTask::AliHLTTask()
49 :
50 fpConfiguration(NULL),
51 fpComponent(NULL),
52 fpDataBuffer(NULL),
53 fListTargets(),
54 fListDependencies(),
55 fBlockDataArray()
56{
57 // see header file for class documentation
58 // or
59 // refer to README to build package
60 // or
61 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
62}
63
64AliHLTTask::AliHLTTask(AliHLTConfiguration* pConf)
65 :
66 fpConfiguration(pConf),
67 fpComponent(NULL),
68 fpDataBuffer(NULL),
69 fListTargets(),
70 fListDependencies(),
71 fBlockDataArray()
72{
73 // see header file for function documentation
74}
75
76AliHLTTask::~AliHLTTask()
77{
78 // see header file for function documentation
79 TObjLink* lnk=fListDependencies.FirstLink();
80
81 while (lnk!=NULL) {
82 AliHLTTask* pTask=(AliHLTTask*)lnk->GetObject();
83 pTask->UnsetTarget(this);
84 lnk=lnk->Next();
85 }
86 lnk=fListTargets.FirstLink();
87
88 while (lnk!=NULL) {
89 AliHLTTask* pTask=(AliHLTTask*)lnk->GetObject();
90 pTask->UnsetDependency(this);
91 lnk=lnk->Next();
92 }
93
94 if (fpComponent) delete fpComponent;
95 fpComponent=NULL;
96}
97
98int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
99{
100 // see header file for function documentation
101 int iResult=0;
102 if (fpConfiguration!=NULL && pConf!=NULL && fpConfiguration!=pConf) {
103 HLTWarning("overriding existing reference to configuration object %p (%s) by %p",
104 fpConfiguration, GetName(), pConf);
105 }
106 if (pConf!=NULL) fpConfiguration=pConf;
107 if (fpConfiguration) {
108 if (pCH) {
109 int argc=0;
110 const char** argv=NULL;
111 if ((iResult=fpConfiguration->GetArguments(&argv))>=0) {
112 argc=iResult; // just to make it clear
113 // TODO: we have to think about the optional environment parameter,
114 // currently just set to NULL.
115 iResult=pCH->CreateComponent(fpConfiguration->GetComponentID(), NULL, argc, argv, fpComponent);
116 if (fpComponent || iResult<=0) {
117 //HLTDebug("component %s (%p) created", fpComponent->GetComponentID(), fpComponent);
118 } else {
e642a402 119 //HLTError("can not find component \"%s\" (%d)", fpConfiguration->GetComponentID(), iResult);
7a436c89 120 }
121 } else {
122 HLTError("can not get argument list for configuration %s (%s)", fpConfiguration->GetName(), fpConfiguration->GetComponentID());
123 iResult=-EINVAL;
124 }
125 } else {
126 HLTError("component handler instance needed for task initialization");
127 iResult=-EINVAL;
128 }
129 } else {
130 HLTError("configuration object instance needed for task initialization");
131 iResult=-EINVAL;
132 }
133 return iResult;
134}
135
136int AliHLTTask::Deinit()
137{
138 // see header file for function documentation
139 int iResult=0;
140 AliHLTComponent* pComponent=GetComponent();
141 fpComponent=NULL;
142 if (pComponent) {
143 //HLTDebug("delete component %s (%p)", pComponent->GetComponentID(), pComponent);
144 pComponent->Deinit();
145 delete pComponent;
146 } else {
147 HLTWarning("task %s (%p) doesn't seem to be in initialized", GetName(), this);
148 }
149 return iResult;
150}
151
152const char *AliHLTTask::GetName() const
153{
154 // see header file for function documentation
155 if (fpConfiguration)
156 return fpConfiguration->GetName();
157 return TObject::GetName();
158}
159
160AliHLTConfiguration* AliHLTTask::GetConf() const
161{
162 // see header file for function documentation
163 return fpConfiguration;
164}
165
166AliHLTComponent* AliHLTTask::GetComponent() const
167{
168 // see header file for function documentation
169 return fpComponent;
170}
171
172AliHLTTask* AliHLTTask::FindDependency(const char* id)
173{
174 // see header file for function documentation
175 AliHLTTask* pTask=NULL;
176 if (id) {
177 pTask=(AliHLTTask*)fListDependencies.FindObject(id);
178 }
179 return pTask;
180}
181
182int AliHLTTask::FollowDependency(const char* id, TList* pTgtList)
183{
184 // see header file for function documentation
185 int iResult=0;
186 if (id) {
187 AliHLTTask* pDep=NULL;
188 if ((pDep=(AliHLTTask*)fListDependencies.FindObject(id))!=NULL) {
189 if (pTgtList) pTgtList->Add(pDep);
190 iResult++;
191 } else {
192 TObjLink* lnk=fListDependencies.FirstLink();
193 while (lnk && iResult==0) {
194 pDep=(AliHLTTask*)lnk->GetObject();
195 if (pDep) {
196 if ((iResult=pDep->FollowDependency(id, pTgtList))>0) {
197 if (pTgtList) pTgtList->AddFirst(pDep);
198 iResult++;
199 }
200 } else {
201 iResult=-EFAULT;
202 }
203 lnk=lnk->Next();
204 }
205 }
206 } else {
207 iResult=-EINVAL;
208 }
209 return iResult;
210}
211
212void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration)
213{
214 // see header file for function documentation
215 HLTLogKeyword("task dependencies");
216 int iResult=0;
217 TList tgtList;
218 if (bFromConfiguration) {
219 if (fpConfiguration)
220 iResult=fpConfiguration->FollowDependency(id, &tgtList);
221 else
222 iResult=-EFAULT;
223 } else
224 iResult=FollowDependency(id, &tgtList);
225 if (iResult>0) {
226 HLTMessage(" task \"%s\": dependency level %d ", GetName(), iResult);
227 TObjLink* lnk=tgtList.FirstLink();
228 int i=iResult;
229 char* pSpace = new char[iResult+1];
230 if (pSpace) {
231 memset(pSpace, 32, iResult);
232 pSpace[i]=0;
233 while (lnk) {
234 TObject* obj=lnk->GetObject();
235 HLTMessage(" %s^-- %s ", &pSpace[i--], obj->GetName());
236 lnk=lnk->Next();
237 }
238 delete [] pSpace;
239 } else {
240 iResult=-ENOMEM;
241 }
242 }
243}
244
245int AliHLTTask::SetDependency(AliHLTTask* pDep)
246{
247 // see header file for function documentation
248 int iResult=0;
249 if (pDep) {
250 if (FindDependency(pDep->GetName())==NULL) {
251 fListDependencies.Add(pDep);
252 } else {
253 iResult=-EEXIST;
254 }
255 } else {
256 iResult=-EINVAL;
257 }
258 return iResult;
259}
260
261int AliHLTTask::UnsetDependency(AliHLTTask* pDep)
262{
263 // see header file for function documentation
264 fListDependencies.Remove(pDep);
265 if (fpConfiguration) {
266 fpConfiguration->InvalidateSources();
267 }
268 return 0;
269}
270
271int AliHLTTask::CheckDependencies()
272{
273 // see header file for function documentation
274 int iResult=0;
275 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
276 while (pSrc) {
277 if (FindDependency(pSrc->GetName())==NULL) {
278 //HLTDebug("dependency \"%s\" unresolved", pSrc->GetName());
279 iResult++;
280 }
281 pSrc=fpConfiguration->GetNextSource();
282 }
283 return iResult;
284}
285
286
287int AliHLTTask::Depends(AliHLTTask* pTask)
288{
289 // see header file for function documentation
290 int iResult=0;
291 if (pTask) {
292 if (fpConfiguration) {
293 iResult=fpConfiguration->GetSource(pTask->GetName())!=NULL;
294 if (iResult>0) {
295 //HLTDebug("task \"%s\" depends on \"%s\"", GetName(), pTask->GetName());
296 } else {
297 //HLTDebug("task \"%s\" independend of \"%s\"", GetName(), pTask->GetName());
298 }
299 } else {
300 iResult=-EFAULT;
301 }
302 } else {
303 iResult=-EINVAL;
304 }
305 return iResult;
306}
307
308AliHLTTask* AliHLTTask::FindTarget(const char* id)
309{
310 // see header file for function documentation
311 AliHLTTask* pTask=NULL;
312 if (id) {
313 pTask=(AliHLTTask*)fListTargets.FindObject(id);
314 }
315 return pTask;
316}
317
318int AliHLTTask::SetTarget(AliHLTTask* pTgt)
319{
320 // see header file for function documentation
321 int iResult=0;
322 if (pTgt) {
323 if (FindTarget(pTgt->GetName())==NULL) {
324 fListTargets.Add(pTgt);
325 } else {
326 iResult=-EEXIST;
327 }
328 } else {
329 iResult=-EINVAL;
330 }
331 return iResult;
332}
333
334int AliHLTTask::UnsetTarget(AliHLTTask* pTarget)
335{
336 // see header file for function documentation
337 fListTargets.Remove(pTarget);
338 return 0;
339}
340
341int AliHLTTask::StartRun()
342{
343 // see header file for function documentation
344 int iResult=0;
345 int iNofInputDataBlocks=0;
346 AliHLTComponent* pComponent=GetComponent();
347 if (pComponent) {
348 // determine the number of input data blocks provided from the source tasks
349 TObjLink* lnk=fListDependencies.FirstLink();
350 while (lnk && iResult>=0) {
351 AliHLTTask* pSrcTask=(AliHLTTask*)lnk->GetObject();
352 if (pSrcTask) {
353 if ((iResult=pSrcTask->GetNofMatchingDataTypes(this))>0) {
354 iNofInputDataBlocks+=iResult;
355 } else if (iResult==0) {
356 HLTWarning("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
357 } else {
358 HLTError("task %s (%p): error getting matching data types for source task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
359 iResult=-EFAULT;
360 }
361 }
362 lnk=lnk->Next();
363 }
364 if (iResult>=0) {
365 if (fBlockDataArray.size()>0) {
366 HLTWarning("block data array for task %s (%p) was not cleaned", GetName(), this);
367 fBlockDataArray.resize(0);
368 }
369
370 // component init
371 // the initialization of the component is done by the ComponentHandler after creation
372 // of the component.
373 //iResult=Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv );
374
375 // allocate internal task variables for bookkeeping aso.
376 // we allocate the BlockData array with at least one member
377 if (iNofInputDataBlocks==0) iNofInputDataBlocks=1;
378 AliHLTComponentBlockData init;
379 memset(&init, 0, sizeof(AliHLTComponentBlockData));
380 fBlockDataArray.resize(iNofInputDataBlocks, init);
381
382 // allocate the data buffer, which controls the output buffer and subscriptions
383 if (iResult>=0) {
384 fpDataBuffer=new AliHLTDataBuffer;
385 if (fpDataBuffer!=NULL) {
dba03d72 386 fpDataBuffer->SetLocalLoggingLevel(GetLocalLoggingLevel());
7a436c89 387 HLTDebug("created data buffer %p for task %s (%p)", fpDataBuffer, GetName(), this);
388 TObjLink* lnk=fListTargets.FirstLink();
389 while (lnk && iResult>=0) {
390 AliHLTTask* pTgtTask=(AliHLTTask*)lnk->GetObject();
391 if (pTgtTask) {
392 if ((iResult=fpDataBuffer->SetConsumer(pTgtTask->GetComponent()))>=0) {
393 }
394 } else {
395 break;
396 iResult=-EFAULT;
397 }
398 lnk=lnk->Next();
399 }
400 } else {
401 HLTFatal("can not create data buffer object, memory allocation failed");
402 iResult=-ENOMEM;
403 }
404 }
405 }
406 } else {
407 HLTError("task %s (%p) does not have a component", GetName(), this);
408 iResult=-EFAULT;
409 }
410 return iResult;
411}
412
413int AliHLTTask::EndRun()
414{
415 // see header file for function documentation
416 int iResult=0;
417 if (fBlockDataArray.size()>0) {
418 fBlockDataArray.resize(0);
419 } else {
420 HLTWarning("task %s (%p) doesn't seem to be in running mode", GetName(), this);
421 }
422 if (fpDataBuffer) {
423 AliHLTDataBuffer* pBuffer=fpDataBuffer;
424 fpDataBuffer=NULL;
425 delete pBuffer;
426 }
427 return iResult;
428}
429
430int AliHLTTask::ProcessTask(Int_t eventNo)
431{
432 // see header file for function documentation
433 int iResult=0;
434 AliHLTComponent* pComponent=GetComponent();
435 if (pComponent && fpDataBuffer) {
436 HLTDebug("Processing task %s (%p) fpDataBuffer %p", GetName(), this, fpDataBuffer);
437 fpDataBuffer->Reset();
438 int iSourceDataBlock=0;
439 int iInputDataVolume=0;
440
441 AliHLTTask* pSrcTask=NULL;
b46ca65e 442 AliHLTTaskPList subscribedTaskList;
7a436c89 443 TObjLink* lnk=fListDependencies.FirstLink();
444
445 // subscribe to all source tasks
446 while (lnk && iResult>=0) {
447 pSrcTask=(AliHLTTask*)lnk->GetObject();
448 if (pSrcTask) {
449 int iMatchingDB=pSrcTask->GetNofMatchingDataBlocks(this);
450 if (iMatchingDB>=0 && static_cast<unsigned int>(iMatchingDB)>fBlockDataArray.size()-iSourceDataBlock) {
451 AliHLTComponentBlockData init;
452 memset(&init, 0, sizeof(AliHLTComponentBlockData));
453 fBlockDataArray.resize(iSourceDataBlock+iMatchingDB, init);
454 } else {
455 if (iMatchingDB<0) {
456 HLTError("task %s (%p): error getting no of matching data blocks from task %s (%p), error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iMatchingDB);
457 iResult=iMatchingDB;
458 break;
459 } else if (iMatchingDB==0) {
460 HLTDebug("source task %s (%p) does not provide any matching data type for task %s (%p)", pSrcTask->GetName(), pSrcTask, GetName(), this);
461 }
462 }
463 if ((iResult=pSrcTask->Subscribe(this, &fBlockDataArray[iSourceDataBlock],fBlockDataArray.size()-iSourceDataBlock))>=0) {
464 for (int i=0; i<iResult; i++) {
465 iInputDataVolume+=fBlockDataArray[i+iSourceDataBlock].fSize;
466 // put the source task as many times into the list as it provides data blocks
467 // makes the bookkeeping for the data release easier
b46ca65e 468 subscribedTaskList.push_back(pSrcTask);
7a436c89 469 }
470 HLTDebug("Task %s (%p) successfully subscribed to %d data block(s) of task %s (%p)", GetName(), this, iResult, pSrcTask->GetName(), pSrcTask);
471 iSourceDataBlock+=iResult;
472 iResult=0;
473 } else {
474 HLTError("Task %s (%p): subscription to task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iResult);
475 iResult=-EFAULT;
476 }
477 } else {
478 HLTFatal("fatal internal error in ROOT list handling");
479 iResult=-EFAULT;
480 }
481 lnk=lnk->Next();
482 }
483
484 // process the event
485 int iNofTrial=0; // repeat processing if component returns -ENOSPC
486 AliHLTUInt32_t size=0;
487 if (iResult>=0) {
488 do {
489 long unsigned int iConstBase=0;
490 double fInputMultiplier=0;
491 if (pComponent->GetComponentType()!=AliHLTComponent::kSink)
492 pComponent->GetOutputDataSize(iConstBase, fInputMultiplier);
493 if (fInputMultiplier<0) {
494 HLTWarning("ignoring negative input multiplier");
495 fInputMultiplier=0;
496 }
497 long unsigned int iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
498 //HLTDebug("task %s: reqired output size %d", GetName(), iOutputDataSize);
499 if (iNofTrial>0) {
500 // dont process again if the buffer size is the same
501 if (size==iOutputDataSize) break;
502 HLTInfo("processing task %s again with buffer size %d", GetName(), iOutputDataSize);
503 }
504 AliHLTUInt8_t* pTgtBuffer=NULL;
505 if (iOutputDataSize>0) pTgtBuffer=fpDataBuffer->GetTargetBuffer(iOutputDataSize);
506 //HLTDebug("provided raw buffer %p", pTgtBuffer);
507 AliHLTComponentEventData evtData;
508 AliHLTComponent::FillEventData(evtData);
509 evtData.fEventID=(AliHLTEventID_t)eventNo;
510 evtData.fBlockCnt=iSourceDataBlock;
511 AliHLTComponentTriggerData trigData;
512 size=iOutputDataSize;
513 AliHLTUInt32_t outputBlockCnt=0;
514 AliHLTComponentBlockData* outputBlocks=NULL;
515 AliHLTComponentEventDoneData* edd;
516 if (pTgtBuffer!=NULL || iOutputDataSize==0) {
517 iResult=pComponent->ProcessEvent(evtData, &fBlockDataArray[0], trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
518 HLTDebug("task %s: component %s ProcessEvent finnished (%d): size=%d blocks=%d", GetName(), pComponent->GetComponentID(), iResult, size, outputBlockCnt);
b46ca65e 519 if (iResult>=0 && outputBlocks) {
520 AliHLTComponentBlockDataList segments;
d76bc02a 521 for (AliHLTUInt32_t oblock=0; oblock<outputBlockCnt; oblock++) {
522 AliHLTUInt32_t iblock=0;
b46ca65e 523 for (; iblock<evtData.fBlockCnt; iblock++) {
524 if (fBlockDataArray[iblock].fPtr==outputBlocks[oblock].fPtr) {
525 assert(subscribedTaskList[iblock]!=NULL);
526 if (subscribedTaskList[iblock]==NULL) continue;
527 HLTDebug("forward segment %d (source task %s %p) to data buffer %p", iblock, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
528 fpDataBuffer->Forward(subscribedTaskList[iblock], &fBlockDataArray[iblock]);
529 subscribedTaskList[iblock]=NULL; // not to be released in the loop further down
530 break;
531 }
532 }
533 if (iblock==evtData.fBlockCnt) segments.push_back(outputBlocks[oblock]);
534 }
535 if (pTgtBuffer && segments.size()>0) {
536 iResult=fpDataBuffer->SetSegments(pTgtBuffer, &segments[0], segments.size());
537 }
7a436c89 538 delete [] outputBlocks; outputBlocks=NULL; outputBlockCnt=0;
539 } else {
540 fpDataBuffer->Reset();
541 }
542 } else {
543 HLTError("task %s: no target buffer available", GetName());
544 iResult=-EFAULT;
545 }
546 } while (iResult==-ENOSPC && iNofTrial++<1);
547 }
548
549 // now release all buffers which we have subscribed to
550 iSourceDataBlock=0;
b46ca65e 551 AliHLTTaskPList::iterator element;
552 while ((element=subscribedTaskList.begin())!=subscribedTaskList.end()) {
553 pSrcTask=*element;
7a436c89 554 if (pSrcTask) {
555 int iTempRes=0;
556 if ((iTempRes=pSrcTask->Release(&fBlockDataArray[iSourceDataBlock], this))>=0) {
557 HLTDebug("Task %s (%p) successfully released segment of task %s (%p)", GetName(), this, pSrcTask->GetName(), pSrcTask);
558 } else {
559 HLTError("Task %s (%p): realease of task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iTempRes);
560 }
7a436c89 561 }
b46ca65e 562 subscribedTaskList.erase(element);
7a436c89 563 iSourceDataBlock++;
564 }
b46ca65e 565 if (subscribedTaskList.size()>0) {
7a436c89 566 HLTError("task %s (%p): could not release all data buffers", GetName(), this);
567 }
568 } else {
569 HLTError("task %s (%p): internal failure (not initialized component %p, data buffer %p)", GetName(), this, fpComponent, fpDataBuffer);
570 iResult=-EFAULT;
571 }
572 return iResult;
573}
574
575int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const
576{
577 // see header file for function documentation
578 int iResult=0;
579 if (pConsumerTask) {
580 if (fpDataBuffer) {
581 iResult=fpDataBuffer->FindMatchingDataBlocks(pConsumerTask->GetComponent(), NULL);
582 } else {
583 HLTFatal("internal data buffer missing");
584 iResult=-EFAULT;
585 }
586 } else {
587 iResult=-EINVAL;
588 }
589 return iResult;
590}
591
592int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const
593{
594 // see header file for function documentation
595 int iResult=0;
596 if (pConsumerTask) {
597 AliHLTComponent* pComponent=GetComponent();
598 if (!pComponent) {
599 // init ?
600 HLTError("component not initialized");
601 iResult=-EFAULT;
602 }
603 if (pComponent) {
604 iResult=pComponent->FindMatchingDataTypes(pConsumerTask->GetComponent(), NULL);
605 } else {
606 HLTFatal("task initialization failed");
607 iResult=-EFAULT;
608 }
609 } else {
610 iResult=-EINVAL;
611 }
612 return iResult;
613}
614
615int AliHLTTask::Subscribe(const AliHLTTask* pConsumerTask, AliHLTComponentBlockData* pBlockDesc, int iArraySize)
616{
617 // see header file for function documentation
618 int iResult=0;
619 if (pConsumerTask) {
620 if (fpDataBuffer) {
621 iResult=fpDataBuffer->Subscribe(pConsumerTask->GetComponent(), pBlockDesc, iArraySize);
622 } else {
623 HLTFatal("internal data buffer missing");
624 iResult=-EFAULT;
625 }
626 } else {
627 iResult=-EINVAL;
628 }
629 return iResult;
630}
631
632int AliHLTTask::Release(AliHLTComponentBlockData* pBlockDesc, const AliHLTTask* pConsumerTask)
633{
634 // see header file for function documentation
635 int iResult=0;
636 if (pConsumerTask && pBlockDesc) {
637 if (fpDataBuffer) {
b46ca65e 638 iResult=fpDataBuffer->Release(pBlockDesc, pConsumerTask->GetComponent(), this);
7a436c89 639 } else {
640 HLTFatal("internal data buffer missing");
641 iResult=-EFAULT;
642 }
643 } else {
644 iResult=-EINVAL;
645 }
646 return iResult;
647}
648
649void AliHLTTask::PrintStatus()
650{
651 // see header file for function documentation
652 HLTLogKeyword("task properties");
653 AliHLTComponent* pComponent=GetComponent();
654 if (pComponent) {
655 HLTMessage(" component: %s (%p)", pComponent->GetComponentID(), pComponent);
656 } else {
657 HLTMessage(" no component set!");
658 }
659 if (fpConfiguration) {
660 AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
661 while (pSrc) {
662 const char* pQualifier="unresolved";
663 if (FindDependency(pSrc->GetName()))
664 pQualifier="resolved";
665 HLTMessage(" source: %s (%s)", pSrc->GetName(), pQualifier);
666 pSrc=fpConfiguration->GetNextSource();
667 }
668 TObjLink* lnk = fListTargets.FirstLink();
669 while (lnk) {
670 TObject *obj = lnk->GetObject();
671 HLTMessage(" target: %s", obj->GetName());
672 lnk = lnk->Next();
673 }
674 } else {
675 HLTMessage(" task \"%s\" not initialized", GetName());
676 }
677}