From 1edbbe4997c59a153802a666d090fbd03406c967 Mon Sep 17 00:00:00 2001 From: richterm Date: Tue, 8 May 2007 13:48:19 +0000 Subject: [PATCH] bugfix in high level interface: GetFirst/NextObject/Block --- HLT/BASE/AliHLTComponent.cxx | 17 ++++++++++++----- HLT/BASE/AliHLTComponent.h | 6 +++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 06e62b512b1..3113f1fe872 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -452,7 +452,7 @@ const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataTyp fSearchDataType=dt; if (classname) fClassName=classname; else fClassName.clear(); - int idx=FindInputBlock(fSearchDataType, 0); + int idx=FindInputBlock(fSearchDataType, 0, 1); HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str()); TObject* pObj=NULL; if (idx>=0) { @@ -480,7 +480,7 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce) { // see header file for function documentation ALIHLTCOMPONENT_BASE_STOPWATCH(); - int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1); + int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1, 1); //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str()); TObject* pObj=NULL; if (idx>=0) { @@ -491,13 +491,18 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce) return pObj; } -int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx) const +int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx, int bObject) const { // see header file for function documentation int iResult=-ENOENT; if (fpInputBlocks!=NULL) { int idx=startIdx<0?0:startIdx; for ( ; (UInt_t)idxGetName()); } else { } - } else { - // } else if (bForce!=0) { + //} else { + } else if (bForce!=0) { HLTError("size missmatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t)); } } else { @@ -630,6 +635,7 @@ const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLT if (idx>=0) { // check for fpInputBlocks pointer done in FindInputBlock pBlock=&fpInputBlocks[idx]; + fCurrentInputBlock=idx; } return pBlock; } @@ -653,6 +659,7 @@ const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock() if (idx>=0) { // check for fpInputBlocks pointer done in FindInputBlock pBlock=&fpInputBlocks[idx]; + fCurrentInputBlock=idx; } return pBlock; } diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index c4a33945ae7..dbbdd31e773 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -754,13 +754,17 @@ class AliHLTComponent : public AliHLTLogging { /** * Find the first input block of specified data type beginning at index. + * Input blocks containing a TObject have the size of the object as an + * unsigned 32 bit number in the first 4 bytes. This has to match the block + * size minus 4. * @param dt data type * @param startIdx index to start the search + * @param bObject check if this is an object * @return index of the block, -ENOENT if no block found * * @internal */ - int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1) const; + int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1, int bObject=0) const; /** * Get index in the array of input bocks. -- 2.43.0