]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTModulePreprocessor.cxx
reverting r45444 to disentangle modules and make porting possible
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModulePreprocessor.cxx
index 924cbfd41cb47785d3c5e00f64aa0032045f504f..8ae3812e7303fd1591705fde8538d5de5e1fc8da 100644 (file)
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/**
- * @file   AliHLTModulePreprocessor.cxx
- * @author Matthias Richter
- * @date   2008-01-22
- * @brief  Base class for HLT module preprocessors
- */
+// @file   AliHLTModulePreprocessor.cxx
+// @author Matthias Richter
+// @date   2008-01-22
+// @brief  Base class for HLT module preprocessors
+// 
 
+#include <cstdlib>
 #include <cassert>
 #include "AliHLTModulePreprocessor.h"
 #include "AliHLTShuttleInterface.h"
 #include "TObjString.h"
 #include "TString.h"
+#include "TMap.h"
+#include "TObject.h"
+#include "TObjArray.h"
 
 
 ClassImp(AliHLTModulePreprocessor)
 
+AliHLTModulePreprocessor::AliHLTModulePreprocessor() 
+  :
+  fpInterface(NULL),
+  fActiveDetectors(0)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTModulePreprocessor::~AliHLTModulePreprocessor() 
+{
+  // see header file for function documentation
+}
+
+// TODO: map this constants to AliHLTDAQ class
 const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
 
 const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] = 
@@ -59,30 +80,13 @@ const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] =
   "HLT"
 };
 
-AliHLTModulePreprocessor::AliHLTModulePreprocessor() 
-  :
-  fpInterface(NULL),
-  fActiveDetectors(0)
-{
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-}
-
-AliHLTModulePreprocessor::~AliHLTModulePreprocessor() 
-{
-  // see header file for function documentation
-}
-
 void AliHLTModulePreprocessor::SetShuttleInterface(AliHLTShuttleInterface* pInterface)
 {
   assert(fpInterface==NULL || fpInterface==pInterface || pInterface==NULL);
   fpInterface=pInterface;
 }
 
-Int_t AliHLTModulePreprocessor::GetRun()
+Int_t AliHLTModulePreprocessor::GetRun() const
 {
   // see header file for function documentation
 
@@ -91,7 +95,7 @@ Int_t AliHLTModulePreprocessor::GetRun()
   return fpInterface->PreprocessorGetRun();
 }
 
-UInt_t AliHLTModulePreprocessor::GetStartTime()
+UInt_t AliHLTModulePreprocessor::GetStartTime() const
 {
   // see header file for function documentation
 
@@ -100,7 +104,7 @@ UInt_t AliHLTModulePreprocessor::GetStartTime()
   return fpInterface->PreprocessorGetStartTime();
 }
 
-UInt_t AliHLTModulePreprocessor::GetEndTime()
+UInt_t AliHLTModulePreprocessor::GetEndTime() const
 {
   // see header file for function documentation
 
@@ -273,3 +277,21 @@ const char *AliHLTModulePreprocessor::DetectorName(Int_t detectorID)
     }
   return fgkDetectorName[detectorID];
 }
+
+TObject* AliHLTModulePreprocessor::GetFromMap(TMap* dcsAliasMap, const char* stringId) const
+{
+  /// extract object from the alias map
+  /// return the last object from the value set
+  TObject* object=dcsAliasMap->FindObject(stringId);
+  if (!object) return NULL;
+  TPair* pair = dynamic_cast<TPair*>(object);
+  if (pair && pair->Value()) {
+    TObjArray* valueSet = dynamic_cast<TObjArray*>(pair->Value());
+    if (!valueSet) return NULL;
+    Int_t nentriesDCS = valueSet->GetEntriesFast() - 1;
+    if(nentriesDCS>=0 && valueSet->At(nentriesDCS)){
+      return valueSet->At(nentriesDCS);
+    }
+  }
+  return NULL;
+}