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 AliHLTOUT.cxx
20 @author Matthias Richter
22 @brief The control class for HLTOUT data.
27 #include "AliHLTOUT.h"
32 /** ROOT macro for the implementation of ROOT specific class methods */
35 AliHLTOUT::AliHLTOUT()
37 fSearchDataType(kAliHLTVoidDataType),
38 fSearchSpecification(kAliHLTVoidDataSpec),
39 fSearchHandlerType(AliHLTModuleAgent::kUnknownOutput),
40 fFlags(kSkipProcessed),
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
55 AliHLTOUT::~AliHLTOUT()
57 // see header file for class documentation
58 if (CheckStatusFlag(kIsSubCollection)) {
59 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "~AliHLTOUT" , __FILE__ , __LINE__ , "severe internal error: collection has not been released, potential crash due to invalid pointer");
62 AliHLTOUT* AliHLTOUT::fgGlobalInstance=NULL;
66 // see header file for class documentation
69 // ignore if already initialized
70 if (fBlockDescList.size()>0) {
71 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "Init" , __FILE__ , __LINE__ , "instance %p already initialized, skipping ...", this);
75 SetStatusFlag(kCollecting);
76 if ((iResult=GenerateIndex())>=0) {
77 if ((iResult=InitHandlers())>=0) {
80 ClearStatusFlag(kCollecting);
84 int AliHLTOUT::GetNofDataBlocks()
86 // see header file for class documentation
87 return fBlockDescList.size();
90 int AliHLTOUT::SelectFirstDataBlock(AliHLTComponentDataType dt, AliHLTUInt32_t spec,
91 AliHLTModuleAgent::AliHLTOUTHandlerType handlerType,
94 // see header file for class documentation
97 fSearchSpecification=spec;
98 fSearchHandlerType=handlerType;
99 if (skipProcessed) SetStatusFlag(kSkipProcessed);
100 else ClearStatusFlag(kSkipProcessed);
101 return FindAndSelectDataBlock();
104 int AliHLTOUT::SelectNextDataBlock()
106 // see header file for class documentation
107 if (fCurrent>=fBlockDescList.size()) return -ENOENT;
109 return FindAndSelectDataBlock();
112 int AliHLTOUT::FindAndSelectDataBlock()
114 // see header file for class documentation
115 if (CheckStatusFlag(kLocked)) return -EPERM;
117 while (fCurrent<fBlockDescList.size() && iResult==-ENOENT) {
118 if (fBlockDescList[fCurrent]==fSearchDataType &&
119 (fSearchSpecification==kAliHLTVoidDataSpec || fBlockDescList[fCurrent]==fSearchSpecification) &&
120 (fSearchHandlerType==AliHLTModuleAgent::kUnknownOutput || FindHandlerDesc(fCurrent)==fSearchHandlerType) &&
121 (!CheckStatusFlag(kBlockSelection) || fBlockDescList[fCurrent].IsSelected()) &&
122 (!CheckStatusFlag(kSkipProcessed) || !fBlockDescList[fCurrent].IsProcessed())) {
123 iResult=fBlockDescList[fCurrent].GetIndex();
124 // TODO: check the byte order on the current system and the byte order of the
125 // data block, print warning when mismatch and user did not check
126 //AliHLTOUTByteOrder blockBO=CheckByteOrder();
129 if (blockBO!=fByteOrder) {
130 SetStatusFlag(kByteOrderWarning);
134 ClearStatusFlag(kByteOrderChecked);
136 // TODO: check the alignment on the current system and the alignment of the
137 // data block, print warning when mismatch and user did not check
138 ClearStatusFlag(kAlignmentChecked);
147 int AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
149 // see header file for class documentation
151 if (fCurrent<fBlockDescList.size()) {
153 dt=fBlockDescList[fCurrent];
154 spec=fBlockDescList[fCurrent];
159 const AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::GetDataBlockHandlerDesc()
161 // see header file for class documentation
162 return FindHandlerDesc(fCurrent);
165 AliHLTModuleAgent::AliHLTOUTHandlerType AliHLTOUT::GetDataBlockHandlerType()
167 // see header file for class documentation
168 AliHLTModuleAgent::AliHLTOUTHandlerDesc desc=FindHandlerDesc(fCurrent);
169 AliHLTModuleAgent::AliHLTOUTHandlerType type=desc;
173 AliHLTUInt32_t AliHLTOUT::GetDataBlockIndex()
175 // see header file for class documentation
176 if (fCurrent>=fBlockDescList.size()) return AliHLTOUTInvalidIndex;
177 return fBlockDescList[fCurrent].GetIndex();
180 int AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
182 // see header file for class documentation
186 if (fCurrent<fBlockDescList.size()) {
187 if ((iResult=fBlockDescList[fCurrent].GetDataBuffer(pBuffer, size))>=0) {
194 int AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
196 // see header file for class documentation
198 if (pBuffer==fpBuffer) {
201 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "ReleaseDataBuffer" , __FILE__ , __LINE__ , "buffer %p does not match the provided one %p", pBuffer, fpBuffer);
206 AliHLTModuleAgent* AliHLTOUT::GetAgent()
208 // see header file for class documentation
209 AliHLTModuleAgent* pAgent=NULL;
210 pAgent=FindHandlerDesc(fCurrent);
214 AliHLTOUTHandler* AliHLTOUT::GetHandler()
216 // see header file for class documentation
217 AliHLTOUTHandler* pHandler=NULL;
218 pHandler=FindHandlerDesc(fCurrent);
222 int AliHLTOUT::WriteESD(const AliHLTUInt8_t* /*pBuffer*/, AliHLTUInt32_t /*size*/, AliHLTComponentDataType /*dt*/, AliESDEvent* /*tgtesd*/) const
224 // see header file for class documentation
225 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "WriteESD" , __FILE__ , __LINE__ , "method not implemented in base class");
229 int AliHLTOUT::AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc)
231 // see header file for class documentation
232 if (!CheckStatusFlag(kCollecting)) return -EPERM;
234 fBlockDescList.push_back(desc);
238 AliHLTOUT::AliHLTOUTByteOrder AliHLTOUT::CheckByteOrder()
240 // see header file for class documentation
241 if (fCurrent<fBlockDescList.size()) {
242 SetStatusFlag(kByteOrderChecked);
243 AliHLTOUT::AliHLTOUTByteOrder order=CheckBlockByteOrder(fBlockDescList[fCurrent].GetIndex());
246 return kInvalidByteOrder;
249 int AliHLTOUT::CheckAlignment(AliHLTOUT::AliHLTOUTDataType type)
251 // see header file for class documentation
252 if (fCurrent<fBlockDescList.size()) {
253 SetStatusFlag(kAlignmentChecked);
254 int alignment=CheckBlockAlignment(fBlockDescList[fCurrent].GetIndex(), type);
260 int AliHLTOUT::InitHandlers()
262 // see header file for class documentation
264 AliHLTOUTIndexList remnants;
266 for (int havedata=SelectFirstDataBlock(kAliHLTAnyDataType, kAliHLTVoidDataSpec); havedata>=0; havedata=SelectNextDataBlock()) {
268 remnants.push_back(GetDataBlockIndex());
269 AliHLTComponentDataType dt=kAliHLTVoidDataType;
270 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
271 if (GetDataBlockDescription(dt, spec)<0) break;
272 bool bHaveHandler=false;
273 for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); pAgent && iResult>=0; pAgent=AliHLTModuleAgent::GetNextAgent()) {
274 AliHLTModuleAgent::AliHLTOUTHandlerDesc handlerDesc;
275 if (pAgent->GetHandlerDescription(dt, spec, handlerDesc)>0) {
276 AliHLTOUTHandlerListEntry entry(pAgent->GetOutputHandler(dt, spec), handlerDesc, pAgent, GetDataBlockIndex());
277 InsertHandler(fDataHandlers, entry);
283 if (!bHaveHandler && (dt==kAliHLTDataTypeESDObject || dt==kAliHLTDataTypeESDTree)) {
284 // ESDs are handled by the framework
289 // warning if some of the data blocks are not selected by the kAliHLTAnyDataType
291 if (GetNofDataBlocks()>iCount) {
292 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "InitHandlers" , __FILE__ , __LINE__ , "incomplete data type in %d out of %d data block(s)", GetNofDataBlocks()-iCount, GetNofDataBlocks());
295 // warning if handler not found
296 if (remnants.size()>0) {
297 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "InitHandlers" , __FILE__ , __LINE__ , "no handlers found for %d data blocks out of %d", remnants.size(), iCount);
298 AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
299 for (AliHLTOUTIndexList::iterator element=remnants.begin(); element!=remnants.end(); element++) {
300 for (int trials=0; trials<2; trials++) {
302 // we start searching the index from the current position in the block list
303 if ((*block).GetIndex()==*element) break;
304 } while ((++block)!=fBlockDescList.end());
305 if (block==fBlockDescList.end()) {
306 // rewind and try again
307 block=fBlockDescList.begin();
310 assert(block!=fBlockDescList.end());
311 if (block!=fBlockDescList.end()) {
312 //HLTDebug(" %s", AliHLTComponent::DataType2Text((AliHLTComponentDataType)*block).c_str());
319 int AliHLTOUT::InsertHandler(AliHLTOUTHandlerListEntryVector& list, const AliHLTOUTHandlerListEntry &entry)
321 // see header file for class documentation
323 AliHLTOUTHandlerListEntryVector::iterator element=list.begin();
324 for (; element!=list.end();
326 if (entry==(*element)) break;
328 if (element==list.end()) {
329 list.push_back(entry);
331 element->AddIndex(const_cast<AliHLTOUTHandlerListEntry&>(entry));
336 int AliHLTOUT::FillHandlerList(AliHLTOUTHandlerListEntryVector& list, AliHLTModuleAgent::AliHLTOUTHandlerType handlerType)
338 // see header file for class documentation
340 for (iResult=SelectFirstDataBlock(kAliHLTAnyDataType, kAliHLTVoidDataSpec, handlerType);
342 iResult=SelectNextDataBlock()) {
343 AliHLTComponentDataType dt=kAliHLTVoidDataType;
344 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
345 GetDataBlockDescription(dt, spec);
346 AliHLTOUTHandler* pHandler=GetHandler();
348 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "FillHandlerList" , __FILE__ , __LINE__ ,
349 "missing HLTOUT handler for block of type kChain: agent %s, data type %s, specification %#x, ... skipping data block",
350 GetAgent()?GetAgent()->GetModuleId():"invalid",
351 AliHLTComponent::DataType2Text(dt).c_str(), spec);
353 InsertHandler(list, GetDataBlockHandlerDesc());
356 // TODO: the return value of SelectFirst/NextDataBlock must be
357 // changed in order to avoid this check
358 if (iResult==-ENOENT) iResult=0;
363 int AliHLTOUT::RemoveEmptyDuplicateHandlers(AliHLTOUTHandlerListEntryVector& list)
365 // see header file for class documentation
367 AliHLTOUTHandlerListEntryVector::iterator element=list.begin();
368 while (element!=list.end()) {
369 if (element->IsEmpty()) {
370 AliHLTOUTHandler* pHandler=*element;
371 AliHLTModuleAgent* pAgent=*element;
372 AliHLTModuleAgent::AliHLTOUTHandlerDesc desc=*element;
373 if (FindHandler(list, desc)>=0) {
374 element=list.erase(element);
376 pAgent->DeleteOutputHandler(pHandler);
378 // we are already at the next element
387 int AliHLTOUT::FindHandler(AliHLTOUTHandlerListEntryVector& list, const AliHLTModuleAgent::AliHLTOUTHandlerDesc desc)
389 // see header file for class documentation
390 for (int i=0; i<(int)list.size(); i++) {
391 if (list[i]==desc) return i;
396 int AliHLTOUT::InvalidateBlocks(AliHLTOUTHandlerListEntryVector& list)
398 // see header file for class documentation
399 for (AliHLTOUTHandlerListEntryVector::iterator element=list.begin();
402 element->InvalidateBlocks();
407 const AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::FindHandlerDesc(AliHLTUInt32_t blockIndex)
409 // see header file for class documentation
410 if (blockIndex<fBlockDescList.size()) {
411 return fBlockDescList[blockIndex].GetHandlerDesc();
413 return const_cast<AliHLTOUT::AliHLTOUTHandlerListEntry&>(AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry);
416 AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry()
423 // see header file for class documentation
426 AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(AliHLTOUTHandler* pHandler,
427 AliHLTModuleAgent::AliHLTOUTHandlerDesc& handlerDesc,
428 AliHLTModuleAgent* pAgent,
429 AliHLTUInt32_t index)
432 fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
436 // see header file for class documentation
437 *fpHandlerDesc=handlerDesc;
438 fBlocks.push_back(index);
441 AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(const AliHLTOUTHandlerListEntry& src)
443 fpHandler(src.fpHandler),
444 fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
445 fpAgent(src.fpAgent),
448 // see header file for class documentation
449 *fpHandlerDesc=*src.fpHandlerDesc;
450 fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
453 AliHLTOUT::AliHLTOUTHandlerListEntry::~AliHLTOUTHandlerListEntry()
455 // see header file for class documentation
456 if (fpHandlerDesc) delete fpHandlerDesc;
460 AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::AliHLTOUTHandlerListEntry::operator=(const AliHLTOUTHandlerListEntry& src)
462 // see header file for class documentation
463 fpHandler=src.fpHandler;
464 if (src.fpHandlerDesc)
465 *fpHandlerDesc=*src.fpHandlerDesc;
467 fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
471 AliHLTUInt32_t AliHLTOUT::AliHLTOUTHandlerListEntry::operator[](int i) const
473 // see header file for class documentation
474 return (int)fBlocks.size()>i?fBlocks[i]:AliHLTOUTInvalidIndex;
477 bool AliHLTOUT::AliHLTOUTHandlerListEntry::operator==(const AliHLTOUTHandlerListEntry& entry) const
479 // see header file for class documentation
480 if (entry.fpHandler!=fpHandler || fpHandler==NULL) return false;
481 assert(entry.fpAgent==fpAgent);
482 if (entry.fpAgent!=fpAgent) return false;
486 bool AliHLTOUT::AliHLTOUTHandlerListEntry::operator==(const AliHLTModuleAgent::AliHLTOUTHandlerType handlerType) const
488 // see header file for class documentation
489 if (!fpHandlerDesc) return false;
490 return *fpHandlerDesc==handlerType;
493 bool AliHLTOUT::AliHLTOUTHandlerListEntry::operator==(const AliHLTModuleAgent::AliHLTOUTHandlerDesc desc) const
495 // see header file for class documentation
496 if (!fpHandlerDesc) return false;
497 return *fpHandlerDesc==desc;
500 void AliHLTOUT::AliHLTOUTHandlerListEntry::AddIndex(AliHLTOUT::AliHLTOUTHandlerListEntry &desc)
502 // see header file for class documentation
503 AliHLTOUTIndexList::iterator element;
504 for (element=desc.fBlocks.begin(); element!=desc.fBlocks.end(); element++) {
509 void AliHLTOUT::AliHLTOUTHandlerListEntry::AddIndex(AliHLTUInt32_t index)
511 // see header file for class documentation
512 fBlocks.push_back(index);
515 bool AliHLTOUT::AliHLTOUTHandlerListEntry::HasIndex(AliHLTUInt32_t index) const
517 // see header file for class documentation
518 AliHLTOUTIndexList::iterator element;
519 for (unsigned int i=0; i<fBlocks.size(); i++) {
520 if (fBlocks[i]==index) return true;
525 const AliHLTOUT::AliHLTOUTHandlerListEntry AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry;
527 AliHLTUInt64_t AliHLTOUT::ByteSwap64(AliHLTUInt64_t src)
529 // see header file for class documentation
530 return ((src & 0xFFULL) << 56) |
531 ((src & 0xFF00ULL) << 40) |
532 ((src & 0xFF0000ULL) << 24) |
533 ((src & 0xFF000000ULL) << 8) |
534 ((src & 0xFF00000000ULL) >> 8) |
535 ((src & 0xFF0000000000ULL) >> 24) |
536 ((src & 0xFF000000000000ULL) >> 40) |
537 ((src & 0xFF00000000000000ULL) >> 56);
540 AliHLTUInt32_t AliHLTOUT::ByteSwap32(AliHLTUInt32_t src)
542 // see header file for class documentation
543 return ((src & 0xFFULL) << 24) |
544 ((src & 0xFF00ULL) << 8) |
545 ((src & 0xFF0000ULL) >> 8) |
546 ((src & 0xFF000000ULL) >> 24);
549 AliHLTOUT* AliHLTOUT::New(AliRawReader* pRawReader)
551 // see header file for class documentation
552 AliHLTOUT* instance=New("AliHLTOUTRawReader");
554 instance->SetParam(pRawReader);
559 AliHLTOUT* AliHLTOUT::New(TTree* pDigitTree, int event)
561 // see header file for class documentation
562 AliHLTOUT* instance=New("AliHLTOUTDigitReader");
564 instance->SetParam(pDigitTree, event);
569 AliHLTOUT* AliHLTOUT::New(const char* classname)
571 // see header file for class documentation
573 AliHLTOUT* instance=NULL;
576 ROOT::NewFunc_t pNewFunc=NULL;
578 pCl=TClass::GetClass(classname);
579 } while (!pCl && (iLibResult=gSystem->Load("libHLTRec.so"))==0);
581 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
582 void* p=(*pNewFunc)(NULL);
584 instance=reinterpret_cast<AliHLTOUT*>(p);
586 log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "type cast to AliHLTOUT instance failed");
589 log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not create AliHLTOUT instance from class descriptor");
592 log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not find AliHLTOUT class descriptor");
595 log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not load libHLTrec library");
600 void AliHLTOUT::Delete(AliHLTOUT* pInstance)
602 // see header file for class documentation
603 if (!pInstance) return;
604 if (pInstance==fgGlobalInstance) return;
606 // check if the library is still there in order to have the
607 // destructor available
608 TClass* pCl1=TClass::GetClass("AliHLTOUTRawReader");
609 TClass* pCl2=TClass::GetClass("AliHLTOUTDigitReader");
610 if (!pCl1 && !pCl2) {
612 log.Logging(kHLTLogError, "AliHLTOUT::Delete", "HLTOUT handling", "potential memory leak: libHLTrec library not available, skipping destruction %p", pInstance);
619 void AliHLTOUT::SetParam(AliRawReader* /*pRawReader*/)
621 // see header file for class documentation
622 // default implementation, we should never get here
623 // this function can only be called from the class itsself and
624 // is intended to be used with the New functions. If we get into
625 // the default implementation there is a class mismatch.
627 fLog.LoggingVarargs(kHLTLogFatal, "AliHLTOUT", "SetParam" , __FILE__ , __LINE__ , "severe internal error: class mismatch");
630 void AliHLTOUT::SetParam(TTree* /*pDigitTree*/, int /*event*/)
632 // see header file for class documentation
633 // default implementation, we should never get here
634 // this function can only be called from the class itsself and
635 // is intended to be used with the New functions. If we get into
636 // the default implementation there is a class mismatch.
638 fLog.LoggingVarargs(kHLTLogFatal, "AliHLTOUT", "SetParam" , __FILE__ , __LINE__ , "severe internal error: class mismatch");
641 int AliHLTOUT::SelectDataBlock()
643 // see header file for class documentation
645 if (fCurrent>=fBlockDescList.size()) return 0;
646 fBlockDescList[fCurrent].Select(true);
647 EnableBlockSelection();
651 int AliHLTOUT::SelectDataBlocks(const AliHLTOUTHandlerListEntry* pHandlerDesc)
653 // see header file for class documentation
655 if (!pHandlerDesc) return 0;
657 AliHLTOUTBlockDescriptorVector::iterator element;
658 for (AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
659 block!=fBlockDescList.end();
661 if (block->GetHandlerDesc()==*pHandlerDesc && pHandlerDesc->HasIndex(block->GetIndex()))
664 block->Select(false);
666 EnableBlockSelection();
671 int AliHLTOUT::EnableBlockSelection()
673 // see header file for class documentation
674 SetStatusFlag(kBlockSelection);
678 int AliHLTOUT::DisableBlockSelection()
680 // see header file for class documentation
681 ClearStatusFlag(kBlockSelection);
685 int AliHLTOUT::ResetBlockSelection()
687 // see header file for class documentation
688 for (AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
689 block!=fBlockDescList.end();
691 block->Select(false);
696 int AliHLTOUT::MarkDataBlockProcessed()
698 // see header file for class documentation
700 if (fCurrent>=fBlockDescList.size()) return 0;
701 fBlockDescList[fCurrent].MarkProcessed();
705 int AliHLTOUT::MarkDataBlocksProcessed(const AliHLTOUTHandlerListEntry* pHandlerDesc)
707 // see header file for class documentation
709 if (!pHandlerDesc) return 0;
711 AliHLTOUTBlockDescriptorVector::iterator element;
712 for (AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
713 block!=fBlockDescList.end();
715 if (block->GetHandlerDesc()==*pHandlerDesc && pHandlerDesc->HasIndex(block->GetIndex()))
716 block->MarkProcessed();
722 int AliHLTOUT::AddSubCollection(AliHLTOUT* pCollection)
724 // see header file for class documentation
726 if (!pCollection) return 0;
728 SetStatusFlag(kCollecting);
730 for (index=pCollection->SelectFirstDataBlock();
732 index=pCollection->SelectNextDataBlock()) {
733 AliHLTComponentDataType dt=kAliHLTVoidDataType;
734 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
735 pCollection->GetDataBlockDescription(dt, spec);
736 AliHLTOUTBlockDescriptor desc(dt, spec, index, pCollection);
737 AddBlockDescriptor(desc);
741 if (CheckStatusFlag(kIsSubCollection)) {
742 fLog.LoggingVarargs(kHLTLogWarning, "AliHLTOUT", "AddSubCollection" , __FILE__ , __LINE__ , "HLTOUT object %p has already been added as sub-collection", pCollection);
744 pCollection->SetStatusFlag(kIsSubCollection);
747 ClearStatusFlag(kCollecting);
752 int AliHLTOUT::ReleaseSubCollection(AliHLTOUT* pCollection)
754 // see header file for class documentation
756 if (!pCollection) return 0;
758 AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
759 while (block!=fBlockDescList.end()) {
760 if ((*block)==pCollection) {
761 block=fBlockDescList.erase(block);
766 pCollection->ClearStatusFlag(kIsSubCollection);
771 int AliHLTOUT::Reset()
773 // see header file for class documentation
775 AliHLTOUTPVector subCollections;
776 AliHLTOUTBlockDescriptorVector::iterator block=fBlockDescList.begin();
777 while (block!=fBlockDescList.end()) {
778 if (!((*block)==this)) {
779 AliHLTOUTPVector::iterator collection=subCollections.begin();
780 for (; collection!=subCollections.end(); collection++)
781 if((*block)==*collection) break;
782 if (collection==subCollections.end())
783 subCollections.push_back(block->GetCollection());
785 block=fBlockDescList.erase(block);
788 for (AliHLTOUTPVector::iterator collection=subCollections.begin();
789 collection!=subCollections.end(); collection++) {
790 (*collection)->Reset();
791 (*collection)->ClearStatusFlag(kIsSubCollection);
799 int AliHLTOUT::ResetInput()
801 // default implementation, nothing to do
805 const AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::AliHLTOUTBlockDescriptor::GetHandlerDesc()
807 // see header file for class documentation
809 AliHLTOUTHandlerListEntryVector::iterator element=fpCollection->fDataHandlers.begin();
810 while (element!=fpCollection->fDataHandlers.end()) {
811 if (element->HasIndex(GetIndex())) {
817 return const_cast<AliHLTOUT::AliHLTOUTHandlerListEntry&>(AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry);