From: timms Date: Wed, 7 Sep 2005 07:03:15 +0000 (+0000) Subject: Added the DataType2Text function to convert a datatype structure into X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=fa2e9b7c96b8c127884f5121774cb00b37eaca9a Added the DataType2Text function to convert a datatype structure into a string representation. Moved the MakeOutputDataBlockList out of the environment structure so that the vector class will not be needed inside 'extern "C"' sections. --- diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index ef5983bcb37..71da40f4ddc 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -64,3 +64,31 @@ int AliHLTComponent::Deinit() iResult=DoDeinit(); return iResult; } + +void AliHLTComponent::DataType2Text( const AliHLTComponent_DataType& type, char output[14] ) { +memset( output, 0, 14 ); +strncat( output, type.fOrigin, 4 ); +strcat( output, ":" ); +strncat( output, type.fID, 8 ); +} + +int AliHLTComponent::MakeOutputDataBlockList( const vector& blocks, AliHLTUInt32_t* blockCount, + AliHLTComponent_BlockData** outputBlocks ) { + if ( !blockCount || !outputBlocks ) + return EFAULT; + AliHLTUInt32_t count = blocks.size(); + if ( !count ) + { + *blockCount = 0; + *outputBlocks = NULL; + return 0; + } + *outputBlocks = reinterpret_cast( AllocMemory( sizeof(AliHLTComponent_BlockData)*count ) ); + if ( !*outputBlocks ) + return ENOMEM; + for ( unsigned long i = 0; i < count; i++ ) + (*outputBlocks)[i] = blocks[i]; + *blockCount = count; + return 0; + +} diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index 62ab2df00f7..e10ca1e3a1e 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -90,11 +90,12 @@ class AliHLTComponent : public AliHLTLogging { } int MakeOutputDataBlockList( const vector& blocks, AliHLTUInt32_t* blockCount, - AliHLTComponent_BlockData** outputBlocks ) { - if (fEnvironment.fMakeOutputDataBlockListFunc) - return (*fEnvironment.fMakeOutputDataBlockListFunc)(fEnvironment.fParam, blocks, blockCount, outputBlocks ); - return -ENOSYS; - } + AliHLTComponent_BlockData** outputBlocks ); +/* { */ +/* if (fEnvironment.fMakeOutputDataBlockListFunc) */ +/* return (*fEnvironment.fMakeOutputDataBlockListFunc)(fEnvironment.fParam, blocks, blockCount, outputBlocks ); */ +/* return -ENOSYS; */ +/* } */ int GetEventDoneData( unsigned long size, AliHLTComponent_EventDoneData** edd ) { if (fEnvironment.fGetEventDoneDataFunc) @@ -103,6 +104,8 @@ class AliHLTComponent : public AliHLTLogging { } + void DataType2Text( const AliHLTComponent_DataType& type, char output[14] ); + private: static AliHLTComponentHandler* fpComponentHandler; AliHLTComponentEnvironment fEnvironment; diff --git a/HLT/BASE/AliHLTComponentHandler.h b/HLT/BASE/AliHLTComponentHandler.h index c853f5520a3..205fba9f1a6 100644 --- a/HLT/BASE/AliHLTComponentHandler.h +++ b/HLT/BASE/AliHLTComponentHandler.h @@ -88,6 +88,7 @@ class AliHLTComponentHandler : public AliHLTLogging { AliHLTComponentEnvironment fEnvironment; ClassDef(AliHLTComponentHandler, 0) + }; #endif diff --git a/HLT/BASE/AliHLTDataTypes.h b/HLT/BASE/AliHLTDataTypes.h index 93249b17c6e..ea2324835ab 100644 --- a/HLT/BASE/AliHLTDataTypes.h +++ b/HLT/BASE/AliHLTDataTypes.h @@ -5,8 +5,8 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -#include -using namespace std; +/* #include */ +/* using namespace std; */ extern "C" { @@ -82,7 +82,7 @@ extern "C" { #if 0 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponent_BlockData* blockLocation ); // future addition already foreseen/envisioned #endif - int (*fMakeOutputDataBlockListFunc)( void* param, const vector& blocks, AliHLTUInt32_t* blockCount, AliHLTComponent_BlockData** outputBlocks ); +/* int (*fMakeOutputDataBlockListFunc)( void* param, const vector& blocks, AliHLTUInt32_t* blockCount, AliHLTComponent_BlockData** outputBlocks ); */ int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponent_EventDoneData** edd ); AliHLTfctLogging fLoggingFunc; };