]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTMisc.cxx
using common function for merging of streamer info
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTMisc.cxx
index 426955f9a1aabb446877ca22961f840bf1ac846e..726738b13f5679bdbcc5272d9584d195b99b8c16 100644 (file)
@@ -1,7 +1,7 @@
 // $Id$
 
 //**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project        * 
+//* This file is property of and copyright by the                          * 
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //*                                                                        *
 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
 ///         loaded libraries
 
 #include "AliHLTMisc.h"
-#include "AliHLTLogging.h"
-#include "TClass.h"
-#include "TSystem.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTMisc);
 
 AliHLTMisc::AliHLTMisc()
 {
-  // see header file for function documentation
+  // Abstract interface of various glue functions implemented in dynamically
+  // loaded libraries.
+  //
+  // The HLT base library is independent from AliRoot and binds AliRoot
+  // functionality via dynamic libraries. The provided methods can be used
+  // from any module library without introducing additional dependencies.
 }
 
 AliHLTMisc::~AliHLTMisc()
 {
-  // see header file for function documentation
+  // destructor
 }
 
 AliHLTMisc* AliHLTMisc::fgInstance=NULL;
 
-template<class T>
-T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* library)
-{
-  // see header file for function documentation
-  int iLibResult=0;
-  T* pInstance=NULL;
-  AliHLTLogging log;
-  TClass* pCl=NULL;
-  ROOT::NewFunc_t pNewFunc=NULL;
-  do {
-    pCl=TClass::GetClass(classname);
-  } while (!pCl && (iLibResult=gSystem->Load(library))==0);
-  if (iLibResult>=0) {
-    if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
-      void* p=(*pNewFunc)(NULL);
-      if (p) {
-       pInstance=reinterpret_cast<T*>(p);
-       if (!pInstance) {
-         log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "type cast (%s) to instance failed", classname);
-       }
-      } else {
-       log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not create instance of type %s from class descriptor", classname);
-      }
-    } else {
-      log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not find class descriptor %s", classname);
-    }
-  } else {
-    log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not load %s library in order to find class descriptor %s", library, classname);
-  }
-  return pInstance;
-}
-
 AliHLTMisc& AliHLTMisc::Instance()
 {
-  // see header file for function documentation
+  // get global instance of the interface implementation
   if (!fgInstance) {
     fgInstance=LoadInstance((AliHLTMisc*)NULL, "AliHLTMiscImplementation", ALIHLTMISC_LIBRARY);
   }
@@ -100,18 +70,30 @@ int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
   return -EFAULT;
 }
 
-AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/, int /*version*/, int /*subVersion*/)
+int AliHLTMisc::GetCDBRunNo() const
+{
+  // default method, functionality is implemented in the child class
+  return -1;
+}
+
+AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/) const
 {
   // default method, functionality is implemented in the child class
   return NULL;
 }
 
-TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/)
+TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/) const
 {
   // default method, functionality is implemented in the child class
   return NULL;
 }
 
+int AliHLTMisc::CheckOCDBEntries(const TMap* const /*pMap*/) const
+{
+  // default method, functionality is implemented in the child class
+  return -ENOENT;
+}
+
 int AliHLTMisc::InitMagneticField() const
 {
   // default method, functionality is implemented in the child class
@@ -124,6 +106,18 @@ AliHLTUInt64_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
   return 0;
 }
 
+AliHLTUInt32_t AliHLTMisc::GetTimeStamp(AliRawReader* /*rawReader*/) const
+{
+  // default method, functionality is implemented in the child class
+  return 0;
+}
+
+AliHLTUInt32_t AliHLTMisc::GetEventType(AliRawReader* /*rawReader*/) const
+{
+  // default method, functionality is implemented in the child class
+  return 0;
+}
+
 Double_t AliHLTMisc::GetBz()
 {
   // default method, functionality is implemented in the child class
@@ -155,6 +149,49 @@ int AliHLTMisc::Copy(const AliHLTGlobalTriggerDecision* /*pDecision*/, TObject*
   return -EFAULT;
 }
 
+int AliHLTMisc::InitStreamerInfos(const char* /*ocdbEntry*/) const
+{
+  // default method, functionality is implemented in the child class
+  return -EFAULT;
+}
+
+int AliHLTMisc::InitStreamerInfos(TObjArray* /*pSchemas*/) const
+{
+  // default method, functionality is implemented in the child class
+  return -EFAULT;
+}
+
+int AliHLTMisc::MergeStreamerInfo(TObjArray* /*tgt*/, const TObjArray* /*src*/, int /*iVerbosity*/) const
+{
+  // default method, functionality is implemented in the child class
+  return 0;
+}
+
+void AliHLTMisc::SetAliESDtrackOnlineModeFlag(bool /*mode*/) const
+{
+  // default method, functionality is implemented in the child class
+}
+
+bool AliHLTMisc::GetAliESDtrackOnlineModeFlag() const
+{
+  // default method, functionality is implemented in the child class
+  return false;
+}
+
+AliHLTMisc::AliOnlineGuard::AliOnlineGuard(bool mode)
+  : fMode(false)
+{
+  // store the current value and set the flag
+  fMode=AliHLTMisc::Instance().GetAliESDtrackOnlineModeFlag();
+  AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(mode);
+}
+
+AliHLTMisc::AliOnlineGuard::~AliOnlineGuard()
+{
+  // restore old value of the flag
+  AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(fMode);
+}
+
 ostream  &operator<<(ostream &out, const AliHLTComponentDataType &dt)
 {
   // printout of AliHLTComponentDataType struct