X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=HLT%2FBASE%2Futil%2FAliHLTBlockFilterComponent.cxx;h=f38102b9f7b732358f5532aafc0e1726e7ca31e1;hp=faf8afbd406c6c07fd2c3bd7bd7c77f00f879cbb;hb=c57201be6d84bd3917f403ef27dff3d1716bcd90;hpb=3bf0e1d7de1bc40fc510422b00b9bb7daa1a24e1 diff --git a/HLT/BASE/util/AliHLTBlockFilterComponent.cxx b/HLT/BASE/util/AliHLTBlockFilterComponent.cxx index faf8afbd406..f38102b9f7b 100644 --- a/HLT/BASE/util/AliHLTBlockFilterComponent.cxx +++ b/HLT/BASE/util/AliHLTBlockFilterComponent.cxx @@ -1,32 +1,26 @@ -// @(#) $Id$ - -/************************************************************************** - * This file is property of and copyright by the ALICE HLT Project * - * ALICE Experiment at CERN, All rights reserved. * - * * - * Primary Authors: Matthias Richter * - * for The ALICE HLT Project. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ +// $Id$ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Matthias Richter * +//* for The ALICE HLT Project. * +//* * +//* Permission to use, copy, modify and distribute this software and its * +//* documentation strictly for non-commercial purposes is hereby granted * +//* without fee, provided that the above copyright notice appears in all * +//* copies and that both the copyright notice and this permission notice * +//* appear in the supporting documentation. The authors make no claims * +//* about the suitability of this software for any purpose. It is * +//* provided "as is" without express or implied warranty. * +//************************************************************************** /** @file AliHLTBlockFilterComponent.cxx @author Matthias Richter @date @brief A simple data block filter and merger, merges block descriptors - - */ -// see header file for class documentation -// or -// refer to README to build package -// or -// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt +*/ #include #include "AliHLTBlockFilterComponent.h" @@ -62,7 +56,7 @@ AliHLTComponentDataType AliHLTBlockFilterComponent::GetOutputDataType() { // see header file for class documentation if (fFilterRules.size()==1) return fFilterRules[0].fDataType; - if (fFilterRules.size()==0) return kAliHLTVoidDataType; + if (fFilterRules.size()==0) return kAliHLTAnyDataType; return kAliHLTMultipleDataType; } @@ -105,7 +99,7 @@ int AliHLTBlockFilterComponent::DoInit( int argc, const char** argv ) if (argument.CompareTo("-datatype")==0) { if ((bMissingParam=(i+2>=argc))) break; - if (rule.fDataType!=kAliHLTAnyDataType) { + if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) { // the data type has already been set, add to list // and reset fFilterRules.push_back(rule); @@ -115,6 +109,34 @@ int AliHLTBlockFilterComponent::DoInit( int argc, const char** argv ) SetDataType(rule.fDataType, argv[i+1], argv[i+2]); i+=2; + // -origin + } else if (argument.CompareTo("-origin")==0) { + if ((bMissingParam=(i+1>=argc))) break; + + if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) { + // the data type has already been set, add to list + // and reset + fFilterRules.push_back(rule); + FillBlockData(rule); + } + + SetDataType(rule.fDataType, NULL, argv[i+1]); + i+=1; + + // -typeid + } else if (argument.CompareTo("-typeid")==0) { + if ((bMissingParam=(i+1>=argc))) break; + + if (!MatchExactly(rule.fDataType,kAliHLTAnyDataType)) { + // the data type has already been set, add to list + // and reset + fFilterRules.push_back(rule); + FillBlockData(rule); + } + + SetDataType(rule.fDataType, argv[i+1], NULL); + i+=1; + // -dataspec } else if (argument.CompareTo("-dataspec")==0) { if ((bMissingParam=(++i>=argc))) break; @@ -140,7 +162,7 @@ int AliHLTBlockFilterComponent::DoInit( int argc, const char** argv ) break; } } - if (iResult>=0 && (rule.fSpecification!=kAliHLTVoidDataSpec || rule.fDataType!=kAliHLTAnyDataType)) { + if (iResult>=0 && (rule.fSpecification!=kAliHLTVoidDataSpec || !MatchExactly(rule.fDataType,kAliHLTAnyDataType))) { // add the pending rule fFilterRules.push_back(rule); FillBlockData(rule); @@ -155,23 +177,25 @@ int AliHLTBlockFilterComponent::DoDeinit() return iResult; } -int AliHLTBlockFilterComponent::DoEvent( const AliHLTComponentEventData& evtData, - const AliHLTComponentBlockData* blocks, +int AliHLTBlockFilterComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, + const AliHLTComponentBlockData* /*blocks*/, AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& size, - AliHLTComponentBlockDataList& outputBlocks ) + AliHLTComponentBlockDataList& /*outputBlocks*/ ) { // see header file for class documentation int iResult=0; - for (int n=0; n<(int)evtData.fBlockCnt; n++ ) { - if (IsSelected(blocks[n])) { - HLTDebug("block %d type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules", - n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification, - blocks[n].fPtr, blocks[n].fOffset, blocks[n].fSize); - outputBlocks.push_back(blocks[n]); + for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(); + pBlock!=NULL; + pBlock=GetNextInputBlock()) { + if (IsSelected(*pBlock)) { + HLTDebug("block type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules", + DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, + pBlock->fPtr, pBlock->fOffset, pBlock->fSize); + Forward(); } else { - HLTDebug("block %d type %s %#x discarded by filter rules", n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification); + HLTDebug("block type %s %#x discarded by filter rules", DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification); } } size=0; @@ -190,9 +214,9 @@ int AliHLTBlockFilterComponent::IsSelected(const AliHLTComponentBlockData& block // 2. data spec match or filter data wpec not set // 3. either filter data type or spec is set //HLTDebug("check rule : %s spec %#x", DataType2Text((*desc).fDataType, 2).c_str(), block.fSpecification); - if (((*desc).fDataType==block.fDataType || (*desc).fDataType==kAliHLTAnyDataType) && + if (((*desc).fDataType==block.fDataType) && ((*desc).fSpecification==block.fSpecification || (*desc).fSpecification==kAliHLTVoidDataSpec) && - ((*desc).fDataType!=kAliHLTAnyDataType || (*desc).fSpecification!=kAliHLTVoidDataSpec)) { + (!MatchExactly((*desc).fDataType,kAliHLTAnyDataType) || (*desc).fSpecification!=kAliHLTVoidDataSpec)) { return 1; } } while (++desc!=fFilterRules.end());