* *
* Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
* Timm Steinbeck <timm@kip.uni-heidelberg.de> *
- * Artur Szostak <artursz@iafrica.com> *
* for The ALICE Off-line Project. *
* *
* Permission to use, copy, modify and distribute this software and its *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-///////////////////////////////////////////////////////////////////////////////
-// //
-// handler class for HLT analysis components //
-// //
-///////////////////////////////////////////////////////////////////////////////
+/** @file AliHLTComponentHandler.cxx
+ @author Matthias Richter, Timm Steinbeck
+ @date
+ @brief Implementation of HLT component handler. */
-#if __GNUC__== 3
+#if __GNUC__>= 3
using namespace std;
#endif
-#include <errno.h>
-#include <string.h>
#include <dlfcn.h>
-#include "AliL3StandardIncludes.h"
+#include "AliHLTStdIncludes.h"
#include "AliHLTComponentHandler.h"
#include "AliHLTComponent.h"
#include "AliHLTDataTypes.h"
#include "AliHLTSystem.h"
+/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTComponentHandler)
AliHLTComponentHandler::AliHLTComponentHandler()
+ :
+ fComponentList(),
+ fScheduleList(),
+ fLibraryList(),
+ fEnvironment()
{
+ memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment));
}
-
AliHLTComponentHandler::~AliHLTComponentHandler()
{
UnloadLibraries();
}
+int AliHLTComponentHandler::AnnounceVersion()
+{
+ int iResult=0;
+#ifdef PACKAGE_STRING
+ void HLTbaseCompileInfo( char*& date, char*& time);
+ char* date="";
+ char* time="";
+ HLTbaseCompileInfo(date, time);
+ if (!date) date="unknown";
+ if (!time) time="unknown";
+ HLTInfo("%s build on %s (%s)", PACKAGE_STRING, date, time);
+#else
+ HLTInfo("ALICE High Level Trigger (embedded AliRoot build)");
+#endif
+ return iResult;
+}
+
Int_t AliHLTComponentHandler::RegisterComponent(AliHLTComponent* pSample)
{
Int_t iResult=0;
if (FindComponent(pSample->GetComponentID())==NULL) {
iResult=InsertComponent(pSample);
if (iResult>=0) {
- Logging(kHLTLogInfo, "BASE", "Component Handler", "component %s registered", pSample->GetComponentID());
+ HLTInfo("component %s registered", pSample->GetComponentID());
}
} else {
// component already registered
- Logging(kHLTLogInfo, "BASE", "Component Handler", "component %s already registered, skipped", pSample->GetComponentID());
+ HLTDebug("component %s already registered, skipped", pSample->GetComponentID());
iResult=-EEXIST;
}
} else {
return iResult;
}
-int AliHLTComponentHandler::CreateComponent(const Char_t* componentID, void* environ_param, int argc, const char** argv, AliHLTComponent*& component )
+int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv, int argc, const char** argv, AliHLTComponent*& component )
{
int iResult=0;
if (componentID) {
if (pSample!=NULL) {
component=pSample->Spawn();
if (component) {
- Logging(kHLTLogDebug, "BASE", "Component Handler", "component \"%s\" created (%p)", componentID, component);
- component->Init(&fEnvironment, environ_param, argc, argv);
+ HLTDebug("component \"%s\" created (%p)", componentID, component);
+ component->Init(&fEnvironment, pEnv, argc, argv);
} else {
- Logging(kHLTLogError, "BASE", "Component Handler", "can not spawn component \"%s\"", componentID);
+ HLTError("can not spawn component \"%s\"", componentID);
iResult=-ENOENT;
}
} else {
- Logging(kHLTLogWarning, "BASE", "Component Handler", "can not find component \"%s\"", componentID);
+ HLTWarning("can not find component \"%s\"", componentID);
iResult=-ENOENT;
}
} else {
return iResult;
}
-Int_t AliHLTComponentHandler::FindComponentIndex(const Char_t* componentID)
+Int_t AliHLTComponentHandler::FindComponentIndex(const char* componentID)
{
Int_t iResult=0;
if (componentID) {
return iResult;
}
-AliHLTComponent* AliHLTComponentHandler::FindComponent(const Char_t* componentID)
+AliHLTComponent* AliHLTComponentHandler::FindComponent(const char* componentID)
{
AliHLTComponent* pSample=NULL;
Int_t index=FindComponentIndex(componentID);
vector<AliHLTComponent*>::iterator element=fComponentList.begin();
int index=0;
while (element!=fComponentList.end()) {
- Logging(kHLTLogInfo, "BASE", "Component Handler", "%d. %s", index++, (*element++)->GetComponentID());
+ HLTInfo("%d. %s", index++, (*element++)->GetComponentID());
}
}
void AliHLTComponentHandler::SetEnvironment(AliHLTComponentEnvironment* pEnv) {
if (pEnv) {
memcpy(&fEnvironment, pEnv, sizeof(AliHLTComponentEnvironment));
+ AliHLTLogging::Init(fEnvironment.fLoggingFunc);
}
}
AliHLTLibHandle hLib=dlopen(libraryPath, RTLD_NOW);
if (hLib) {
AliHLTComponent::UnsetGlobalComponentHandler();
- Logging(kHLTLogDebug, "BASE", "Component Handler", "library %s loaded", libraryPath);
+ HLTInfo("library %s loaded", libraryPath);
fLibraryList.push_back(hLib);
vector<AliHLTComponent*>::iterator element=fScheduleList.begin();
int iSize=fScheduleList.size();
fScheduleList.erase(element);
}
} else {
- Logging(kHLTLogError, "BASE", "Component Handler", "can not load library %s", libraryPath);
- Logging(kHLTLogError, "BASE", "Component Handler", "dlopen error: %s", dlerror());
+ HLTError("can not load library %s", libraryPath);
+ HLTError("dlopen error: %s", dlerror());
iResult=-ELIBACC;
}
} else {