]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTModuleAgent.cxx
Removing unuseful print and putting some important one
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.cxx
index 169878eb1878618e3d7b03696fcf96fbbc0e0ab0..dbdabf5f924d27fb06c3f1cab06664d70dd0dd6e 100644 (file)
@@ -49,6 +49,12 @@ AliHLTModuleAgent::AliHLTModuleAgent(const char* id)
   Register(this);
 }
 
+const char* AliHLTModuleAgent::GetQAPlugins() const
+{
+  // default implementation, childs can overload
+  return "";
+}
+
 const AliHLTModuleAgent::AliHLTOUTHandlerDesc AliHLTModuleAgent::fgkVoidHandlerDesc;
 
 AliHLTModuleAgent::~AliHLTModuleAgent()
@@ -202,11 +208,34 @@ AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
   return fgCurrent;
 }
 
+string AliHLTModuleAgent::GetAgentIds()
+{
+  // see header file for function documentation
+  string ids;
+  ids.clear();
+  for (AliHLTModuleAgent* pCurrent=fgAnchor;
+       pCurrent;
+       pCurrent=pCurrent->fpNext) {
+    if (ids.size()>0) ids+=" ";
+    ids+=pCurrent->GetModuleId();
+  }
+
+  return ids;
+}
+
 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
 {
   // see header file for function documentation
   AliHLTLogging log;
   if (!pAgent) return -EINVAL;
+  // The following check is for extra protection. In some strange cases the agent might
+  // try to register itself more than once. So we need to check for that and prevent it.
+  // Otherwise we create a cycle in our linked list and go into an infinite loop.
+  AliHLTModuleAgent* current=fgAnchor;
+  while (current!=NULL) {
+    if (current == pAgent) return 0;
+    current = current->fpNext;
+  }
   if (fgAnchor==NULL) {
     fgAnchor=pAgent;
   } else {