// see header file for class documentation
int iResult=0;
if (libraryPath) {
- // first activate all agents which are already loaded
- if (bActivateAgents) ActivateAgents();
+ TString libName=libraryPath;
+ int slash=-1;
+ while ((slash=libName.Index("/"))>=0) {
+ libName=libName.Remove(0, slash+1);
+ }
+ libName.ReplaceAll(".so","");
// set the global component handler for static component registration
AliHLTComponent::SetGlobalComponentHandler(this);
hLib.fMode=fLibraryMode;
fLibraryList.insert(fLibraryList.begin(), hLib);
if (!phSearch) {
- HLTImportant("library %s loaded (%s%s)", libraryPath, hLib.fMode==kStatic?"persistent, ":"", loadtype);
typedef void (*CompileInfo)(const char*& date, const char*& time);
CompileInfo fctInfo=(CompileInfo)FindSymbol(libraryPath, "CompileInfo");
+ const char* date="";
+ const char* time="";
+ const char* buildOn="";
if (fctInfo) {
- const char* date="";
- const char* time="";
+ buildOn=" build on ";
(*fctInfo)(date, time);
if (!date) date="unknown";
if (!time) time="unknown";
- HLTImportant("build on %s (%s)", date, time);
- } else {
- HLTImportant("no build info available (possible AliRoot embedded build)");
}
+ HLTImportant("using %s plugin%s%s %s (%s%s)", libraryPath, buildOn, date, time, hLib.fMode==kStatic?"persistent, ":"", loadtype);
}
// static registration of components when library is loaded
if (iResult>=0) {
// alternative dynamic registration by library agents
// !!! has to be done after UnsetGlobalComponentHandler
- if (bActivateAgents) ActivateAgents();
+ if (bActivateAgents) ActivateAgents(libName.Data());
}
} else {
return iResult;
}
-void* AliHLTComponentHandler::FindSymbol(const char* library, const char* symbol)
+AliHLTfctVoid AliHLTComponentHandler::FindSymbol(const char* library, const char* symbol)
{
// see header file for class documentation
AliHLTLibHandle* hLib=FindLibrary(library);
if (hLib==NULL) return NULL;
- void* pFunc=NULL;
+ void (*pFunc)()=NULL;
#ifdef HAVE_DLFCN_H
- pFunc=dlsym(hLib->fHandle, symbol);
+ pFunc=(void (*)())dlsym(hLib->fHandle, symbol);
#else
TString* name=reinterpret_cast<TString*>(hLib->fName);
- pFunc=gSystem->DynFindSymbol(name->Data(), symbol);
+ pFunc=(void (*)())gSystem->DynFindSymbol(name->Data(), symbol);
#endif
return pFunc;
}
return iResult;
}
-int AliHLTComponentHandler::ActivateAgents(const AliHLTModuleAgent** blackList, int size)
+int AliHLTComponentHandler::ActivateAgents(const char* library, const char* blackList)
{
// see header file for class documentation
int iResult=0;
- AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
- while (pAgent && iResult>=0) {
- if (blackList) {
- int i=0;
- for (; i<size; i++) {
- if (blackList[i]==pAgent) break;
+ vector<AliHLTModuleAgent*> agents;
+ for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
+ pAgent && iResult>=0;
+ pAgent=AliHLTModuleAgent::GetNextAgent()) {
+
+ // check if we found the agent for the specified library
+ if (library) {
+ TString check="libAliHLT"; check+=pAgent->GetModuleId();
+ if (check.CompareTo(library)==0) {
+ agents.clear();
+ agents.push_back(pAgent);
+ break;
}
- if (i<size) {
- // this agent was in the list
- pAgent=AliHLTModuleAgent::GetNextAgent();
- continue;
+ }
+
+ // check if the current agent is in the black list
+ if (blackList) {
+ const char* found=strstr(blackList, pAgent->GetModuleId());
+ if (found) {
+ found+=strlen(pAgent->GetModuleId());
+ // skip this agent as it is in the blacklist
+ if (*found==0 or *found==' ') continue;
}
}
+ agents.push_back(pAgent);
+ }
- pAgent->ActivateComponentHandler(this);
- pAgent=AliHLTModuleAgent::GetNextAgent();
+ for (vector<AliHLTModuleAgent*>::iterator element=agents.begin();
+ element!=agents.end(); element++) {
+ (*element)->ActivateComponentHandler(this);
}
- return iResult;
+
+ return agents.size();
}
int AliHLTComponentHandler::DeleteOwnedComponents()