]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTComponentHandler.cxx
Coding conventions
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponentHandler.cxx
index 28a829399f0169f756cf6479ed113d722ee588dd..b6e8a3eb77c9329e069070124b171998b9cd9249 100644 (file)
@@ -31,11 +31,12 @@ using namespace std;
 //#include <Riostream.h>
 #include <TSystem.h>
 #endif //HAVE_DLFCN_H
-#include "AliHLTStdIncludes.h"
+//#include "AliHLTStdIncludes.h"
 #include "AliHLTComponentHandler.h"
 #include "AliHLTComponent.h"
 #include "AliHLTDataTypes.h"
-#include "AliHLTSystem.h"
+//#include "AliHLTSystem.h"
+#include "TString.h"
 
 // the standard components
 // #include "AliHLTFilePublisher.h"
@@ -86,6 +87,25 @@ AliHLTComponentHandler::AliHLTComponentHandler(AliHLTComponentEnvironment* pEnv)
   AddStandardComponents();
 }
 
+AliHLTComponentHandler::AliHLTComponentHandler(const AliHLTComponentHandler&)
+  :
+  fComponentList(),
+  fScheduleList(),
+  fLibraryList(),
+  fEnvironment(),
+  fStandardList()
+{
+  // see header file for class documentation
+  HLTFatal("copy constructor untested");
+}
+
+AliHLTComponentHandler& AliHLTComponentHandler::operator=(const AliHLTComponentHandler&)
+{ 
+  // see header file for class documentation
+  HLTFatal("assignment operator untested");
+  return *this;
+}
+
 AliHLTComponentHandler::~AliHLTComponentHandler()
 {
   // see header file for class documentation
@@ -135,8 +155,10 @@ Int_t AliHLTComponentHandler::RegisterComponent(AliHLTComponent* pSample)
 int AliHLTComponentHandler::DeregisterComponent( const char* componentID )
 {
   // see header file for class documentation
+
   int iResult=0;
   if (componentID) {
+    HLTWarning("not yet implemented, please notify the developers if you need this function");
   } else {
     iResult=-EINVAL;
   }
@@ -262,7 +284,7 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath )
     const char* loadtype="";
 #ifdef HAVE_DLFCN_H
     // use interface to the dynamic linking loader
-    hLib.handle=dlopen(libraryPath, RTLD_NOW);
+    hLib.fHandle=dlopen(libraryPath, RTLD_NOW);
     loadtype="dlopen";
 #else
     // use ROOT dynamic loader
@@ -270,23 +292,23 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath )
     // 'failure' if the library was already loaded
     AliHLTLibHandle* pLib=FindLibrary(libraryPath);
     if (pLib) {
-       int* pRootHandle=reinterpret_cast<int*>(pLib->handle);
+       int* pRootHandle=reinterpret_cast<int*>(pLib->fHandle);
        (*pRootHandle)++;
        HLTDebug("instance %d of library %s loaded", (*pRootHandle), libraryPath);
-       hLib.handle=pRootHandle;
+       hLib.fHandle=pRootHandle;
     }
     
-    if (hLib.handle==NULL && gSystem->Load(libraryPath)==0) {
+    if (hLib.fHandle==NULL && gSystem->Load(libraryPath)==0) {
       int* pRootHandle=new int;
       if (pRootHandle) *pRootHandle=1;
-      hLib.handle=pRootHandle;
+      hLib.fHandle=pRootHandle;
       //HLTDebug("library %s loaded via gSystem", libraryPath);
     }
     loadtype="gSystem";
 #endif //HAVE_DLFCN_H
-    if (hLib.handle!=NULL) {
+    if (hLib.fHandle!=NULL) {
       // create TString object to store library path and use pointer as handle 
-      hLib.name=new TString(libraryPath);
+      hLib.fName=new TString(libraryPath);
       HLTInfo("library %s loaded (%s)", libraryPath, loadtype);
       fLibraryList.insert(fLibraryList.begin(), hLib);
       iResult=RegisterScheduledComponents();
@@ -315,7 +337,7 @@ int AliHLTComponentHandler::UnloadLibrary( const char* libraryPath )
   if (libraryPath) {
     vector<AliHLTLibHandle>::iterator element=fLibraryList.begin();
     while (element!=fLibraryList.end()) {
-      TString* pName=reinterpret_cast<TString*>((*element).name);
+      TString* pName=reinterpret_cast<TString*>((*element).fName);
       if (pName->CompareTo(libraryPath)==0) {
        UnloadLibrary(*element);
        fLibraryList.erase(element);
@@ -334,11 +356,11 @@ int AliHLTComponentHandler::UnloadLibrary(AliHLTComponentHandler::AliHLTLibHandl
   // see header file for class documentation
   int iResult=0;
   fgAliLoggingFunc=NULL;
-  TString* pName=reinterpret_cast<TString*>(handle.name);
+  TString* pName=reinterpret_cast<TString*>(handle.fName);
 #ifdef HAVE_DLFCN_H
-  dlclose(handle.handle);
+  dlclose(handle.fHandle);
 #else
-  int* pCount=reinterpret_cast<int*>(handle.handle);
+  int* pCount=reinterpret_cast<int*>(handle.fHandle);
   if (--(*pCount)==0) {
     if (pName) {
       /** Matthias 26.04.2007
@@ -366,8 +388,8 @@ int AliHLTComponentHandler::UnloadLibrary(AliHLTComponentHandler::AliHLTLibHandl
     delete pCount;
   }
 #endif //HAVE_DLFCN_H
-  handle.name=NULL;
-  handle.handle=NULL;
+  handle.fName=NULL;
+  handle.fHandle=NULL;
   if (pName) {
     HLTDebug("unload library %s", pName->Data());
     delete pName;
@@ -398,9 +420,9 @@ void* AliHLTComponentHandler::FindSymbol(const char* library, const char* symbol
   if (hLib==NULL) return NULL;
   void* pFunc=NULL;
 #ifdef HAVE_DLFCN_H
-  pFunc=dlsym(hLib->handle, symbol);
+  pFunc=dlsym(hLib->fHandle, symbol);
 #else
-  TString* name=reinterpret_cast<TString*>(hLib->name);
+  TString* name=reinterpret_cast<TString*>(hLib->fName);
   pFunc=gSystem->DynFindSymbol(name->Data(), symbol);
 #endif
   return pFunc;
@@ -412,7 +434,7 @@ AliHLTComponentHandler::AliHLTLibHandle* AliHLTComponentHandler::FindLibrary(con
   AliHLTLibHandle* hLib=NULL;
   vector<AliHLTLibHandle>::iterator element=fLibraryList.begin();
   while (element!=fLibraryList.end()) {
-    TString* name=reinterpret_cast<TString*>((*element).name);
+    TString* name=reinterpret_cast<TString*>((*element).fName);
     if (name->CompareTo(library)==0) {
       hLib=&(*element);
       break;
@@ -457,7 +479,7 @@ int AliHLTComponentHandler::DeleteStandardComponents()
   int iResult=0;
   vector<AliHLTComponent*>::iterator element=fStandardList.begin();
   while (element!=fStandardList.end()) {
-    DeregisterComponent((*element)->GetComponentID());
+    //DeregisterComponent((*element)->GetComponentID());
     delete(*element);
     fStandardList.erase(element);
     element=fStandardList.begin();