From d5ea63f769d9b5aef12395eb61bbd67450addfee Mon Sep 17 00:00:00 2001 From: richterm Date: Tue, 30 Jun 2009 09:10:56 +0000 Subject: [PATCH] - adding libAliHLTPHOS, libAliHLTTRD and libAliHLTGlobal to default libs - init configurations from module agents with respect to the required libraries --- HLT/BASE/AliHLTSystem.cxx | 70 ++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/HLT/BASE/AliHLTSystem.cxx b/HLT/BASE/AliHLTSystem.cxx index a02b2acfd6d..0d4ec59af48 100644 --- a/HLT/BASE/AliHLTSystem.cxx +++ b/HLT/BASE/AliHLTSystem.cxx @@ -45,6 +45,7 @@ using namespace std; #include #include #include +#include //#include #include //#include @@ -55,10 +56,11 @@ const char* AliHLTSystem::fgkHLTDefaultLibs[]= { "libAliHLTRCU.so", "libAliHLTTPC.so", // "libAliHLTSample.so", - //"libAliHLTPHOS.so", + "libAliHLTPHOS.so", "libAliHLTMUON.so", - //"libAliHLTTRD.so", + "libAliHLTTRD.so", "libAliHLTITS.so", + "libAliHLTGlobal.so", "libAliHLTTrigger.so", NULL }; @@ -1224,24 +1226,74 @@ int AliHLTSystem::LoadConfigurations(AliRawReader* rawReader, AliRunLoader* runl return -EBUSY; } int iResult=0; - AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); + AliHLTModuleAgent* pAgent=NULL; + + // first check for the required libraries and load those TString extralibs; - while (pAgent && iResult>=0) { + for (pAgent=AliHLTModuleAgent::GetFirstAgent(); + pAgent && iResult>=0; + pAgent=AliHLTModuleAgent::GetNextAgent()) { const char* deplibs=pAgent->GetRequiredComponentLibraries(); if (deplibs) { HLTDebug("required libraries \'%s\' for agent %s (%p)", deplibs, pAgent->GetName(), pAgent); extralibs+=deplibs; } - if (iResult>=0) { - HLTDebug("load configurations for agent %s (%p)", pAgent->GetName(), pAgent); - pAgent->CreateConfigurations(fpConfigurationHandler, rawReader, runloader); - pAgent=AliHLTModuleAgent::GetNextAgent(); - } } if (iResult>=0) { iResult=LoadComponentLibraries(extralibs.Data()); } + // in order to register the configurations in the correct sequence + // all agents need to be ordered with respect to the required + // libraries. Ordering relies on the naming convention + // libAliHLT.so + TList agents; + for (pAgent=AliHLTModuleAgent::GetFirstAgent(); + pAgent && iResult>=0; + pAgent=AliHLTModuleAgent::GetNextAgent()) { + AliHLTModuleAgent* pPrevDep=NULL; + TString dependencies=pAgent->GetRequiredComponentLibraries(); + TObjArray* pTokens=dependencies.Tokenize(" "); + if (pTokens) { + for (int n=0; nGetEntriesFast(); n++) { + TString module=((TObjString*)pTokens->At(n))->GetString(); + HLTDebug(" checking %s", module.Data()); + module.ReplaceAll("libAliHLT", ""); + module.ReplaceAll(".so", ""); + + for (AliHLTModuleAgent* pCurrent=dynamic_cast(pPrevDep==NULL?agents.First():agents.After(pPrevDep)); + pCurrent!=NULL; pCurrent=dynamic_cast(agents.After(pCurrent))) { + HLTDebug(" checking %s == %s", module.Data(), pCurrent->GetModuleId()); + + if (module.CompareTo(pCurrent->GetModuleId())==0) { + pPrevDep=pCurrent; + break; + } + } + } + delete pTokens; + } + + if (pPrevDep) { + // insert right after the last dependency + agents.AddAfter(pPrevDep, pAgent); + HLTDebug("insert %s after %s", pAgent->GetModuleId(), pPrevDep->GetModuleId()); + } else { + // insert at the beginning + agents.AddFirst(pAgent); + HLTDebug("insert %s at beginning", pAgent->GetModuleId()); + } + } + + // now we load the configurations + if (agents.GetEntries()) { + TIter next(&agents); + while ((pAgent = dynamic_cast(next()))) { + HLTDebug("load configurations for agent %s (%p)", pAgent->GetName(), pAgent); + pAgent->CreateConfigurations(fpConfigurationHandler, rawReader, runloader); + } + } + return iResult; } -- 2.39.3