From: richterm Date: Fri, 5 Jan 2007 14:09:48 +0000 (+0000) Subject: - changes according to coding conventions and documentation X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=2d7ff71057caa5cb41ef394864420f2934cf9c0d;p=u%2Fmrichter%2FAliRoot.git - changes according to coding conventions and documentation - AliHLTTPCDigitReaderRaw: HAVE_TPC_MAPPING dependend implementation fixed in order to make class definition independend - helper functions for data structure handling added - libHLTbase.pkg and libAliHLTSample.pkg included to the stand-alone build system - AliHLTFilePublisher added - target to create the stand-alone sample library package added --- diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 2f1c3fcc7f9..19d94fcf155 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -110,7 +110,7 @@ void* AliHLTComponent::AllocMemory( unsigned long size ) { int AliHLTComponent::MakeOutputDataBlockList( const vector& blocks, AliHLTUInt32_t* blockCount, AliHLTComponentBlockData** outputBlocks ) { if ( !blockCount || !outputBlocks ) - return EFAULT; + return -EFAULT; AliHLTUInt32_t count = blocks.size(); if ( !count ) { @@ -120,7 +120,7 @@ int AliHLTComponent::MakeOutputDataBlockList( const vector( AllocMemory( sizeof(AliHLTComponentBlockData)*count ) ); if ( !*outputBlocks ) - return ENOMEM; + return -ENOMEM; for ( unsigned long i = 0; i < count; i++ ) (*outputBlocks)[i] = blocks[i]; *blockCount = count; @@ -154,3 +154,46 @@ int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, vectorkAliHLTComponentDataTypefIDsize) { + HLTWarning("data type id %s is too long, truncated to %d", id, kAliHLTComponentDataTypefIDsize); + } + strncpy(&tgtdt.fID[0], id, kAliHLTComponentDataTypefIDsize); + + if (strlen(origin)>kAliHLTComponentDataTypefOriginSize) { + HLTWarning("data type origin %s is too long, truncated to %d", origin, kAliHLTComponentDataTypefOriginSize); + } + strncpy(&tgtdt.fOrigin[0], origin, kAliHLTComponentDataTypefOriginSize); +} diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index efe730ee595..71422e6a729 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -23,6 +23,19 @@ #include "AliHLTDefinitions.h" #include "TObject.h" +/* Matthias Dec 2006 + * The names have been changed for Aliroot's coding conventions sake + * The old names are defined for backward compatibility with the + * stand alone SampleLib package + */ +typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity; +typedef AliHLTComponentEventData AliHLTComponent_EventData; +typedef AliHLTComponentShmData AliHLTComponent_ShmData; +typedef AliHLTComponentDataType AliHLTComponent_DataType; +typedef AliHLTComponentBlockData AliHLTComponent_BlockData; +typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData; +typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData; + class AliHLTComponentHandler; /** @@ -90,8 +103,8 @@ class AliHLTComponent : public AliHLTLogging { * @param trigData * @param outputPtr * @param size - * @param outputBlockCnt - * @param outputBlocks + * @param outputBlockCnt out: size of the output block array, set by the component + * @param outputBlocks out: the output block array is allocated internally * @param edd * @return neg. error code if failed */ @@ -178,36 +191,42 @@ class AliHLTComponent : public AliHLTLogging { * Fill AliHLTComponentBlockData structure with default values. * @param blockData reference to data structure */ - void FillBlockData( AliHLTComponentBlockData& blockData ) { - blockData.fStructSize = sizeof(blockData); - FillShmData( blockData.fShmKey ); - blockData.fOffset = ~(AliHLTUInt32_t)0; - blockData.fPtr = NULL; - blockData.fSize = 0; - FillDataType( blockData.fDataType ); - blockData.fSpecification = ~(AliHLTUInt32_t)0; - } + void FillBlockData( AliHLTComponentBlockData& blockData ); /** * Fill AliHLTComponentShmData structure with default values. * @param shmData reference to data structure */ - void FillShmData( AliHLTComponentShmData& shmData ) { - shmData.fStructSize = sizeof(shmData); - shmData.fShmType = gkAliHLTComponentInvalidShmType; - shmData.fShmID = gkAliHLTComponentInvalidShmID; - } + void FillShmData( AliHLTComponentShmData& shmData ); /** * Fill AliHLTComponentDataType structure with default values. * @param dataType reference to data structure */ - void FillDataType( AliHLTComponentDataType& dataType ) { - dataType.fStructSize = sizeof(dataType); - memset( dataType.fID, '*', 8 ); - memset( dataType.fOrigin, '*', 4 ); - } + void FillDataType( AliHLTComponentDataType& dataType ); + /** + * Copy data type structure + * Copies the value an AliHLTComponentDataType structure to another one + * @param[out] tgtdt target structure + * @param[in] srcdt source structure + */ + void CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt); + + /** + * Set the ID and Origin of an AliHLTComponentDataType structure. + * The function sets the fStructureSize member and copies the strings + * to the ID and Origin. Only characters from the valid part of the string + * are copied, the rest is fille with 0's. + * Please note that the fID and fOrigin members are not strings, just arrays of + * chars of size @ref kAliHLTComponentDataTypefIDsize and + * @kAliHLTComponentDataTypefOriginSize respectively and not necessarily with + * a terminating zero. + * @param id ID string + * @param origin Origin string + */ + void SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin); + /** * Default method for the internal initialization. * The method is called by @ref Init diff --git a/HLT/BASE/AliHLTComponentHandler.cxx b/HLT/BASE/AliHLTComponentHandler.cxx index 7f11cf97de0..3f060e2fcc8 100644 --- a/HLT/BASE/AliHLTComponentHandler.cxx +++ b/HLT/BASE/AliHLTComponentHandler.cxx @@ -113,7 +113,7 @@ Int_t AliHLTComponentHandler::ScheduleRegister(AliHLTComponent* pSample) return iResult; } -int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv, int argc, const char** argv, AliHLTComponent*& component ) +int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnvParam, int argc, const char** argv, AliHLTComponent*& component ) { int iResult=0; if (componentID) { @@ -122,7 +122,7 @@ int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv, component=pSample->Spawn(); if (component) { HLTDebug("component \"%s\" created (%p)", componentID, component); - if ((iResult=component->Init(&fEnvironment, pEnv, argc, argv))!=0) { + if ((iResult=component->Init(&fEnvironment, pEnvParam, argc, argv))!=0) { HLTError("Initialization of component \"%s\" failed with error %d", componentID, iResult); delete component; component=NULL; diff --git a/HLT/BASE/AliHLTComponentHandler.h b/HLT/BASE/AliHLTComponentHandler.h index 0124dabb20f..2ba8d1639ea 100644 --- a/HLT/BASE/AliHLTComponentHandler.h +++ b/HLT/BASE/AliHLTComponentHandler.h @@ -108,28 +108,36 @@ class AliHLTComponentHandler : public AliHLTLogging { /** * Create a component of the given name (ID). + * The method tries to find a registerd component of id \em componentID and calls + * the \em Spawn method of the template component. After successful creation of + * a new object, the Init method is called in order to initialize the environment + * and the component arguments.
+ * The environment is the same for all components, but each component can + * have an additional private parameter \em pEnvParam.
+ * The component arguments consist of an array of strings and the array size in the + * usual manner of the main() function. * @param componentID ID of the component to create - * @param pEnv environment for the component + * @param pEnvParam environment parameter for the component * @param argc number of arguments in argv * @param argv argument array like in main() * @param component reference to receive the create component instance * @return component pointer in component, neg. error code if failed */ - int CreateComponent( const char* componentID, void* pEnv, + int CreateComponent( const char* componentID, void* pEnvParam, int argc, const char** argv, AliHLTComponent*& component ); /** * Create a component of the given name (ID). * Introduced for backward compatibility. * @param componentID ID of the component to create - * @param pEnv environment for the component + * @param pEnvParam environment parameter for the component * @param component reference to receive the create component instance * @return component pointer in component, neg. error code if failed */ - int CreateComponent( const char* componentID, void* pEnv, + int CreateComponent( const char* componentID, void* pEnvParam, AliHLTComponent*& component ) { - return CreateComponent( componentID, pEnv, 0, NULL, component ); + return CreateComponent( componentID, pEnvParam, 0, NULL, component ); } /** diff --git a/HLT/BASE/AliHLTConfiguration.cxx b/HLT/BASE/AliHLTConfiguration.cxx index 9fe5c1960b3..07ca303269e 100644 --- a/HLT/BASE/AliHLTConfiguration.cxx +++ b/HLT/BASE/AliHLTConfiguration.cxx @@ -421,7 +421,7 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH) { int iResult=0; if (fpConfiguration!=NULL && fpConfiguration!=pConf) { - HLTWarning("overriding previous reference to configuration object %p (%s) by %p", + HLTWarning("overriding existing reference to configuration object %p (%s) by %p", fpConfiguration, GetName(), pConf); } if (pConf!=NULL) fpConfiguration=pConf; @@ -431,6 +431,8 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH) const char** argv=NULL; if ((iResult=fpConfiguration->GetArguments(&argv))>=0) { argc=iResult; // just to make it clear + // TODO: we have to think about the optional environment parameter, + // currently just set to NULL. iResult=pCH->CreateComponent(fpConfiguration->GetComponentID(), NULL, argc, argv, fpComponent); if (fpComponent) { } else { @@ -450,7 +452,16 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH) int AliHLTTask::Deinit() { - return 0; + int iResult=0; + AliHLTComponent* pComponent=GetComponent(); + fpComponent=NULL; + if (pComponent) { + pComponent->Deinit(); + delete pComponent; + } else { + HLTWarning("task %s (%p) doesn't seem to be in initialized", GetName(), this); + } + return iResult; } const char *AliHLTTask::GetName() const @@ -540,14 +551,6 @@ void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration) } } -/* this function is most likely depricated -int AliHLTTask::InsertBlockData(AliHLTComponentBlockData* pBlock, AliHLTTask* pSource) -{ - int iResult=0; - return iResult; -} -*/ - int AliHLTTask::SetDependency(AliHLTTask* pDep) { int iResult=0; @@ -622,14 +625,6 @@ int AliHLTTask::SetTarget(AliHLTTask* pTgt) return iResult; } -/* this function is most likely depricated -int AliHLTTask::BuildBlockDataArray(AliHLTComponentBlockData*& pBlockData) -{ - int iResult=0; - return iResult; -} -*/ - int AliHLTTask::StartRun() { int iResult=0; @@ -661,9 +656,11 @@ int AliHLTTask::StartRun() } // component init + // the initialization of the component is done by the ComponentHandler after creation + // of the component. //iResult=Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv ); - // allocate internal task varables for bookkeeping aso. + // allocate internal task variables for bookkeeping aso. fpBlockDataArray=new AliHLTComponentBlockData[iNofInputDataBlocks]; if (fpBlockDataArray) { fBlockDataArraySize=iNofInputDataBlocks; @@ -682,13 +679,21 @@ int AliHLTTask::StartRun() int AliHLTTask::EndRun() { int iResult=0; + if (fpBlockDataArray) { + fBlockDataArraySize=0; + delete [] fpBlockDataArray; + fpBlockDataArray=0; + } else { + HLTWarning("task %s (%p) doesn't seem to be in running mode", GetName(), this); + } return iResult; } int AliHLTTask::ProcessTask() { int iResult=0; - if (fpComponent && fpBlockDataArray) { + AliHLTComponent* pComponent=GetComponent(); + if (pComponent && fpBlockDataArray) { int iSourceDataBlock=0; int iInputDataVolume=0; @@ -743,7 +748,7 @@ int AliHLTTask::ProcessTask() if (iResult>=0) { long unsigned int iConstBase=0; double fInputMultiplier=0; - fpComponent->GetOutputDataSize(iConstBase, fInputMultiplier); + pComponent->GetOutputDataSize(iConstBase, fInputMultiplier); int iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase; AliHLTUInt8_t* pTgtBuffer=fpDataBuffer->GetTargetBuffer(iOutputDataSize); AliHLTComponentEventData evtData; @@ -753,7 +758,10 @@ int AliHLTTask::ProcessTask() AliHLTComponentBlockData* outputBlocks=NULL; AliHLTComponentEventDoneData* edd; if (pTgtBuffer!=NULL || iOutputDataSize==0) { - iResult=fpComponent->ProcessEvent(evtData, fpBlockDataArray, trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd); + iResult=pComponent->ProcessEvent(evtData, fpBlockDataArray, trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd); + if (iResult>=0) { + iResult=fpDataBuffer->SetSegments(pTgtBuffer, outputBlocks, outputBlockCnt); + } } else { } } @@ -771,8 +779,8 @@ int AliHLTTask::ProcessTask() HLTError("Task %s (%p): realease of task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iTempRes); } } else { - HLTFatal("fatal internal error in ROOT list handling"); - iResult=-EFAULT; + HLTFatal("internal error in ROOT list handling"); + if (iResult>=0) iResult=-EFAULT; } subscribedTaskList.Remove(lnk); lnk=subscribedTaskList.FirstLink(); @@ -788,7 +796,7 @@ int AliHLTTask::ProcessTask() return iResult; } -int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) +int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const { int iResult=0; if (pConsumerTask) { @@ -804,7 +812,7 @@ int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) return iResult; } -int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) +int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const { int iResult=0; if (pConsumerTask) { @@ -867,8 +875,9 @@ int AliHLTTask::ClearSourceBlocks() void AliHLTTask::PrintStatus() { HLTLogKeyword("task properties"); - if (fpComponent) { - HLTMessage(" component: %s (%p)", fpComponent->GetComponentID(), fpComponent); + AliHLTComponent* pComponent=GetComponent(); + if (pComponent) { + HLTMessage(" component: %s (%p)", pComponent->GetComponentID(), pComponent); } else { HLTMessage(" no component set!"); } diff --git a/HLT/BASE/AliHLTDataBuffer.cxx b/HLT/BASE/AliHLTDataBuffer.cxx index fc1bb5ffbf1..fa557ad7275 100644 --- a/HLT/BASE/AliHLTDataBuffer.cxx +++ b/HLT/BASE/AliHLTDataBuffer.cxx @@ -87,7 +87,7 @@ int AliHLTConsumerDescriptor::CheckActiveDataSegment(AliHLTUInt32_t offset, AliH if (fSegments.size()>0) { vector::iterator segment=fSegments.begin(); while (segment!=fSegments.end()) { - if (iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size)) { + if ((iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size))>0) { break; } segment++; @@ -105,13 +105,13 @@ int AliHLTConsumerDescriptor::ReleaseActiveDataSegment(AliHLTUInt32_t offset, Al if (fSegments.size()>0) { vector::iterator segment=fSegments.begin(); while (segment!=fSegments.end()) { - if (iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size)) { + if ((iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size))>0) { fSegments.erase(segment); break; } segment++; } - if (iResult=0) { + if (iResult==0) { //HLTWarning("no data segment (%d:%d) active for consumer %p", offset, size, this); iResult=-ENOENT; } diff --git a/HLT/BASE/AliHLTDataBuffer.h b/HLT/BASE/AliHLTDataBuffer.h index 90a0ebcc55c..68731de0812 100644 --- a/HLT/BASE/AliHLTDataBuffer.h +++ b/HLT/BASE/AliHLTDataBuffer.h @@ -251,7 +251,7 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging { * This is usually done after the component has written the data to the buffer, * which was requested by the @ref GetTargetBuffer method. The component might * produce different types of data, for each type a segment has to be defined - * which describes the data inside the bauffer.
+ * which describes the data inside the buffer.
* The @ref AliHLTComponentBlockData segment descriptor comes directly from the * @ref AliHLTComponent::ProcessEvent method. * @param pTgt the target buffer which the segments refer to diff --git a/HLT/BASE/AliHLTDataSource.cxx b/HLT/BASE/AliHLTDataSource.cxx index 435206e3c37..80fdab33f64 100644 --- a/HLT/BASE/AliHLTDataSource.cxx +++ b/HLT/BASE/AliHLTDataSource.cxx @@ -37,6 +37,12 @@ AliHLTDataSource::~AliHLTDataSource() { } +void AliHLTDataSource::GetInputDataTypes( vector& list) +{ + list.clear(); // there are no input data types +} + + int AliHLTDataSource::ProcessEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, diff --git a/HLT/BASE/AliHLTDataSource.h b/HLT/BASE/AliHLTDataSource.h index 869183edb2f..54ce3b409c7 100644 --- a/HLT/BASE/AliHLTDataSource.h +++ b/HLT/BASE/AliHLTDataSource.h @@ -23,7 +23,6 @@ * - @ref DoDeinit (optional) * - @ref GetEvent * - @ref GetComponentID - * - @ref GetInputDataTypes * - @ref GetOutputDataType * - @ref GetOutputDataSize * - @ref Spawn @@ -60,6 +59,12 @@ class AliHLTDataSource : public AliHLTComponent { */ TComponentType GetComponentType() { return AliHLTComponent::kSource;} + /** + * Default implementation for all data sources. + * There are no input data types. + */ + void AliHLTDataSource::GetInputDataTypes( vector& list); + private: /** * Data processing method for the component. diff --git a/HLT/BASE/AliHLTDataTypes.h b/HLT/BASE/AliHLTDataTypes.h index a6f331f4db0..32fa980daa3 100644 --- a/HLT/BASE/AliHLTDataTypes.h +++ b/HLT/BASE/AliHLTDataTypes.h @@ -46,12 +46,18 @@ extern "C" { const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0; const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0; + const int kAliHLTComponentDataTypefIDsize=8; + const int kAliHLTComponentDataTypefOriginSize=4; struct AliHLTComponentDataType { AliHLTUInt32_t fStructSize; - char fID[8]; - char fOrigin[4]; + char fID[kAliHLTComponentDataTypefIDsize]; + char fOrigin[kAliHLTComponentDataTypefOriginSize]; }; + +# define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0" +# define kAliHLTVoidDataOrigin "\0\0\0" + const AliHLTComponentDataType kAliHLTVoidDataType = {sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin}; struct AliHLTComponentBlockData { @@ -95,10 +101,10 @@ extern "C" { inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 ) { - for ( unsigned i = 0; i < 8; i++ ) + for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) if ( dt1.fID[i] != dt2.fID[i] ) return false; - for ( unsigned i = 0; i < 4; i++ ) + for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) if ( dt1.fOrigin[i] != dt2.fOrigin[i] ) return false; return true; @@ -106,10 +112,10 @@ inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponen inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 ) { - for ( unsigned i = 0; i < 8; i++ ) + for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) if ( dt1.fID[i] != dt2.fID[i] ) return true; - for ( unsigned i = 0; i < 4; i++ ) + for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) if ( dt1.fOrigin[i] != dt2.fOrigin[i] ) return true; return false; diff --git a/HLT/BASE/AliHLTFilePublisher.cxx b/HLT/BASE/AliHLTFilePublisher.cxx new file mode 100644 index 00000000000..1754c75c3bd --- /dev/null +++ b/HLT/BASE/AliHLTFilePublisher.cxx @@ -0,0 +1,237 @@ +// $Id$ + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Authors: Matthias Richter * + * for The ALICE Off-line 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 AliHLTFilePublisher.cxx + @author Matthias Richter + @date + @brief HLT file publisher component implementation. */ + +#if __GNUC__>= 3 +using namespace std; +#endif + +#include "AliHLTFilePublisher.h" +#include +#include +#include + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTFilePublisher) + +AliHLTFilePublisher::AliHLTFilePublisher() + : + fFileNames(), + fFiles(), + fpCurrent(NULL), + fDataType(kAliHLTVoidDataType), + fSpecification(~(AliHLTUInt32_t)0), + fMaxSize(0) +{ + // make the lists owners of their objects in order to automatically + // de-allocate the objects + fFileNames.SetOwner(); + fFiles.SetOwner(); +} + +AliHLTFilePublisher::AliHLTFilePublisher(const AliHLTFilePublisher&) + : + fFileNames(), + fFiles(), + fpCurrent(NULL), + fDataType(kAliHLTVoidDataType), + fSpecification(0), + fMaxSize(0) +{ + HLTFatal("copy constructor untested"); +} + +AliHLTFilePublisher& AliHLTFilePublisher::operator=(const AliHLTFilePublisher&) +{ + HLTFatal("assignment operator untested"); + return *this; +} + +AliHLTFilePublisher::~AliHLTFilePublisher() +{ + // file list and file name list are owner of their objects and + // delete all the objects +} + +const char* AliHLTFilePublisher::GetComponentID() +{ + return "FilePublisher"; +} + +void AliHLTFilePublisher::GetInputDataTypes( vector& list) +{ + list.clear(); +} + +AliHLTComponentDataType AliHLTFilePublisher::GetOutputDataType() +{ + return (AliHLTComponentDataType){ sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin}; +} + +void AliHLTFilePublisher::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) +{ + constBase=fMaxSize; + inputMultiplier=1.0; +} + +AliHLTComponent* AliHLTFilePublisher::Spawn() +{ + return new AliHLTFilePublisher; +} + +int AliHLTFilePublisher::DoInit( int argc, const char** argv ) +{ + int iResult=0; + TString argument=""; + int bMissingParam=0; + for (int i; i=argc))) break; + TObjString* parameter=new TObjString(argv[i]); + if (parameter) { + fFileNames.Add(parameter); + } else { + iResult=-ENOMEM; + } + + // -datafilelist + } else if (argument.CompareTo("-datafilelist")==0) { + if ((bMissingParam=(++i>=argc))) break; + HLTWarning("-datafilelist option not yet implemented"); + + // -datatype + } else if (argument.CompareTo("-datatype")==0) { + if ((bMissingParam=(++i>=argc))) break; + memcpy(&fDataType.fID, argv[i], TMath::Min(kAliHLTComponentDataTypefIDsize, (Int_t)strlen(argv[i]))); + + // -dataspec + } else if (argument.CompareTo("-dataspec")==0) { + if ((bMissingParam=(++i>=argc))) break; + TString parameter(argv[i]); + if (parameter.IsDigit()) { + fSpecification=(AliHLTUInt32_t)parameter.Atoi(); + } else { + HLTError("wrong parameter for argument %s, number expected", argument.Data()); + iResult=-EINVAL; + } + // -dataorigin + } else if (argument.CompareTo("-dataorigin")==0) { + if ((bMissingParam=(++i>=argc))) break; + memcpy(&fDataType.fOrigin, argv[i], TMath::Min(kAliHLTComponentDataTypefOriginSize,(Int_t)strlen(argv[i]))); + } else { + HLTError("unknown argument %s", argument.Data()); + iResult=-EINVAL; + } + } + if (bMissingParam) { + HLTError("missing parameter for argument %s", argument.Data()); + iResult=-EINVAL; + } + if (fFileNames.GetSize()==0) { + HLTError("the publisher needs at least one file argument"); + iResult=-EINVAL; + } + if (iResult>=0) iResult=OpenFiles(); + if (iResult<0) { + fFileNames.Clear(); + } + return iResult; +} + +int AliHLTFilePublisher::OpenFiles() +{ + int iResult=0; + TObjLink *lnk=fFileNames.FirstLink(); + while (lnk && iResult>=0) { + TObjString* pFileName=(TObjString*)lnk->GetObject(); + if (pFileName) { + TString fullFN= pFileName->GetString() + "?filetype=raw"; + TFile* pFile = new TFile(fullFN); + if (pFile) { + if (pFile->IsZombie()==0) { + fFiles.Add(pFile); + if (pFile->GetSize()>fMaxSize) fMaxSize=pFile->GetSize(); + } else { + HLTError("can not open file %s", (pFileName->GetString()).Data()); + fFiles.Clear(); + iResult=-ENOENT; + } + } + } + lnk = lnk->Next(); + } + + return iResult; +} + +int AliHLTFilePublisher::DoDeinit() +{ + int iResult=0; + fFileNames.Clear(); + fFiles.Clear(); + return iResult; +} + +int AliHLTFilePublisher::GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ) +{ + int iResult=0; + TFile * pFile=NULL; + TObjLink *lnk; + if (fpCurrent) lnk=fpCurrent->Next(); + if (lnk==NULL) lnk=fFiles.FirstLink(); + fpCurrent=lnk; + if (lnk) { + TFile* pFile=(TFile*)lnk->GetObject(); + if (pFile) { + int iCopy=pFile->GetSize(); + if (iCopy>size) { + iCopy=size; + HLTWarning("buffer to small, data of file %s truncated", pFile->GetName()); + } + if (pFile->ReadBuffer((char*)outputPtr, iCopy)!=0) { + // ReadBuffer returns 1 in case of failure and 0 in case of success + iResult=-EIO; + } else { + AliHLTComponentBlockData bd; + FillBlockData(bd); + bd.fPtr=outputPtr; + bd.fOffset=0; + bd.fSize=iCopy; + bd.fDataType=fDataType; + bd.fSpecification=fSpecification; + outputBlocks.push_back(bd); + size=iCopy; + } + } else { + iResult=-EFAULT; + } + } else { + iResult=-ENOENT; + } + return iResult; +} diff --git a/HLT/BASE/AliHLTFilePublisher.h b/HLT/BASE/AliHLTFilePublisher.h new file mode 100644 index 00000000000..b45d14ddeed --- /dev/null +++ b/HLT/BASE/AliHLTFilePublisher.h @@ -0,0 +1,97 @@ +// @(#) $Id$ + +#ifndef ALIHLTFILEPUBLISHER_H +#define ALIHLTFILEPUBLISHER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliHLTFilePublisher.h + @author Matthias Richter + @date + @brief An HLT file publishing (data source) component. + @note The class is used in Offline (AliRoot) context +*/ + +#include "AliHLTDataSource.h" +#include + +/** + * @class AliHLTFilePublisher + * An HLT data source component which publishes data from one or a sequence + * of files.
+ * Mandatory arguments:
+ * + * \li -datafile filename + * \li -datafilelist file pattern + * \li -datatype data type + * \li -dataspec specification + * \li -dataorigin origin + * + * Optional arguments:
+ * + * The component needs at least one argument \em -datafile or \em -datafilelist. + * Both can occur multiple times. + * @ingroup alihlt_component + */ +class AliHLTFilePublisher : public AliHLTDataSource { + public: + /** standard constructor */ + AliHLTFilePublisher(); + /** not a valid copy constructor, defined according to effective C++ style */ + AliHLTFilePublisher(const AliHLTFilePublisher&); + /** not a valid assignment op, but defined according to effective C++ style */ + AliHLTFilePublisher& operator=(const AliHLTFilePublisher&); + /** destructor */ + virtual ~AliHLTFilePublisher(); + + const char* GetComponentID(); + void GetInputDataTypes( vector& list); + AliHLTComponentDataType GetOutputDataType(); + void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); + + /** + * Open all files. + * Opens all files from the file name list @ref fFileNames and adds TFile + * opjects to the TFiles list. + */ + int OpenFiles(); + + protected: + /** + * Init method. + */ + int DoInit( int argc, const char** argv ); + + /** + * Deinit method. + */ + int DoDeinit(); + + /** + * Data processing method for the component. + * @param evtData event data structure + * @param trigData trigger data structure + * @param outputPtr pointer to target buffer + * @param size input: size of target buffer + * output:size of produced data + * @param outputBlocks list to receive output block descriptors + * @return + */ + int GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ); + + private: + TList fFileNames; + TList fFiles; + TObjLink* fpCurrent; //! transient value + AliHLTComponentDataType fDataType; + AliHLTUInt32_t fSpecification; + Int_t fMaxSize; + + ClassDef(AliHLTFilePublisher, 0) +}; +#endif diff --git a/HLT/BASE/AliHLTSystem.cxx b/HLT/BASE/AliHLTSystem.cxx index f140e0d2958..23567ba2fa4 100644 --- a/HLT/BASE/AliHLTSystem.cxx +++ b/HLT/BASE/AliHLTSystem.cxx @@ -32,6 +32,7 @@ using namespace std; #include "AliHLTConfiguration.h" #include "AliHLTConfigurationHandler.h" #include "AliHLTTask.h" +#include "TString.h" /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTSystem) @@ -78,16 +79,17 @@ AliHLTSystem& AliHLTSystem::operator=(const AliHLTSystem&) AliHLTSystem::~AliHLTSystem() { - AliHLTConfiguration::GlobalDeinit(); - if (fpConfigurationHandler) { - delete fpConfigurationHandler; - } - fpConfigurationHandler=NULL; - - if (fpComponentHandler) { - delete fpComponentHandler; - } - fpComponentHandler=NULL; + CleanTaskList(); + AliHLTConfiguration::GlobalDeinit(); + if (fpConfigurationHandler) { + delete fpConfigurationHandler; + } + fpConfigurationHandler=NULL; + + if (fpComponentHandler) { + delete fpComponentHandler; + } + fpComponentHandler=NULL; } int AliHLTSystem::AddConfiguration(AliHLTConfiguration* pConf) @@ -260,12 +262,38 @@ void AliHLTSystem::PrintTaskList() } } +void AliHLTSystem::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt) { + TString msg; + msg.Form("AliHLTComponentDataType(%d): ID=\"", dt.fStructSize); + for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) { + if (dt.fID[i]!=0) msg+=dt.fID[i]; + else msg+="\\0"; + } + msg+="\" Origin=\""; + for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) { + if (dt.fOrigin[i]!=0) msg+=dt.fOrigin[i]; + else msg+="\\0"; + } + msg+="\""; + HLTMessage(msg.Data()); +} + int AliHLTSystem::Run(Int_t iNofEvents) { int iResult=0; if ((iResult=StartTasks())>=0) { for (int i=0; i=0; i++) { iResult=ProcessTasks(i); + if (iResult>=0) { + HLTInfo("Event %d successfully finished (%d)", i, iResult); + iResult=0; + } else { + HLTError("Processing of event %d failed (%d)", i, iResult); + // TODO: define different running modes to either ignore errors in + // event processing or not + // currently ignored + iResult=0; + } } StopTasks(); } else { diff --git a/HLT/BASE/AliHLTSystem.h b/HLT/BASE/AliHLTSystem.h index 77b2283bd80..c48cb6e96a7 100644 --- a/HLT/BASE/AliHLTSystem.h +++ b/HLT/BASE/AliHLTSystem.h @@ -114,6 +114,11 @@ class AliHLTSystem : public AliHLTLogging { */ void PrintTaskList(); + /** + * Print info on an AliHLTComponentDataType structure + */ + void PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt); + /** * Run the task list. * All tasks of the list will be subsequently processed for each event. diff --git a/HLT/BASE/AliHLTTask.h b/HLT/BASE/AliHLTTask.h index e014888492e..fbb1f77b30b 100644 --- a/HLT/BASE/AliHLTTask.h +++ b/HLT/BASE/AliHLTTask.h @@ -61,7 +61,8 @@ class AliHLTTask : public TObject, public AliHLTLogging { /** * Initialize the task. * The task is initialized with a configuration descriptor. It needs a - * component handler instance to create the analysis component. + * component handler instance to create the analysis component. The + * component is created and initialized. * @param pConf pointer to configuration descriptor, can be NULL if it * was already provided to the constructor * @param pCH the HLT component handler @@ -70,7 +71,8 @@ class AliHLTTask : public TObject, public AliHLTLogging { /** * De-Initialize the task. - * Final cleanup after the run. The analysis component is deleted. + * Final cleanup after the run. The @ref AliHLTComponent::Deinit method of + * the component is called. The analysis component is deleted. */ int Deinit(); @@ -105,18 +107,6 @@ class AliHLTTask : public TObject, public AliHLTLogging { */ AliHLTTask* FindDependency(const char* id); - /* - * insert block data to the list - * the data has to come from a task the current one depends on - * result: - * -EEXIST : the block data from this task has already been inserted - * -ENOENT : no dependencies to the task the data is coming from - */ - /* - * this function is most likely depricated - int InsertBlockData(AliHLTComponentBlockData* pBlock, AliHLTTask* pSource); - */ - /** * Add a dependency for the task. * The task maintains a list of other tasks it depends on. @@ -160,27 +150,18 @@ class AliHLTTask : public TObject, public AliHLTLogging { */ int SetTarget(AliHLTTask* pDep); - // build a monolithic array of block data - // @param pBlockData reference to the block data target - // @return: array size, pointer to array in the target pTgt - // - /* this function is most likely depricated - int BuildBlockDataArray(AliHLTComponentBlockData*& pBlockData); - */ - /** * Prepare the task for event processing. * The method initializes the Data Buffer and calls the * @ref AliHLTComponent::Init method of the component.
- * The @ref ProcessTask methode can be called an arbitrary number of times + * The @ref ProcessTask method can be called an arbitrary number of times * as soon as the task is in running mode. */ int StartRun(); /** * Clean-up the task after event processing. - * The method cleans up internal structures and calls the - * @ref AliHLTComponent::Deinit method of the component. + * The method cleans up internal structures. */ int EndRun(); @@ -209,7 +190,7 @@ class AliHLTTask : public TObject, public AliHLTLogging { * @param pConsumerTask the task which subscribes to the data * @return number of matching data blocks */ - int GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask); + int GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const; /** * Determine the number of matching data types between the component and a @@ -218,7 +199,7 @@ class AliHLTTask : public TObject, public AliHLTLogging { * @param pConsumerTask the task which subscribes to the data * @return number of matching data types */ - int GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask); + int GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const; /** * Subscribe to the data of a source task. @@ -276,7 +257,7 @@ class AliHLTTask : public TObject, public AliHLTLogging { * Get number of source tasks. * @return number of source tasks */ - int GetNofSources() {return fListDependencies.GetSize();} + int GetNofSources() const {return fListDependencies.GetSize();} private: /** the configuration descriptor (external pointer) */ diff --git a/HLT/BASE/AliHLT_C_Component_WrapperInterface.h b/HLT/BASE/AliHLT_C_Component_WrapperInterface.h index cd388be234a..cc8dbd89164 100644 --- a/HLT/BASE/AliHLT_C_Component_WrapperInterface.h +++ b/HLT/BASE/AliHLT_C_Component_WrapperInterface.h @@ -23,6 +23,11 @@ */ #include +/* Matthias Dec 2006 + * The names have been changed for Aliroot's coding conventions sake + * The old names are defined for backward compatibility with the + * PublisherSubscriber framework + */ typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity; typedef AliHLTComponentEventData AliHLTComponent_EventData; typedef AliHLTComponentShmData AliHLTComponent_ShmData; diff --git a/HLT/BASE/Makefile.am b/HLT/BASE/Makefile.am index 8f9fe1f40d2..d4a186c4f6f 100644 --- a/HLT/BASE/Makefile.am +++ b/HLT/BASE/Makefile.am @@ -1,6 +1,11 @@ # $Id$ # Makefile template for the Alice HLT framework +# be aware of the two different meanings of 'MODULE' +# 1. AliRoot classifies each detector and main sub-package as a module +# so for all HLT library packages MODULE is equal HLT +# 2. The HLT stand-alone build system knows about sub-modules +# e.g. for libHLTbase, MODULE=HLTbase MODULE = HLTbase AM_CPPFLAGS = -DMODULE=$(MODULE) @@ -10,48 +15,24 @@ bin_SCRIPTS = setenv.sh setenv.csh # library definition lib_LTLIBRARIES = libHLTbase.la +# version info for the library +LIBRARY_VERSION = '1:1:0' + +# MODDIR is set by the AliRoot build system and denotes the topdir +# of the module, we must set it since the package definition libHLTbase.pkg +# includes another common configuration file MODDIR = $(top_srcdir) PKGDEF = $(MODDIR)/libHLTbase.pkg -#include $(top_srcdir)/libHLTbase.pkg +include $(top_srcdir)/libHLTbase.pkg # library sources -# temporary until lib*.pkg file is commited to AliRoot -#libHLTbase_la_SOURCES = $(MODULE_SRCS) -libHLTbase_la_SOURCES = AliHLTComponent.cxx \ - AliHLTComponentHandler.cxx \ - AliHLTSystem.cxx \ - AliHLT_C_Component_WrapperInterface.cxx \ - AliHLTProcessor.cxx \ - AliHLTConfiguration.cxx \ - AliHLTLogging.cxx \ - AliHLTDataBuffer.cxx \ - AliHLTDataSource.cxx \ - AliHLTDataSink.cxx +libHLTbase_la_SOURCES = $(MODULE_SRCS) -# class header files, the link definition for the root dictionary -# will be created from the names of the header files -CLASS_HDRS = AliHLTComponent.h \ - AliHLTComponentHandler.h \ - AliHLTSystem.h \ - AliHLTProcessor.h \ - AliHLTConfiguration.h \ - AliHLTConfigurationHandler.h \ - AliHLTTask.h \ - AliHLTLogging.h \ - AliHLTDataBuffer.h \ - AliHLTDataSource.h \ - AliHLTDataSink.h +# library headers +pkginclude_HEADERS = $(MODULE_HDRS) -# temporary until lib*.pkg file is commited to AliRoot -#pkginclude_HEADERS = $(MODULE_HDRS) -pkginclude_HEADERS = $(CLASS_HDRS) \ - AliHLTDataTypes.h \ - AliHLT_C_Component_WrapperInterface.h \ - AliHLTDefinitions.h \ - AliHLTStdIncludes.h - -# version info for the library -libHLTbase_la_LDFLAGS = -version-info 1:1:0 +# linker flags +libHLTbase_la_LDFLAGS = -version-info $(LIBRARY_VERSION) # automatic generation of data and time of library build COMPILE_INFO = HLTBaseCompileInfo.cxx @@ -71,4 +52,3 @@ $(COMPILE_INFO): $(libHLTbase_la_SOURCES) $(pkginclude_HEADERS) $(noinst_HEADERS @echo '//add changes in Makefile.am' >> $@ @echo 'void $(MODULE)CompileInfo( char*& date, char*& time)' >> $@ @echo '{date=__DATE__; time=__TIME__; return;}' >> $@ - diff --git a/HLT/ChangeLog b/HLT/ChangeLog index 2288491dc61..04076d26c75 100644 --- a/HLT/ChangeLog +++ b/HLT/ChangeLog @@ -1,3 +1,12 @@ +2007-01-05 + - changes according to coding conventions and documentation + - AliHLTTPCDigitReaderRaw: HAVE_TPC_MAPPING dependend implementation + fixed in order to make class definition independend + - helper functions for data structure handling added + - libHLTbase.pkg and libAliHLTSample.pkg included to the stand-alone + build system + - AliHLTFilePublisher added + - target to create the stand-alone sample library package added 2006-12-28 changes according to coding conventions - special characters in function names have been removed in the internal usage, the C interface still uses them in order to preserve diff --git a/HLT/Makefile.am b/HLT/Makefile.am index ec77a090f78..f668da6545e 100644 --- a/HLT/Makefile.am +++ b/HLT/Makefile.am @@ -20,8 +20,32 @@ SUBDIRS = BASE \ $(PHOS_DIR) \ doc +EXTRA_DIST = libHLTbase.pkg \ + libAliHLTSample.pkg \ + hlt.conf + DIST_SUBDIRS = $(SUBDIRS) +SampleLibPkg: Makefile $(top_srcdir)/SampleLib/* + @tmpdir=/tmp/$(USER)/$@ ; \ + if test -d $@ ; then \ + cp -ruv $(top_srcdir)/SampleLib/* $@; \ + cp -uv $(top_srcdir)/libAliHLTSample.pkg $@; \ + cp -uv $(top_srcdir)/acinclude.m4 $@; \ + else \ + (test ! -d $$tmpdir || rm $$tmpdir); \ + echo "creating package in tmp dir $$tmpdir" ; \ + mkdir -p $$tmpdir && \ + (cp -r $(top_srcdir)/SampleLib/* $$tmpdir ; \ + cp -uv $(top_srcdir)/libAliHLTSample.pkg $$tmpdir ; \ + cp -uv $(top_srcdir)/acinclude.m4 $$tmpdir; \ + (echo 'running autoreconf -f -i' ;cd $$tmpdir ; autoreconf -f -i) ; \ + echo moving $$tmpdir to `pwd`; mv $$tmpdir . ) \ + fi + +clean-local: + (test ! -d SampleLibPkg || rm -rf SampleLibPkg) + # # EOF # diff --git a/HLT/SampleLib/AliHLTDummyComponent.cxx b/HLT/SampleLib/AliHLTDummyComponent.cxx index 2b1c5c364a2..8427789cf24 100644 --- a/HLT/SampleLib/AliHLTDummyComponent.cxx +++ b/HLT/SampleLib/AliHLTDummyComponent.cxx @@ -25,6 +25,7 @@ using namespace std; #endif +#include "AliHLTSystem.h" #include "AliHLTDummyComponent.h" #include #include @@ -35,8 +36,9 @@ AliHLTDummyComponent gAliHLTDummyComponent; ClassImp(AliHLTDummyComponent) AliHLTDummyComponent::AliHLTDummyComponent() + : + fOutputPercentage(100) // By default we copy to the output exactly what we got as input { - fOutputPercentage = 100; // By default we copy to the output exactly what we got as input } AliHLTDummyComponent::~AliHLTDummyComponent() @@ -55,7 +57,10 @@ void AliHLTDummyComponent::GetInputDataTypes( vector& l AliHLTComponentDataType AliHLTDummyComponent::GetOutputDataType() { - return (AliHLTComponentDataType){ sizeof(AliHLTComponentDataType), {'D','U','M','M','Y',' ',' ',' '},{'D','U','M','Y'}}; + AliHLTComponentDataType dt; + SetDataType(dt, "DUMMY", "DUMY"); + cout << "SetDataType: size " << dt.fStructSize << endl; + return dt; } void AliHLTDummyComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) @@ -70,7 +75,7 @@ void AliHLTDummyComponent::GetOutputDataSize( unsigned long& constBase, double& AliHLTComponent* AliHLTDummyComponent::Spawn() { return new AliHLTDummyComponent; - }; + } int AliHLTDummyComponent::DoInit( int argc, const char** argv ) { diff --git a/HLT/SampleLib/AliHLTSampleComponent1.cxx b/HLT/SampleLib/AliHLTSampleComponent1.cxx index 0f6fb7e4bee..104208f0f0a 100644 --- a/HLT/SampleLib/AliHLTSampleComponent1.cxx +++ b/HLT/SampleLib/AliHLTSampleComponent1.cxx @@ -35,8 +35,9 @@ AliHLTSampleComponent1 gAliHLTSampleComponent1; ClassImp(AliHLTSampleComponent1) -const AliHLTComponentDataType AliHLTSampleComponent1::inputDataTypes[]={{0,0}, {0,0}}; //'zero' terminated array -const AliHLTComponentDataType AliHLTSampleComponent1::outputDataType={0,0}; +const AliHLTComponentDataType AliHLTSampleComponent1::inputDataTypes[]={kAliHLTVoidDataType, + {0,"",""}}; //'zero' terminated array +const AliHLTComponentDataType AliHLTSampleComponent1::outputDataType=kAliHLTVoidDataType; AliHLTSampleComponent1::AliHLTSampleComponent1() { diff --git a/HLT/SampleLib/AliHLTSampleComponent2.cxx b/HLT/SampleLib/AliHLTSampleComponent2.cxx index 5ae9f214ea6..4f062868a21 100644 --- a/HLT/SampleLib/AliHLTSampleComponent2.cxx +++ b/HLT/SampleLib/AliHLTSampleComponent2.cxx @@ -35,8 +35,9 @@ AliHLTSampleComponent2 gAliHLTSampleComponent2; ClassImp(AliHLTSampleComponent2) -const AliHLTComponentDataType AliHLTSampleComponent2::inputDataTypes[]={{0,0}, {0,0}}; //'zero' terminated array -const AliHLTComponentDataType AliHLTSampleComponent2::outputDataType={0,0}; +const AliHLTComponentDataType AliHLTSampleComponent2::inputDataTypes[]={kAliHLTVoidDataType, + {0,"",""}}; //'zero' terminated array +const AliHLTComponentDataType AliHLTSampleComponent2::outputDataType=kAliHLTVoidDataType; AliHLTSampleComponent2::AliHLTSampleComponent2() { diff --git a/HLT/SampleLib/Makefile.am b/HLT/SampleLib/Makefile.am index dafc03ea545..457103b5899 100644 --- a/HLT/SampleLib/Makefile.am +++ b/HLT/SampleLib/Makefile.am @@ -8,11 +8,14 @@ MODULE = AliHLTSample -#EXTRA_DIST = libAliHLTSample.pkg +EXTRA_DIST = +if STANDALONE_SAMPLELIB +EXTRA_DIST += libAliHLTSample.pkg +endif # include the pkg definition which actually contains the source # file definitions -#include libAliHLTSample.pkg +include $(top_srcdir)/libAliHLTSample.pkg # library definition # The lib_LTLIBRARIES variable is a fixed variable of the autotools build @@ -45,22 +48,11 @@ LIBRARY_VERSION = '1:0:0' # library sources # The source files are specified in libAliHLTSample.pkg -#libAliHLTSample_la_SOURCES = $(MODULE_SRCS) -# temporary until lib*.pkg file is commited to AliRoot -libAliHLTSample_la_SOURCES= AliHLTSampleComponent1.cxx \ - AliHLTSampleComponent2.cxx \ - AliHLTDummyComponent.cxx - -# temporary until lib*.pkg file is commited to AliRoot -CLASS_HDRS= AliHLTSampleComponent1.h \ - AliHLTSampleComponent2.h \ - AliHLTDummyComponent.h +libAliHLTSample_la_SOURCES = $(MODULE_SRCS) # library headers # The header files are specified in libAliHLTSample.pkg -#noinst_HEADERS = $(MODULE_HDRS) -# temporary until lib*.pkg file is commited to AliRoot -noinst_HEADERS= $(CLASS_HDRS) +noinst_HEADERS = $(MODULE_HDRS) # compilation flags of the library # This is the place to add further include directories if you are diff --git a/HLT/SampleLib/README b/HLT/SampleLib/README index df000ecf529..0c8362ecf1d 100644 --- a/HLT/SampleLib/README +++ b/HLT/SampleLib/README @@ -34,11 +34,11 @@ as 'topdir' from now on. 3. Copy the SampleLib folder as new 'Test' folder > cp -a SampleLib Test -4. Change dir to the new folder -> cd Test +4. Copy libAliHLTSample.pkg to libAliHLTTest.pkg +> cp libAliHLTSample.pkg libAliHLTTest.pkg -5. Rename libAliHLTSample.pkg to libAliHLTTest.pkg -> mv libAliHLTSample.pkg libAliHLTTest.pkg +5. Change dir to the new folder +> cd Test 6. Open 'Makefile.am' with an editor This is the Makefile template for the autotools build system. In particular @@ -64,7 +64,8 @@ as 'topdir' from now on. http://www.kip.uni-heidelberg.de/wiki/HLT 8. Once you are finnished with the first code development, you have to add - the new component files to the build system. Open 'libAliHLTTest.pkg' + the new component files to the build system. Open 'libAliHLTTest.pkg' in + the package topdir 8.1. Add all your source files to the SRCS variable, remove the files from the libAliHLTSample 8.2. Add all header files of classes which should be added to the ROOT @@ -113,6 +114,11 @@ of the AliRoot compilation. 2. Requirements =============== +At this point you should have downloaded and unpacked a package with name +alice-hlt-sample.tar.gz. If not, please download it from +http://www.kip.uni-heidelberg.de/ti/HLT/software/download/alice-hlt-sample.tar.gz +The following description refers to that package. + The package needs both ROOT and AliRoot. Both must be set up in the usual way (ROOTSYS, ALICE_ROOT, library locations evtl. specified in LD_LIBRARY_PATH, ...). The package also needs the ALICE HLT component @@ -155,7 +161,8 @@ section. =============== Package build relies on the GNU triplet configure, make and make install. In order to keep the development directory clean, it is recommended to -use a separate build directory. +use a separate build directory. Please read the full section before you +start. The build is in priciple done like mkdir build cd build @@ -196,9 +203,13 @@ Each of the components has aheader file '.h' and a source code file '.cxx Leave your build directory and go back to the top directory where you can find -the source code as well as the Makefile template Makefile.am. Choose a new -name of your library (the tutorial uses AliHLTTest) and follow the instructions -5 to 8 of Part A (embedded case). +the source code as well as the Makefile template Makefile.am. +1. Choose a new name of your library (the tutorial uses AliHLTTest) + +2. Copy libAliHLTSample.pkg to libAliHLTTest.pkg +> cp libAliHLTSample.pkg libAliHLTTest.pkg + +3. follow the instructions 6 to 8 of Part A (embedded case). When you are done with this, you can build the library by typing 'make' in your build directory, and install it by make install. diff --git a/HLT/SampleLib/acinclude.m4 b/HLT/SampleLib/acinclude.m4 deleted file mode 100644 index 2aaa56ea912..00000000000 --- a/HLT/SampleLib/acinclude.m4 +++ /dev/null @@ -1,176 +0,0 @@ -dnl -dnl $Id$ -dnl -dnl Copyright (C) 2002 Christian Holm Christensen -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public License -dnl as published by the Free Software Foundation; either version 2.1 -dnl of the License, or (at your option) any later version. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library; if not, write to the Free -dnl Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -dnl 02111-1307 USA -dnl -dnl ------------------------------------------------------------------ -AC_DEFUN([AC_DEBUG], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_PROG_CXX]) - AC_MSG_CHECKING(whether to make debug objects) - AC_ARG_ENABLE(debug, - [AC_HELP_STRING([--enable-debug],[Enable debugging symbols in objects])], - [],[enable_debug=yes]) - if test "x$enable_debug" = "xno" ; then - CFLAGS=`echo $CFLAGS | sed 's,-g,,'` - CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'` - else - AC_DEFINE(__DEBUG) - case $CXXFLAGS in - *-g*) ;; - *) CXXFLAGS="$CXXFLAGS -g" ;; - esac - case $CFLAGS in - *-g*) ;; - *) CFLAGS="$CFLAGS -g" ;; - esac - fi - AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS') -]) - -dnl ------------------------------------------------------------------ -AC_DEFUN([AC_OPTIMIZATION], -[ - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_PROG_CXX]) - - AC_ARG_ENABLE(optimization, - [AC_HELP_STRING([--enable-optimization],[Enable optimization of objects])], - [],[enable_optimization=yes]) - - AC_MSG_CHECKING(for optimiztion level) - - changequote(<<, >>)dnl - if test "x$enable_optimization" = "xno" ; then - CFLAGS=`echo $CFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'` - CXXFLAGS=`echo $CXXFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'` - elif test "x$enable_optimization" = "xyes" ; then - case $CXXFLAGS in - *-O*) ;; - *) CXXFLAGS="$CXXFLAGS -O2" ;; - esac - case $CFLAGS in - *-O*) ;; - *) CFLAGS="$CXXFLAGS -O2" ;; - esac - else - CFLAGS=`echo $CFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"` - CXXFLAGS=`echo $CXXFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"` - fi - changequote([, ])dnl - AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS') -]) - -dnl ------------------------------------------------------------------ - -dnl -dnl Autoconf macro to check for existence or ROOT on the system -dnl Synopsis: -dnl -dnl ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) -dnl -dnl Some examples: -dnl -dnl ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old)) -dnl ROOT_PATH(, AC_DEFINE([HAVE_ROOT])) -dnl -dnl The macro defines the following substitution variables -dnl -dnl ROOTCONF full path to root-config -dnl ROOTEXEC full path to root -dnl ROOTCINT full path to rootcint -dnl ROOTLIBDIR Where the ROOT libraries are -dnl ROOTINCDIR Where the ROOT headers are -dnl ROOTCFLAGS Extra compiler flags -dnl ROOTLIBS ROOT basic libraries -dnl ROOTGLIBS ROOT basic + GUI libraries -dnl ROOTAUXLIBS Auxilary libraries and linker flags for ROOT -dnl ROOTAUXCFLAGS Auxilary compiler flags -dnl ROOTRPATH Same as ROOTLIBDIR -dnl -dnl The macro will fail if root-config and rootcint isn't found. -dnl -dnl Christian Holm Christensen -dnl -AC_DEFUN([ROOT_PATH], -[ - AC_ARG_WITH(rootsys, - [ --with-rootsys top of the ROOT installation directory], - user_rootsys=$withval, - user_rootsys="none") - if test ! x"$user_rootsys" = xnone; then - rootbin="$user_rootsys/bin" - elif test ! x"$ROOTSYS" = x ; then - rootbin="$ROOTSYS/bin" - else - rootbin=$PATH - fi - AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin) - AC_PATH_PROG(ROOTEXEC, root , no, $rootbin) - AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin) - - if test ! x"$ROOTCONF" = "xno" && \ - test ! x"$ROOTCINT" = "xno" ; then - - # define some variables - ROOTLIBDIR=`$ROOTCONF --libdir` - ROOTINCDIR=`$ROOTCONF --incdir` - ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags` - ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs` - ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs` - ROOTAUXCFLAGS=`$ROOTCONF --auxcflags` - ROOTAUXLIBS=`$ROOTCONF --auxlibs` - ROOTRPATH=$ROOTLIBDIR - - if test $1 ; then - AC_MSG_CHECKING(wether ROOT version >= [$1]) - vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'` - requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'` - if test $vers -lt $requ ; then - AC_MSG_RESULT(no) - no_root="yes" - else - AC_MSG_RESULT(yes) - fi - fi - else - # otherwise, we say no_root - no_root="yes" - fi - - AC_SUBST(ROOTLIBDIR) - AC_SUBST(ROOTINCDIR) - AC_SUBST(ROOTCFLAGS) - AC_SUBST(ROOTLIBS) - AC_SUBST(ROOTGLIBS) - AC_SUBST(ROOTAUXLIBS) - AC_SUBST(ROOTAUXCFLAGS) - AC_SUBST(ROOTRPATH) - - if test "x$no_root" = "x" ; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi -]) - - -# -# EOF -# diff --git a/HLT/SampleLib/configure.ac b/HLT/SampleLib/configure.ac index 0b094f58caf..573550dd21f 100644 --- a/HLT/SampleLib/configure.ac +++ b/HLT/SampleLib/configure.ac @@ -18,6 +18,7 @@ AC_PROG_LIBTOOL AC_DEBUG AC_OPTIMIZATION +AM_CONDITIONAL(STANDALONE_SAMPLELIB, 1) dnl ------------------------------------------------------------------ dnl @@ -32,7 +33,7 @@ dnl ------------------------------------------------------------------ dnl check for AliRoot features AC_LANG_PUSH(C++) have_aliroot=no -AC_ARG_WITH(aliroot,[ --with-aliroot top of the AliRoot installation], +AC_ARG_WITH(aliroot,[ --with-aliroot top of the AliRoot installation], [test -d $with_aliroot && ALICE_ROOT=$with_aliroot], []) @@ -149,7 +150,7 @@ fi dnl ------------------------------------------------------------------ dnl check for the HLT component framework AC_MSG_CHECKING([for HLT component framework in ]) -AC_ARG_WITH(hltbase, [installation path of the HLT component framework], +AC_ARG_WITH(hltbase, [ --with-hltbase installation path of the HLT component framework], [], [test -n $have_aliroot && with_hltbase=$have_aliroot ]) if test -z $with_hltbase || ! test -d $with_hltbase ; then diff --git a/HLT/configure.ac b/HLT/configure.ac index 22b351e9c89..6bce3d8f00b 100644 --- a/HLT/configure.ac +++ b/HLT/configure.ac @@ -26,6 +26,7 @@ AC_PROG_LIBTOOL AC_DEBUG AC_OPTIMIZATION +AM_CONDITIONAL(STANDALONE_SAMPLELIB, 0) dnl ------------------------------------------------------------------ dnl diff --git a/HLT/libAliHLTSample.pkg b/HLT/libAliHLTSample.pkg index 8aa18282636..72602d2bbbb 100644 --- a/HLT/libAliHLTSample.pkg +++ b/HLT/libAliHLTSample.pkg @@ -1,8 +1,6 @@ #-*- Mode: Makefile -*- # $Id: -include HLT/hlt.conf - # This files defines the source and header files for the # libAliHLTSample library and additional flags for the compilation # and linking process. For further information refer to the @@ -41,9 +39,9 @@ CINTAUTOLINK:= # directories and linking flags/options must be specified in # Makefile.am (stand-alone build system) and here (AliRoot). EDEFINE := ${HLTDEFS} -PACKCXXFLAGS := ${HLTCXXFLAGS} -PACKCFLAGS := ${HLTCLFAGS} -PACKDCXXFLAGS:= ${HLTDCXXFLAGS} +PACKCXXFLAGS := $(filter-out -ansi,$(filter-out -pedantic-errors, $(CXXFLAGS))) +PACKCFLAGS := $(filter-out -ansi, $(filter-out -pedantic-errors, $(CFLAGS))) +PACKDCXXFLAGS:= $(filter-out -pedantic-errors, $(CXXFLAGS)) EINCLUDE := HLT/BASE diff --git a/HLT/libHLTbase.pkg b/HLT/libHLTbase.pkg index fc71c8d4775..e15863f8df2 100644 --- a/HLT/libHLTbase.pkg +++ b/HLT/libHLTbase.pkg @@ -1,7 +1,7 @@ #-*- Mode: Makefile -*- # $Id: -include HLT/hlt.conf +include $(MODDIR)/hlt.conf MODULE_SRCS= AliHLTComponent.cxx \ AliHLTComponentHandler.cxx \ @@ -12,7 +12,8 @@ MODULE_SRCS= AliHLTComponent.cxx \ AliHLTLogging.cxx \ AliHLTDataBuffer.cxx \ AliHLTDataSource.cxx \ - AliHLTDataSink.cxx + AliHLTDataSink.cxx \ + AliHLTFilePublisher.cxx CLASS_HDRS:= AliHLTComponent.h \ AliHLTComponentHandler.h \ @@ -24,7 +25,8 @@ CLASS_HDRS:= AliHLTComponent.h \ AliHLTLogging.h \ AliHLTDataBuffer.h \ AliHLTDataSource.h \ - AliHLTDataSink.h + AliHLTDataSink.h \ + AliHLTFilePublisher.h MODULE_HDRS:= $(CLASS_HDRS) \ AliHLTDataTypes.h \