]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTModuleAgent.cxx
- support for event by event reconstruction added to AliHLTSystem
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.cxx
index 448b896adb081e74b90b554a417f61da3f90cbbe..f8d284e9efe8ce1abbb1947ae19397bf08565f44 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   *
@@ -28,6 +29,8 @@
 ClassImp(AliHLTModuleAgent)
 
 AliHLTModuleAgent::AliHLTModuleAgent()
+  :
+  fpNext(NULL)
 {
   // see header file for class documentation
   // or
@@ -37,23 +40,6 @@ AliHLTModuleAgent::AliHLTModuleAgent()
   Register(this);
 }
 
-AliHLTModuleAgent::AliHLTModuleAgent(const AliHLTModuleAgent&)
-  :
-  TObject(),
-  AliHLTLogging()
-{
-  // see header file for function documentation
-}
-
-AliHLTModuleAgent& AliHLTModuleAgent::operator=(const AliHLTModuleAgent&)
-{
-  // see header file for function documentation
-  return *this;
-}
-
-TList AliHLTModuleAgent::fgAgentList;
-TObjLink* AliHLTModuleAgent::fgCurrentLnk=NULL;
-
 AliHLTModuleAgent::~AliHLTModuleAgent()
 {
   // see header file for function documentation
@@ -64,41 +50,44 @@ void AliHLTModuleAgent::PrintStatus(const char* agent)
 {
   // see header file for function documentation
   AliHLTLogging log;
-  if (agent) {
-    TObject* pAgent=fgAgentList.FindObject(agent);
-    if (pAgent) {
-      log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
-                 "agent %s available", pAgent->GetName());
-    } else {
-      log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
-                 "agent %s not found", agent);
-    }
+ if (agent) {
+   AliHLTModuleAgent* pCurrent=fAnchor;
+   while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext;
+   if (pCurrent) {
+     log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
+                "agent %s available", pCurrent->GetName());
+   } else {
+     log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
+                "agent %s not found", agent);
+   }
   } else {
-  TObjLink* lnk=fgAgentList.FirstLink();
-  while (lnk) {
-    log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
-               ((AliHLTModuleAgent*)lnk->GetObject())->GetName());
-    lnk=lnk->Next();
-  }
+   AliHLTModuleAgent* pCurrent=fAnchor;
+   log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
+   log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
+   if (pCurrent==NULL)
+     log.Logging(kHLTLogInfo, "AliHLT", "", "   none");
+   while (pCurrent) {
+     TString msg;
+     msg.Form("   %s : %p", pCurrent->GetName(), pCurrent);
+     log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
+     pCurrent=pCurrent->fpNext;
+   }
+   log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
   }
 }
 
-int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
-                                           AliRunLoader* runloader) const
+int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
+                                           AliRawReader* /*rawReader*/,
+                                           AliRunLoader* /*runloader*/) const
 {
   // default method, nothing to be done, child classes can overload
-  if (handler==NULL && runloader==NULL) {
-    // get rid of 'unused parameter' warning
-  }
   return 0;
 }
 
-const char* AliHLTModuleAgent::GetTopConfigurations(AliRunLoader* runloader) const
+const char* AliHLTModuleAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
+                                                      AliRunLoader* /*runloader*/) const
 {
   // default method, nothing to be done, child classes can overload
-  if (runloader==NULL) {
-    // get rid of 'unused parameter' warning
-  }
   return NULL;
 }
 
@@ -108,30 +97,29 @@ const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
   return NULL;
 }
 
-int AliHLTModuleAgent::RegisterComponents(AliRunLoader* runloader) const
+int AliHLTModuleAgent::RegisterComponents(AliRawReader* /*rawReader*/,
+                                         AliRunLoader* /*runloader*/) const
 {
-  if (runloader==NULL) {
-    // get rid of 'unused parameter' warning
-  }
   // default method, nothing to be done, child classes can overload
   return 0;
 }
 
+AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL;
+AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL;
+int AliHLTModuleAgent::fCount=0;
+
 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
 {
   // see header file for function documentation
-  fgCurrentLnk=fgAgentList.FirstLink();
-  if (fgCurrentLnk==NULL) return NULL;
-  return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
+  fCurrent=fAnchor;
+  return fAnchor;
 }
 
 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
 {
   // see header file for function documentation
-  if (fgCurrentLnk==NULL) return NULL;
-  fgCurrentLnk=fgCurrentLnk->Next();
-  if (fgCurrentLnk==NULL) return NULL;
-  return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
+  if (fCurrent!=NULL) fCurrent=fCurrent->fpNext;
+  return fCurrent;
 }
 
 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
@@ -139,11 +127,15 @@ int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
   // see header file for function documentation
   AliHLTLogging log;
   if (!pAgent) return -EINVAL;
-  if (fgAgentList.FindObject(pAgent)==NULL) {
-    log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
-    fgAgentList.Add(pAgent);
+  if (fAnchor==NULL) {
+    fAnchor=pAgent;
+  } else {
+    pAgent->fpNext=fAnchor;
+    fAnchor=pAgent;
   }
-  return 0;
+  //  log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
+  fCount++;
+  return 0;    
 }
 
 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
@@ -151,10 +143,21 @@ int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
   // see header file for function documentation
   AliHLTLogging log;
   if (!pAgent) return -EINVAL;
-  if (fgAgentList.FindObject(pAgent)!=NULL) {
-    log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %s (%p) removed", pAgent->GetName(), pAgent);
-    fgAgentList.Remove(pAgent);
-  } else {
+  fCurrent=NULL;
+  AliHLTModuleAgent* prev=NULL;
+  AliHLTModuleAgent* handler=fAnchor;
+  while (handler!=NULL && handler!=pAgent) {
+    prev=handler;
+    handler=handler->fpNext;
+  }
+  if (handler) {
+    if (prev==NULL) {
+      fAnchor=handler->fpNext;
+    } else {
+      prev->fpNext=handler->fpNext;
+    }
+    //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);
+    fCount--;
   }
   return 0;
 }