]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTConfiguration.cxx
Ignore
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTConfiguration.cxx
index d1351c6071606fde7a86b315e87a31dc9c9f7825..4ec0f5d82c7c986b919b8aad54c3ebfcd07c7056 100644 (file)
@@ -1,10 +1,11 @@
 // $Id$
 
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
- *          for The ALICE Off-line Project.                               *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  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   *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// HLT configuration handling                                             //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+//  @file   AliHLTConfiguration.cxx
+//  @author Matthias Richter
+//  @date   2007
+//  @brief  HLT configuration description for a single component.
+//  @note   The class is used in Offline (AliRoot) context
 
-#if __GNUC__== 3
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
 using namespace std;
 #endif
 
-#include <errno.h>
+#include <cerrno>
 #include "AliHLTConfiguration.h"
+#include "AliHLTConfigurationHandler.h"
+#include "AliHLTTask.h"
 #include "AliHLTComponent.h"
 #include "AliHLTComponentHandler.h"
 #include <iostream>
-#include <string.h>
+#include <string>
+#include "TList.h"
 
+/** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTConfiguration)
 
-/* the global configuration handler which is used to automatically register the configuration
- */
-AliHLTConfigurationHandler* AliHLTConfiguration::fConfigurationHandler=NULL;
-
 AliHLTConfiguration::AliHLTConfiguration()
