#include <cassert>
#include "AliHLTOUT.h"
#include "AliHLTMessage.h"
+#include "AliHLTMisc.h"
#include "TSystem.h"
#include "TClass.h"
#include "TROOT.h"
AliHLTOUT* AliHLTOUT::New(AliRawReader* pRawReader)
{
// see header file for class documentation
- AliHLTOUT* instance=New("AliHLTOUTRawReader");
+ AliHLTOUT* instance=AliHLTMisc::LoadInstance((AliHLTOUT*)0, "AliHLTOUTRawReader", "libHLTrec.so");
if (instance) {
instance->SetParam(pRawReader);
}
AliHLTOUT* AliHLTOUT::New(TTree* pDigitTree, int event)
{
// see header file for class documentation
- AliHLTOUT* instance=New("AliHLTOUTDigitReader");
+ AliHLTOUT* instance=AliHLTMisc::LoadInstance((AliHLTOUT*)0, "AliHLTOUTDigitReader", "libHLTrec.so");
if (instance) {
instance->SetParam(pDigitTree, event);
}
return instance;
}
-AliHLTOUT* AliHLTOUT::New(const char* classname)
+AliHLTOUT* AliHLTOUT::New(const char* filename, int event)
{
// see header file for class documentation
- int iLibResult=0;
- AliHLTOUT* instance=NULL;
- AliHLTLogging log;
- TClass* pCl=NULL;
- ROOT::NewFunc_t pNewFunc=NULL;
- do {
- pCl=TClass::GetClass(classname);
- } while (!pCl && (iLibResult=gSystem->Load("libHLTrec.so"))==0);
- if (iLibResult>=0) {
- if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
- void* p=(*pNewFunc)(NULL);
- if (p) {
- instance=reinterpret_cast<AliHLTOUT*>(p);
- if (!instance) {
- log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "type cast to AliHLTOUT instance failed");
- }
- } else {
- log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not create AliHLTOUT instance from class descriptor");
- }
- } else {
- log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not find AliHLTOUT class descriptor");
- }
- } else {
- log.Logging(kHLTLogError, "AliHLTOUT::New", "HLTOUT handling", "can not load libHLTrec library");
+ AliHLTOUT* instance=AliHLTMisc::LoadInstance((AliHLTOUT*)0, "AliHLTOUTDigitReader", "libHLTrec.so");
+ if (instance) {
+ instance->SetParam(filename, event);
}
return instance;
}
fLog.LoggingVarargs(kHLTLogFatal, "AliHLTOUT", "SetParam" , __FILE__ , __LINE__ , "severe internal error: class mismatch");
}
+void AliHLTOUT::SetParam(const char* /*filename*/, int /*event*/)
+{
+ // see header file for class documentation
+ // default implementation, we should never get here
+ // this function can only be called from the class itsself and
+ // is intended to be used with the New functions. If we get into
+ // the default implementation there is a class mismatch.
+ assert(0);
+ fLog.LoggingVarargs(kHLTLogFatal, "AliHLTOUT", "SetParam" , __FILE__ , __LINE__ , "severe internal error: class mismatch");
+}
+
int AliHLTOUT::SelectDataBlock()
{
// see header file for class documentation
*/
static AliHLTOUT* New(TTree* pDigitTree, int event=-1);
+ /**
+ * Create an AliHLTOUTDigitReader instance
+ * Helper function to transparently access classes from the
+ * libHLTrec library.
+ */
+ static AliHLTOUT* New(const char* filename, int event=-1);
+
/**
* Get the global instance.
* The global instance is set temporarily by the AliHLTOUTGlobalInstanceGuard
*/
const AliHLTOUTHandlerListEntry& FindHandlerDesc(AliHLTUInt32_t blockIndex);
- /**
- * Internal New function for the external HLTOUT instances.
- * Currently supported classes are AliHLTOUTRawReader and
- * AliHLTOUTDigitReader, both implemented in libHLTrec.so.
- */
- static AliHLTOUT* New(const char* classname);
-
/**
* Set the RawReader as parameter.
* The function is for internal use only in conjunction with the
*/
virtual void SetParam(TTree* pDigitTree, int event=-1);
+ /**
+ * Set name of the digit file as parameter
+ * The function is for internal use only in conjunction with the
+ * New() functions.
+ */
+ virtual void SetParam(const char* filename, int event=-1);
+
/** data type for the current block search, set from @ref SelectFirstDataBlock */
AliHLTComponentDataType fSearchDataType; //!transient