]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/test/testAliHLT_C_Component_WrapperInterface.C
Fix for the case of non-existent calibration files
[u/mrichter/AliRoot.git] / HLT / BASE / test / testAliHLT_C_Component_WrapperInterface.C
index 8c0519eb06c12eb6026e636247e2388aca736a95..8fe6099ce05dd2970c10095e1e555d7da2466802 100644 (file)
@@ -19,7 +19,7 @@
 /** @file   testAliHLT_C_Component_WrapperInterface.C
     @author Matthias Richter
     @date   
-    @brief  Test program for the external wrapper interface
+    @brief  Test program for the old wrapper interface, frozen since Jul 08
  */
 
 #include "AliHLTProcessor.h"
@@ -51,18 +51,35 @@ public:
   AliHLTComponent* Spawn() {return new TestProcessor;}
 private:
   int DoInit( int argc, const char** argv ) {
+    if (fState!=kCreated) {
+      HLTError("wrong state (%d): component already initialized", fState);
+      return -EBUSY;
+    }
+
     if (argc>0 && argv) {
     }
     gRunNo=GetRunNo();
     gChainId=GetChainId();
+
+    fState=kInitialized;
     return 0;
   }
   int DoDeinit() {
+    if (fState!=kInitialized) {
+      HLTError("wrong state (%d): required %d kInitialized", fState, kInitialized);
+      return -ENODEV;
+    }
+
     return 0;
   }
 
   int DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/) {
     int iResult=0;
+    if (fState!=kInitialized) {
+      HLTError("wrong state (%d): component not initialized", fState);
+      return -ENODEV;
+    }
+
     HLTInfo("processing event");
     for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock();
         pBlock!=NULL; 
@@ -73,12 +90,24 @@ private:
       iResult=PushBack(pBlock->fPtr, pBlock->fSize/2, dt, ~pBlock->fSpecification);
       Forward();
     }
+
     return iResult;
   }
+
+  enum {
+    kCreated =0,
+    kInitialized,
+    kProcessing,
+  };
+
+  int fState; //!transient
 };
 
 TestProcessor::TestProcessor()
-  : AliHLTProcessor() 
+  : 
+  AliHLTProcessor(),
+  fState(kCreated)
 {
 }
 
@@ -145,7 +174,7 @@ int main(int /*argc*/, const char** /*argv*/)
     return iResult;
   }
 
-  if ((iResult=AliHLT_C_Component_LoadLibrary("libAliHLTUtil.so"))<0) {
+  if ((iResult=AliHLT_C_Component_LoadLibrary("../util/.libs/libAliHLTUtil.so"))<0) {
     cerr << "error: AliHLT_C_Component_LoadLibrary failed with " << iResult << endl;
     return iResult;
   }