+  :
+  fID(""),
+  fComponent(""),
+  fStringSources(""),
+  fNofSources(-1),
+  fListSources(),
+  fListSrcElementIdx(-1),
+  fArguments(""),
+  fArgc(-1),
+  fArgv(NULL),
+  fBufferSize(-1)
 { 
-  fID=NULL;
-  fComponent=NULL;
-  fStringSources=NULL;
-  fNofSources=-1;
-  fArguments=NULL;
-  fArgc=-1;
-  fArgv=NULL;
-  fListSrcElement=fListSources.begin();
-}
-
-AliHLTConfiguration::AliHLTConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
-{
-  fArgc=-1;
-  fArgv=NULL;
-  
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTConfiguration::AliHLTConfiguration(const char* id, const char* component, const char* sources,
+                                        const char* arguments, const char* bufsize)
+  :
+  fID(id),
+  fComponent(component),
+  fStringSources(sources),
+  fNofSources(-1),
+  fListSources(),
+  fListSrcElementIdx(-1),
+  fArguments(arguments),
+  fArgc(-1),
+  fArgv(NULL),
+  fBufferSize(-1)
+{
+  // see header file for function documentation
+  if (bufsize) fBufferSize=ConvertSizeString(bufsize);
   if (id && component) {
-    fID=id;
-    fComponent=component;
-    fStringSources=sources;
-    fNofSources=-1;
-    fArguments=arguments;
-    fListSrcElement=fListSources.begin();
-    if (fConfigurationHandler) {
-      fConfigurationHandler->RegisterConfiguration(this);
+    if (fgConfigurationHandler) {
+      fgConfigurationHandler->RegisterConfiguration(this);
     } else {
-      HLTError("no configuration handler set, abort registration");
+      HLTWarning("no configuration handler set, skip registration");
     }
   }
 }
 
+AliHLTConfiguration::AliHLTConfiguration(const AliHLTConfiguration& src)
+  :
+  TObject(),
+  AliHLTLogging(),
+  fID(src.fID),
+  fComponent(src.fComponent),
+  fStringSources(src.fStringSources),
+  fNofSources(-1),
+  fListSources(),
+  fListSrcElementIdx(-1),
+  fArguments(src.fArguments),
+  fArgc(-1),
+  fArgv(NULL),
+  fBufferSize(src.fBufferSize)
+{ 
+  // see header file for function documentation
+}
+
+AliHLTConfiguration& AliHLTConfiguration::operator=(const AliHLTConfiguration& src)
+{ 
+  // see header file for function documentation
+  if (this==&src) return *this;
+
+  fID=src.fID;
+  fComponent=src.fComponent;
+  fStringSources=src.fStringSources;
+  fNofSources=-1;
+  fArguments=src.fArguments;
+  fArgc=-1;
+  fArgv=NULL;
+  fBufferSize=src.fBufferSize;
+  return *this;
+}
+
 AliHLTConfiguration::~AliHLTConfiguration()
 {
-  if (fConfigurationHandler) {
-    if (fConfigurationHandler->FindConfiguration(fID)!=NULL) {
-      fConfigurationHandler->RemoveConfiguration(this);
+  // see header file for function documentation
+  if (fgConfigurationHandler) {
+    if (fgConfigurationHandler->FindConfiguration(fID.Data())!=NULL) {
+      // remove the configuration from the handler if it exists
+      // but DO NOT remove the clone configuration
+      fgConfigurationHandler->RemoveConfiguration(this);
     }
   }
   if (fArgv != NULL) {
@@ -86,38 +143,58 @@ AliHLTConfiguration::~AliHLTConfiguration()
     delete[] fArgv;
     fArgv=NULL;
   }
+
+  vector<AliHLTConfiguration*>::iterator element=fListSources.begin();
+  while (element!=fListSources.end()) {
+    fListSources.erase(element);
+    element=fListSources.begin();
+  }
 }
 
+/* the global configuration handler which is used to automatically register the configuration
+ */
+AliHLTConfigurationHandler* AliHLTConfiguration::fgConfigurationHandler=NULL;
+
 int AliHLTConfiguration::GlobalInit(AliHLTConfigurationHandler* pHandler)
 {
+  // see header file for function documentation
   int iResult=0;
-  if (fConfigurationHandler!=NULL) {
-    fConfigurationHandler->Logging(kHLTLogWarning, "AliHLTConfiguration::GlobalInit", HLT_DEFAULT_LOG_KEYWORD, "configuration handler already initialized, overriding object %p", fConfigurationHandler);
+  if (fgConfigurationHandler!=NULL && fgConfigurationHandler!=pHandler) {
+    fgConfigurationHandler->Logging(kHLTLogWarning, "AliHLTConfiguration::GlobalInit", HLT_DEFAULT_LOG_KEYWORD, "configuration handler already initialized, overriding object %p with %p", fgConfigurationHandler, pHandler);
   }
-  fConfigurationHandler=pHandler;
+  fgConfigurationHandler=pHandler;
   return iResult;
 }
 
-int AliHLTConfiguration::GlobalDeinit()
+int AliHLTConfiguration::GlobalDeinit(AliHLTConfigurationHandler* pHandler)
 {
+  // see header file for function documentation
   int iResult=0;
-  fConfigurationHandler=NULL;
+  if (fgConfigurationHandler!=NULL && fgConfigurationHandler!=pHandler) {
+    fgConfigurationHandler->Logging(kHLTLogWarning, "AliHLTConfiguration::GlobalDeinit", HLT_DEFAULT_LOG_KEYWORD, "handler %p is not set, skip ...", pHandler);
+    return -EBADF;
+  }
+  fgConfigurationHandler=NULL;
   return iResult;
 }
 
-const char* AliHLTConfiguration::GetName() const {
-  if (fID)
-    return fID;
+const char* AliHLTConfiguration::GetName() const 
+{
+  // see header file for function documentation
+  if (!fID.IsNull())
+    return fID.Data();
   return TObject::GetName();
 }
 
 AliHLTConfiguration* AliHLTConfiguration::GetSource(const char* id)
 {
+  // see header file for function documentation
   AliHLTConfiguration* pSrc=NULL;
   if (id) {
     // first check the current element
-    if (fListSrcElement!=fListSources.end() && strcmp(id, (*fListSrcElement)->GetName())==0) {
-      pSrc=*fListSrcElement;
+    if (fListSrcElementIdx>=0 && fListSrcElementIdx<(int)fListSources.size() &&
+       strcmp(id, (fListSources[fListSrcElementIdx])->GetName())==0) {
+      pSrc=fListSources[fListSrcElementIdx];
       } else {
       // check the list
 
@@ -132,32 +209,35 @@ AliHLTConfiguration* AliHLTConfiguration::GetSource(const char* id)
   return pSrc;
 }
 
-AliHLTConfiguration* AliHLTConfiguration::GetFirstSource()
+AliHLTConfiguration* AliHLTConfiguration::GetFirstSource() const
 {
+  // see header file for function documentation
   AliHLTConfiguration* pSrc=NULL;
-  if (fNofSources>=0 || ExtractSources()) {
-    fListSrcElement=fListSources.begin();
-    if (fListSrcElement!=fListSources.end()) pSrc=*fListSrcElement;
+  if (fNofSources>0) {
+    const_cast<AliHLTConfiguration*>(this)->fListSrcElementIdx=-1;
+    pSrc=GetNextSource();
   } 
   return pSrc;
 }
 
-AliHLTConfiguration* AliHLTConfiguration::GetNextSource()
+AliHLTConfiguration* AliHLTConfiguration::GetNextSource() const
 {
+  // see header file for function documentation
   AliHLTConfiguration* pSrc=NULL;
   if (fNofSources>0) {
-    if (fListSrcElement!=fListSources.end() && (++fListSrcElement)!=fListSources.end()) 
-      pSrc=*fListSrcElement;
+    if (fListSrcElementIdx+1<(int)fListSources.size()) {
+      const_cast<AliHLTConfiguration*>(this)->fListSrcElementIdx++;
+      pSrc=fListSources[fListSrcElementIdx];
+    }
   } 
   return pSrc;
 }
 
-int AliHLTConfiguration::SourcesResolved(int bAuto) 
+int AliHLTConfiguration::SourcesResolved() const
 {
+  // see header file for function documentation
   int iResult=0;
-  if (fNofSources>=0 || bAuto && (iResult=ExtractSources())>=0) {
-    //HLTDebug("fNofSources=%d", fNofSources);
-    //HLTDebug("list size = %d", fListSources.size());
+  if (fNofSources>=0) {
     iResult=fNofSources==(int)fListSources.size();
   }
   return iResult;
@@ -165,13 +245,14 @@ int AliHLTConfiguration::SourcesResolved(int bAuto)
 
 int AliHLTConfiguration::InvalidateSource(AliHLTConfiguration* pConf)
 {
+  // see header file for function documentation
   int iResult=0;
   if (pConf) {
     vector<AliHLTConfiguration*>::iterator element=fListSources.begin();
     while (element!=fListSources.end()) {
       if (*element==pConf) {
        fListSources.erase(element);
-       fListSrcElement=fListSources.end();
+       fListSrcElementIdx=fListSources.size();
        // there is no need to re-evaluate until there was a new configuration registered
        // -> postpone the invalidation, its done in AliHLTConfigurationHandler::RegisterConfiguration
        //InvalidateSources();
@@ -185,15 +266,16 @@ int AliHLTConfiguration::InvalidateSource(AliHLTConfiguration* pConf)
   return iResult;
 }
 
-void AliHLTConfiguration::PrintStatus()
+void AliHLTConfiguration::PrintStatus() const
 {
+  // see header file for function documentation
   HLTLogKeyword("configuration status");
   HLTMessage("status of configuration \"%s\" (%p)", GetName(), this);
-  if (fComponent) HLTMessage("  - component: \"%s\"", fComponent);
+  if (!fComponent.IsNull()) HLTMessage("  - component: \"%s\"", fComponent.Data());
   else HLTMessage("  - component string invalid");
-  if (fStringSources) HLTMessage("  - sources: \"%s\"", fStringSources);
+  if (!fStringSources.IsNull()) HLTMessage("  - sources: \"%s\"", fStringSources.Data());
   else HLTMessage("  - no sources");
-  if (SourcesResolved(1)<=0)
+  if (SourcesResolved()!=1)
     HLTMessage("    there are unresolved sources");
   AliHLTConfiguration* pSrc=GetFirstSource();
   while (pSrc) {
@@ -202,13 +284,39 @@ void AliHLTConfiguration::PrintStatus()
   }
 }
 
-int AliHLTConfiguration::GetArguments(int* pArgc, const char*** pArgv)
+void AliHLTConfiguration::Print(const char* option) const
 {
+  // print information
+  if (option && strcmp(option, "status")==0) {
+    PrintStatus();
+    return;
+  }
+  HLTLogKeyword("configuration");
+  HLTMessage("configuration %s: component %s, sources %s, arguments %s",
+            GetName(),
+            GetComponentID(),
+            GetSourceSettings(),
+            GetArgumentSettings()
+            );
+}
+
+int AliHLTConfiguration::GetArguments(const char*** pArgv) const
+{
+  // see header file for function documentation
   int iResult=0;
-  if (pArgc && pArgv) {
-    *pArgc=fArgc;
+  if (pArgv) {
+    if (fArgc==-1) {
+      if ((iResult=const_cast<AliHLTConfiguration*>(this)->ExtractArguments())<0) {
+       HLTError("error extracting arguments for configuration %s", GetName());
+      }
+    } else if (fArgc<0) {
+      HLTError("previous argument extraction failed");
+    }
+    //HLTDebug("%s fArgc %d", GetName(), fArgc);
+    iResult=fArgc;
     *pArgv=(const char**)fArgv;
   } else {
+    HLTError("invalid parameter");
     iResult=-EINVAL;
   }
   return iResult;
@@ -217,45 +325,46 @@ int AliHLTConfiguration::GetArguments(int* pArgc, const char*** pArgv)
 
 int AliHLTConfiguration::ExtractSources()
 {
+  // see header file for function documentation
   int iResult=0;
-  fNofSources=0;
-  if (fStringSources!=NULL) {
+  fNofSources=0; // indicates that the function was called, there are either n or 0 sources
+  fListSources.clear();
+  if (!fgConfigurationHandler) {
+    HLTError("global configuration handler not initialized, can not resolve sources");
+    return -EFAULT;
+  }
+  if (!fStringSources.IsNull()) {
     vector<char*> tgtList;
-    fListSources.clear();
-    if ((iResult=InterpreteString(fStringSources, tgtList))>=0) {
+    if ((iResult=InterpreteString(fStringSources.Data(), tgtList))>=0) {
       fNofSources=tgtList.size();
       vector<char*>::iterator element=tgtList.begin();
       while ((element=tgtList.begin())!=tgtList.end()) {
-       if (fConfigurationHandler) {
-         AliHLTConfiguration* pConf=fConfigurationHandler->FindConfiguration(*element);
+         AliHLTConfiguration* pConf=fgConfigurationHandler->FindConfiguration(*element);
          if (pConf) {
-           HLTDebug("source \"%s\" inserted", pConf->GetName());
+           //HLTDebug("configuration %s (%p): source \"%s\" (%p) inserted", GetName(), this, pConf->GetName(), pConf);
            fListSources.push_back(pConf);
          } else {
            HLTError("can not find source \"%s\"", (*element));
            iResult=-ENOENT;
          }
-       } else if (iResult>=0) {
-         iResult=-EFAULT;
-         HLTFatal("global configuration handler not initialized, can not resolve sources");
-       }
        delete[] (*element);
        tgtList.erase(element);
       }
-      fListSrcElement=fListSources.begin();
     }
   }
-  return iResult;
+  fListSrcElementIdx=-1;
+  return iResult<0?iResult:SourcesResolved();
 }
 
 int AliHLTConfiguration::ExtractArguments()
 {
+  // see header file for function documentation
   int iResult=0;
-  if (fArguments!=NULL) {
+  if (!fArguments.IsNull()) {
     vector<char*> tgtList;
     if ((iResult=InterpreteString(fArguments, tgtList))>=0) {
       fArgc=tgtList.size();
-      //HLTDebug("found %d arguments", fArgc);
+      //HLTDebug("configuration %s: extracted %d arguments from \"%s\"", GetName(), fArgc, fArguments);
       if (fArgc>0) {
        fArgv = new char*[fArgc];
        if (fArgv) {
@@ -271,19 +380,31 @@ int AliHLTConfiguration::ExtractArguments()
        }
       }
     }
+  } else {
+    // there are zero arguments
+    fArgc=0;
   }
+  if (iResult<0) fArgc=iResult;
   return iResult;
 }
 
 int AliHLTConfiguration::InterpreteString(const char* arg, vector<char*>& argList)
 {
+  // see header file for function documentation
   int iResult=0;
   if (arg) {
     //HLTDebug("interprete \"%s\"", arg);
     int i=0;
     int prec=-1;
+    int bQuote=0;
     do {
-      if (arg[i]==0 || arg[i]==' ') {
+      //HLTDebug("%d %x", i, arg[i]);
+      if (arg[i]=='\'' && bQuote==0) {
+       bQuote=1;
+      } else if (arg[i]==0 || 
+                (arg[i]==' ' && bQuote==0) ||
+                (arg[i]=='\'' && bQuote==1)) {
+       bQuote=0;
        if (prec>=0) {
          char* pEntry= new char[i-prec+1];
          if (pEntry) {
@@ -303,8 +424,39 @@ int AliHLTConfiguration::InterpreteString(const char* arg, vector<char*>& argLis
   return iResult;
 }
 
+int AliHLTConfiguration::ConvertSizeString(const char* strSize) const
+{
+  // see header file for function documentation
+  int size=0;
+  if (!strSize) return -1;
+
+  char* endptr=NULL;
+  size=strtol(strSize, &endptr, 10);
+  if (size>=0) {
+    if (endptr) {
+      if (endptr==strSize) {
+       HLTWarning("ignoring unrecognized buffer size '%s'", strSize);
+       size=-1;
+      } else if (*endptr==0) {
+       // no unit specifier
+      } else if (*endptr=='k') {
+       size*=1014;
+      } else if (*endptr=='M') {
+       size*=1024*1024;
+      } else {
+       HLTWarning("ignoring buffer size of unknown unit '%c'", endptr[0]);
+      }
+    } else {
+      HLTWarning("ignoring negative buffer size specifier '%s'", strSize);
+      size=-1;
+    }
+  }
+  return size;
+}
+
 int AliHLTConfiguration::FollowDependency(const char* id, TList* pTgtList)
 {
+  // see header file for function documentation
   int iResult=0;
   if (id) {
     AliHLTConfiguration* pDep=NULL;
@@ -327,398 +479,4 @@ int AliHLTConfiguration::FollowDependency(const char* id, TList* pTgtList)
   return iResult;
 }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ClassImp(AliHLTTask)
-
-AliHLTTask::AliHLTTask()
-{
-  fpConfiguration=NULL;
-  fpComponent=NULL;
-  fpBlockDataArray=NULL;
-}
-
-AliHLTTask::AliHLTTask(AliHLTConfiguration* fConf, AliHLTComponentHandler* pCH)
-{
-  fpConfiguration=NULL;
-  fpComponent=NULL;
-  fpBlockDataArray=NULL;
-  Init(fConf, pCH);
-}
-
-AliHLTTask::~AliHLTTask()
-{
-  if (fpComponent) delete fpComponent;
-  fpComponent=NULL;
-  if (fpBlockDataArray) delete[] fpBlockDataArray;
-  fpBlockDataArray=NULL;
-}
-
-int AliHLTTask::Init(AliHLTConfiguration* fConf, AliHLTComponentHandler* pCH)
-{
-  int iResult=0;
-  if (fConf) {
-    fpConfiguration=fConf;
-    if (pCH) {
-      int argc=0;
-      const char** argv=NULL;
-      if ((iResult=fConf->GetArguments(&argc, &argv))>=0) {
-       iResult=pCH->CreateComponent(fConf->GetComponentID(), NULL, argc, argv, fpComponent);
-       if (fpComponent) {
-       } else {
-         HLTError("can not find component \"%s\"", fConf->GetComponentID());
-       }
-      }
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-const char *AliHLTTask::GetName() const
-{
-  if (fpConfiguration)
-    return fpConfiguration->GetName();
-  return TObject::GetName();
-}
-
-AliHLTConfiguration* AliHLTTask::GetConf()
-{
-  return fpConfiguration;
-}
-
-AliHLTComponent* AliHLTTask::GetComponent()
-{
-  return fpComponent;
-}
-
-AliHLTTask* AliHLTTask::FindDependency(const char* id)
-{
-  AliHLTTask* pTask=NULL;
-  if (id) {
-    pTask=(AliHLTTask*)fListDependencies.FindObject(id);
-  }
-  return pTask;
-}
-
-int AliHLTTask::FollowDependency(const char* id, TList* pTgtList)
-{
-  int iResult=0;
-  if (id) {
-    AliHLTTask* pDep=NULL;
-    if ((pDep=(AliHLTTask*)fListDependencies.FindObject(id))!=NULL) {
-      if (pTgtList) pTgtList->Add(pDep);
-      iResult++;
-    } else {
-      TObjLink* lnk=fListDependencies.FirstLink();
-      while (lnk && iResult==0) {
-       pDep=(AliHLTTask*)lnk->GetObject();
-       if (pDep) {
-         if ((iResult=pDep->FollowDependency(id, pTgtList))>0) {
-           if (pTgtList) pTgtList->AddFirst(pDep);
-           iResult++;
-         }
-       } else {
-         iResult=-EFAULT;
-       }
-       lnk=lnk->Next();
-      }
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration)
-{
-  HLTLogKeyword("task dependencies");
-  int iResult=0;
-  TList tgtList;
-  if (bFromConfiguration) {
-    if (fpConfiguration)
-      iResult=fpConfiguration->FollowDependency(id, &tgtList);
-    else
-      iResult=-EFAULT;
-  } else
-    iResult=FollowDependency(id, &tgtList);
-  if (iResult>0) {
-    HLTMessage("     task \"%s\": dependency level %d ", GetName(), iResult);
-    TObjLink* lnk=tgtList.FirstLink();
-    int i=iResult;
-    char* pSpace = new char[iResult+1];
-    if (pSpace) {
-      memset(pSpace, 32, iResult);
-      pSpace[i]=0;
-      while (lnk) {
-       TObject* obj=lnk->GetObject();
-       HLTMessage("     %s^-- %s ", &pSpace[i--], obj->GetName());
-       lnk=lnk->Next();
-      }
-      delete [] pSpace;
-    } else {
-      iResult=-ENOMEM;
-    }
-  }
-}
-
-int AliHLTTask::InsertBlockData(AliHLTComponent_BlockData* pBlock, AliHLTTask* pSource)
-{
-  int iResult=0;
-  return iResult;
-}
-
-int AliHLTTask::SetDependency(AliHLTTask* pDep)
-{
-  int iResult=0;
-  if (pDep) {
-    if (FindDependency(pDep->GetName())==NULL) {
-      fListDependencies.Add(pDep);
-    } else {
-      iResult=-EEXIST;
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-int AliHLTTask::CheckDependencies()
-{
-  int iResult=0;
-  AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
-  while (pSrc) {
-    if (FindDependency(pSrc->GetName())==NULL) {
-      //HLTDebug("dependency \"%s\" unresolved", pSrc->GetName());
-      iResult++;
-    }
-    pSrc=fpConfiguration->GetNextSource();
-  }
-  return iResult;
-}
-
-
-int AliHLTTask::Depends(AliHLTTask* pTask)
-{
-  int iResult=0;
-  if (pTask) {
-    if (fpConfiguration) {
-      iResult=fpConfiguration->GetSource(pTask->GetName())!=NULL;
-      if (iResult>0) {
-       //HLTDebug("task  \"%s\" depends on \"%s\"", GetName(), pTask->GetName());
-      } else {
-       //HLTDebug("task  \"%s\" independend of \"%s\"", GetName(), pTask->GetName());
-      }
-    } else {
-      iResult=-EFAULT;
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-AliHLTTask* AliHLTTask::FindTarget(const char* id)
-{
-  AliHLTTask* pTask=NULL;
-  if (id) {
-    pTask=(AliHLTTask*)fListTargets.FindObject(id);
-  }
-  return pTask;
-}
-
-int AliHLTTask::SetTarget(AliHLTTask* pTgt)
-{
-  int iResult=0;
-  if (pTgt) {
-    if (FindTarget(pTgt->GetName())==NULL) {
-      fListTargets.Add(pTgt);
-    } else {
-      iResult=-EEXIST;
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-int AliHLTTask::BuildBlockDataArray(AliHLTComponent_BlockData*& pTgt)
-{
-  int iResult=0;
-  return iResult;
-}
-
-
-// int AliHLTTask::ProcessTask(...)
-// {
-//   int iResult=0;
-//   return iResult;
-// }
-
-
-int AliHLTTask::ClearSourceBlocks()
-{
-  int iResult=0;
-  return iResult;
-}
-
-void AliHLTTask::PrintStatus()
-{
-  HLTLogKeyword("task properties");
-  if (fpComponent) {
-    HLTMessage("     component: %s (%p)", fpComponent->GetComponentID(), fpComponent);
-  } else {
-    HLTMessage("     no component set!");
-  }
-  if (fpConfiguration) {
-    AliHLTConfiguration* pSrc=fpConfiguration->GetFirstSource();
-    while (pSrc) {
-      const char* pQualifier="unresolved";
-      if (FindDependency(pSrc->GetName()))
-       pQualifier="resolved";
-      HLTMessage("     source: %s (%s)", pSrc->GetName(), pQualifier);
-      pSrc=fpConfiguration->GetNextSource();
-    }
-    TObjLink* lnk = fListTargets.FirstLink();
-    while (lnk) {
-      TObject *obj = lnk->GetObject();
-      HLTMessage("     target: %s", obj->GetName());
-      lnk = lnk->Next();
-    }
-  } else {
-    HLTMessage("     task \"%s\" not initialized", GetName());
-  }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-TList AliHLTConfigurationHandler::fListConfigurations;
-TList AliHLTConfigurationHandler::fListDynamicConfigurations;
-
-ClassImp(AliHLTConfigurationHandler)
-
-AliHLTConfigurationHandler::AliHLTConfigurationHandler()
-{
-}
-
-AliHLTConfigurationHandler::~AliHLTConfigurationHandler()
-{
-  TObjLink* lnk=fListDynamicConfigurations.FirstLink();
-  while (lnk) {
-    TObject* obj=lnk->GetObject();
-    if (fListConfigurations.FindObject(obj->GetName())==NULL) {
-      HLTDebug("delete dynamic configuration \"%s\"", obj->GetName());
-      delete obj;
-    }
-    lnk=lnk->Next();
-  }
-}
-
-int AliHLTConfigurationHandler::RegisterConfiguration(AliHLTConfiguration* pConf)
-{
-  int iResult=0;
-  if (pConf) {
-    if (FindConfiguration(pConf->GetName()) == NULL) {
-      fListConfigurations.Add(pConf);
-      //HLTDebug("configuration \"%s\" registered", pConf->GetName());
-
-      // mark all configurations with unresolved dependencies for re-evaluation
-      TObjLink* lnk=fListConfigurations.FirstLink();
-      while (lnk) {
-       AliHLTConfiguration* pSrc=(AliHLTConfiguration*)lnk->GetObject();
-       if (pSrc && pSrc!=pConf && pSrc->SourcesResolved()!=1) {
-         pSrc->InvalidateSources();
-       }
-       lnk=lnk->Next();
-      }
-    } else {
-      iResult=-EEXIST;
-      HLTWarning("configuration \"%s\" already registered", pConf->GetName());
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-int AliHLTConfigurationHandler::CreateConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
-{
-  int iResult=0;
-  AliHLTConfiguration* pConf= new AliHLTConfiguration(id, component, sources, arguments);
-  if (pConf) {
-    // the configuration will be registered automatically, if this failes the configuration
-    // is missing -> delete it
-    if (FindConfiguration(id)==NULL) {
-      delete pConf;
-      pConf=NULL;
-      iResult=-EEXIST;
-    } else {
-      fListDynamicConfigurations.Add(pConf);
-    }
-  } else {
-    HLTError("system error: object allocation failed");
-    iResult=-ENOMEM;
-  }
-  return iResult;
-}
-
-void AliHLTConfigurationHandler::PrintConfigurations()
-{
-  HLTLogKeyword("configuration listing");
-  HLTMessage("registered configurations:");
-  TObjLink *lnk = fListConfigurations.FirstLink();
-  while (lnk) {
-    TObject *obj = lnk->GetObject();
-    HLTMessage("  %s", obj->GetName());
-    lnk = lnk->Next();
-  }
-}
-
-int AliHLTConfigurationHandler::RemoveConfiguration(const char* id)
-{
-  int iResult=0;
-  if (id) {
-    AliHLTConfiguration* pConf=NULL;
-    if ((pConf=FindConfiguration(id))!=NULL) {
-      iResult=RemoveConfiguration(pConf);
-    } else {
-      HLTWarning("can not find configuration \"%s\"", id);
-      iResult=-ENOENT;
-    }
-  } else {
-    iResult=-EINVAL;
-  }
-  return iResult;
-}
-
-int AliHLTConfigurationHandler::RemoveConfiguration(AliHLTConfiguration* pConf)
-{
-  int iResult=0;
-  if (pConf) {
-    // remove the configuration from the list
-    fListConfigurations.Remove(pConf);
-    // remove cross links in the remaining configurations
-    TObjLink* lnk=fListConfigurations.FirstLink();
-    while (lnk && iResult>=0) {
-      AliHLTConfiguration* pRem=(AliHLTConfiguration*)lnk->GetObject();
-      if (pRem) {
-       pRem->InvalidateSource(pConf);
-      } else {
-       iResult=-EFAULT;
-      }
-      lnk=lnk->Next();
-    }
-  }
-  return iResult;
-}
-
-AliHLTConfiguration* AliHLTConfigurationHandler::FindConfiguration(const char* id)
-{
-  AliHLTConfiguration* pConf=NULL;
-  if (id) {
-    pConf=(AliHLTConfiguration*)fListConfigurations.FindObject(id); 
-  }
-  return pConf;
-}