// $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);
}
int AliHLTMisc::InitCDB(const char* /*cdbpath*/)
{
- // see header file for function documentation
+ // default method, functionality is implemented in the child class
return -EFAULT;
}
int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
{
- // see header file for function documentation
+ // default method, functionality is implemented in the child class
return -EFAULT;
}
-AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/, int /*version*/, int /*subVersion*/)
+int AliHLTMisc::GetCDBRunNo() const
{
- // see header file for function documentation
+ // 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
{
- // see header file for function documentation
+ // 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
+ return -EFAULT;
+}
+
+AliHLTUInt64_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
+{
+ // default method, functionality is implemented in the child class
+ 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
+ return 0.0;
+}
+
+Double_t AliHLTMisc::GetBz(const Double_t */*r*/)
+{
+ // default method, functionality is implemented in the child class
+ return 0.0;
+}
+
+void AliHLTMisc::GetBxByBz(const Double_t r[3], Double_t b[3])
+{
+ // default method, functionality is implemented in the child class
+ if (!r || !b) return;
+ return;
+}
+
+const TClass* AliHLTMisc::IsAliESDHLTDecision() const
+{
+ // default method, functionality is implemented in the child class
+ return NULL;
+}
+
+int AliHLTMisc::Copy(const AliHLTGlobalTriggerDecision* /*pDecision*/, TObject* /*pESDHLTDecision*/) const
+{
+ // default method, functionality is implemented in the child class
+ 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
+ char id[kAliHLTComponentDataTypefIDsize+1];
+ strncpy(id, dt.fID, kAliHLTComponentDataTypefIDsize);
+ id[kAliHLTComponentDataTypefIDsize]=0;
+ char origin[kAliHLTComponentDataTypefOriginSize+1];
+ strncpy(origin, dt.fOrigin, kAliHLTComponentDataTypefOriginSize);
+ origin[kAliHLTComponentDataTypefOriginSize]=0;
+ out << "{" << id << ":" << origin << "}";
+ return out;
+}