]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new interface library added to be independent of AliRoot dependecies
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2007 14:10:38 +0000 (14:10 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2007 14:10:38 +0000 (14:10 +0000)
HLT/BASE/Makefile.am
HLT/BASE/interface/AliHLTExternalInterface.cxx [new file with mode: 0644]
HLT/BASE/interface/AliHLTExternalInterface.h [new file with mode: 0644]
HLT/BASE/interface/Makefile.am [new file with mode: 0644]
HLT/Makefile.am
HLT/configure.ac
HLT/libHLTinterface.pkg [new file with mode: 0644]

index 5a9891c6b6e199a3c775add40de203e7130bcd43..28bd52b2125c34c074561fb1b9b22af58786cb76 100644 (file)
@@ -8,7 +8,7 @@
 #    e.g. for libHLTbase, MODULE=HLTbase
 MODULE                         = HLTbase
 
-SUBDIRS                        = . util
+SUBDIRS                        = . util interface
 
 EXTRA_DIST                     = HLTbaseLinkDef.h
 
diff --git a/HLT/BASE/interface/AliHLTExternalInterface.cxx b/HLT/BASE/interface/AliHLTExternalInterface.cxx
new file mode 100644 (file)
index 0000000..a770af9
--- /dev/null
@@ -0,0 +1,123 @@
+// $Id$
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
+ *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
+ *          for The ALICE Off-line Project.                               *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLT_C_Component_WrapperInterface.cxx
+    @author Matthias Richter, Timm Steinbeck
+    @date   
+    @brief  Pure C interface to the AliRoot HLT component handler
+*/
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLT_C_Component_WrapperInterface.h"
+#include "AliHLTComponentHandler.h"
+#include "AliHLTComponent.h"
+#include <errno.h>
+
+static AliHLTComponentHandler *gComponentHandler_C = NULL;
+
+
+int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ )
+{
+  if ( gComponentHandler_C )
+    {
+      return EINPROGRESS;
+    }
+  gComponentHandler_C = new AliHLTComponentHandler(environ);
+  if ( !gComponentHandler_C )
+    return EFAULT;
+  gComponentHandler_C->InitAliLogTrap(gComponentHandler_C);
+  gComponentHandler_C->AnnounceVersion();
+  return 0;
+}
+
+int AliHLT_C_Component_DeinitSystem()
+{
+  if ( gComponentHandler_C )
+    {
+      delete gComponentHandler_C;
+      gComponentHandler_C = NULL;
+    }
+  return 0;
+}
+
+int AliHLT_C_Component_LoadLibrary( const char* libraryPath )
+{
+  if ( !gComponentHandler_C )
+    return ENXIO;
+  return gComponentHandler_C->LoadLibrary( libraryPath );
+}
+
+int AliHLT_C_Component_UnloadLibrary( const char* libraryPath )
+{
+  if ( !gComponentHandler_C )
+    return ENXIO;
+  return gComponentHandler_C->UnloadLibrary( libraryPath );
+}
+
+int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle )
+{
+  if ( !gComponentHandler_C )
+    return ENXIO;
+  AliHLTComponent* comp;
+  int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp );
+  *handle = reinterpret_cast<AliHLTComponentHandle>( comp );
+  return ret;
+}
+
+void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle )
+{
+  if ( !handle )
+    return;
+  
+  AliHLTComponent* pComp=reinterpret_cast<AliHLTComponent*>( handle );
+  pComp->Deinit();
+  delete pComp;
+}
+
+int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks, 
+                           AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr,
+                           AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt, 
+                           AliHLTComponent_BlockData** outputBlocks,
+                           AliHLTComponent_EventDoneData** edd )
+{
+  if ( !handle )
+    return ENXIO;
+  AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
+  return comp->ProcessEvent( *evtData, blocks, *trigData, outputPtr, *size, *outputBlockCnt, *outputBlocks, *edd );
+}
+
+int AliHLT_C_GetOutputDataType( AliHLTComponentHandle handle, AliHLTComponent_DataType* dataType )
+{
+  if ( !handle )
+    return ENXIO;
+  AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
+  *dataType = comp->GetOutputDataType();
+  return 0;
+}
+
+int AliHLT_C_GetOutputSize( AliHLTComponentHandle handle, unsigned long* constBase, double* inputMultiplier )
+{
+  if ( !handle )
+    return ENXIO;
+  AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
+  comp->GetOutputDataSize( *constBase, *inputMultiplier );
+  return 0;
+}
diff --git a/HLT/BASE/interface/AliHLTExternalInterface.h b/HLT/BASE/interface/AliHLTExternalInterface.h
new file mode 100644 (file)
index 0000000..010dca5
--- /dev/null
@@ -0,0 +1,153 @@
+// @(#) $Id$
+
+#ifndef ALIHLT_EXTERNALINTERFACE_H
+#define ALIHLT_EXTERNALINTERFACE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLT_C_Component_WrapperInterface.h
+    @author Matthias Richter, Timm Steinbeck
+    @date   
+    @brief  Pure and dynamic C interface to the AliRoot HLT component handler
+    @note   Utilized by the HLT Online (PubSub) framework
+*/
+
+#include <AliHLTDataTypes.h>
+/* Matthias Dec 2006
+ * The names have been changed for Aliroot's coding conventions sake
+ * The old names are defined for backward compatibility with the 
+ * PublisherSubscriber framework
+ */
+typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity;
+typedef AliHLTComponentEventData AliHLTComponent_EventData;
+typedef AliHLTComponentShmData AliHLTComponent_ShmData;
+typedef AliHLTComponentDataType AliHLTComponent_DataType;
+typedef AliHLTComponentBlockData AliHLTComponent_BlockData;
+typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData;
+typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData;
+const AliHLTUInt32_t gkAliHLTComponent_InvalidShmType = gkAliHLTComponentInvalidShmType;
+const AliHLTUInt64_t gkAliHLTComponent_InvalidShmID = gkAliHLTComponentInvalidShmID;
+
+typedef int (*AliHLTExtFctInitSystem)( AliHLTComponentEnvironment* );
+
+typedef int (*AliHLTExtFctDeinitSystem)();
+
+typedef int (*AliHLTExtFctLoadLibrary)( const char* );
+
+typedef int (*AliHLTExtFctUnloadLibrary)( const char* );
+
+typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle* );
+
+typedef void (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle );
+
+typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*, 
+                                        AliHLTComponentTriggerData*, AliHLTUInt8_t*,
+                                        AliHLTUInt32_t*, AliHLTUInt32_t*, 
+                                        AliHLTComponentBlockData**,
+                                        AliHLTComponentEventDoneData** );
+
+typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* );
+
+typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* );
+
+struct AliHLTExternalFuctions_t {
+  AliHLTExtFctInitSystem        fctInitSystem;
+  AliHLTExtFctDeinitSystem      fctDeinitSystem;
+  AliHLTExtFctLoadLibrary       fctLoadLibrary;
+  AliHLTExtFctUnloadLibrary     fctUnloadLibrary;
+  AliHLTExtFctCreateComponent   fctCreateComponent;
+  AliHLTExtFctDestroyComponent  fctDestroyComponent;
+  AliHLTExtFctProcessEvent      fctProcessEvent;
+  AliHLTExtFctGetOutputDataType fctGetOutputDataType;
+  AliHLTExtFctGetOutputSize     fctGetOutputSize;
+};
+
+#define ALIHLT_FCT_ENTRY_INITSYSTEM        "AliHLT_C_Component_InitSystem"
+#define ALIHLT_FCT_ENTRY_DEINITSYSTEM      "AliHLT_C_Component_DeinitSystem"
+#define ALIHLT_FCT_ENTRY_LOADLIBRARY       "AliHLT_C_Component_LoadLibrary"
+#define ALIHLT_FCT_ENTRY_UNLOADLIBRARY     "AliHLT_C_Component_UnloadLibrary"
+#define ALIHLT_FCT_ENTRY_CREATECOMPONENT   "AliHLT_C_Component_CreateComponent"
+#define ALIHLT_FCT_ENTRY_DESTROYCOMPONENT  "AliHLT_C_Component_DestroyComponent"
+#define ALIHLT_FCT_ENTRY_PROCESSEVENT      "AliHLT_C_Component_ProcessEvent"
+#define ALIHLT_FCT_ENTRY_GETOUTPUTDATATYPE "AliHLT_C_Component_GetOutputDataType"
+#define ALIHLT_FCT_ENTRY_GETOUTPUTSIZE     "AliHLT_C_Component_GetOutputSize"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+typedef void* AliHLTComponentHandle;
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+const AliHLTComponentHandle kEmptyHLTComponentHandle = 0;
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_Component_DeinitSystem();
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_Component_LoadLibrary( const char* libraryPath );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_Component_UnloadLibrary( const char* libraryPath );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+void AliHLT_C_DestroyComponent( AliHLTComponentHandle );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks, 
+                           AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr,
+                           AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt, 
+                           AliHLTComponent_BlockData** outputBlocks,
+                           AliHLTComponent_EventDoneData** edd );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_GetOutputDataType( AliHLTComponentHandle, AliHLTComponent_DataType* dataType );
+
+/**
+ * 
+ * @ingroup alihlt_wrapper_interface
+ */
+int AliHLT_C_GetOutputSize( AliHLTComponentHandle, unsigned long* constBase, double* inputMultiplier );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //ALIHLT_EXTERNALINTERFACE_H 
diff --git a/HLT/BASE/interface/Makefile.am b/HLT/BASE/interface/Makefile.am
new file mode 100644 (file)
index 0000000..d2c6056
--- /dev/null
@@ -0,0 +1,55 @@
+# $Id$
+# Makefile template for the Alice HLT external interface
+
+# be aware of the two different meanings of 'MODULE'
+# 1. AliRoot classifies each detector and main sub-package as a module
+#    so for all HLT library packages MODULE is equal HLT
+# 2. The HLT stand-alone build system knows about sub-modules
+#    e.g. for libHLTinterface, MODULE=HLTinterface
+MODULE                         = HLTinterface
+
+SUBDIRS                        = 
+
+AM_CPPFLAGS                    = -DMODULE=$(MODULE) \
+                                 -I$(top_srcdir)/BASE
+
+# library definition
+lib_LTLIBRARIES                        =  libHLTinterface.la
+
+# version info for the library
+LIBRARY_VERSION                        = '0:0:0'
+
+# MODDIR is set by the AliRoot build system and denotes the topdir
+# of the module, we must set it since the package definition libHLTinterface.pkg
+# includes another common configuration file
+MODDIR                         = $(top_srcdir)
+PKGDEF                         = $(MODDIR)/libHLTinterface.pkg
+include $(top_srcdir)/libHLTinterface.pkg
+
+# library sources
+libHLTinterface_la_SOURCES     = $(MODULE_SRCS)
+
+# library headers
+pkginclude_HEADERS             = $(MODULE_HDRS)
+
+# linker flags
+libHLTinterface_la_LDFLAGS     = -version-info $(LIBRARY_VERSION)
+
+# automatic generation of data and time of library build
+COMPILE_INFO                   =  HLTinterfaceCompileInfo.cxx
+
+# set the file name for the generated root dictionary
+DICTCPP                                =  HLTinterface-DICT.cxx
+nodist_libHLTinterface_la_SOURCES    =  $(COMPILE_INFO) \
+                                  $(DICTCPP)
+
+CLEANFILES                     =  $(COMPILE_INFO)
+
+include $(top_srcdir)/make.dict
+
+$(COMPILE_INFO):  Makefile.am
+       @echo '//automatically generated compilation info' > $@
+       @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
+       @echo '//add changes in Makefile.am' >> $@
+       @echo 'void $(MODULE)CompileInfo( char*& date, char*& time)' >> $@
+       @echo '{date=__DATE__; time=__TIME__; return;}' >> $@
index da4c5af9427f280a87ca9ca2f385b645a320cbb4..e016667c5ac900b75c717feadc7a59b18b9d033c 100644 (file)
@@ -26,6 +26,7 @@ SUBDIRS               = BASE \
                          doc
 
 EXTRA_DIST             = libHLTbase.pkg \
+                         libHLTinterface.pkg \
                          libAliHLTUtil.pkg \
                          libAliHLTSample.pkg \
                          libAliHLTPHOS.pkg \
index f3f091a42c2a286884ae614711e961be32514816..d20111c7c74ae5667b149963b2134282bdab2157 100644 (file)
@@ -194,6 +194,8 @@ if test ! "x$have_aliroot" = "xno" ; then
   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
 
   # CBD library is present since AliRoot version v4-05-00 (02.06.2006)
+  # in addition a circular dependency has been introduced in March 06 which
+  # requires to add libSTEER already here
   LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS -lSTEER"
   CHECKLIB=CDB
   AC_CHECK_LIB([$CHECKLIB],[_init],[ALIROOT_LIBS="$ALIROOT_LIBS -l$CHECKLIB"])
@@ -577,6 +579,7 @@ AC_CONFIG_FILES([Makefile
                 BASE/setenv.sh
                 BASE/setenv.csh
                 BASE/util/Makefile
+                BASE/interface/Makefile
                 SampleLib/Makefile
                 TPCLib/Makefile
                 TPCLib/mapping2array.cxx
diff --git a/HLT/libHLTinterface.pkg b/HLT/libHLTinterface.pkg
new file mode 100644 (file)
index 0000000..2637f6d
--- /dev/null
@@ -0,0 +1,22 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+MODULE_SRCS=   AliHLTExternalInterface.cxx
+
+CLASS_HDRS:=   
+
+MODULE_HDRS:=  $(CLASS_HDRS)
+
+DHDR:=                 
+CINTAUTOLINK:=  1
+
+# SRCS:=$(patsubst %,BASE/interface/%,$(MODULE_SRCS))
+# CINTHDRS:=$(patsubst %,BASE/interface/%,$(CLASS_HDRS))
+# HDRS:=$(patsubst %,BASE/interface/%,$(MODULE_HDRS))
+
+EDEFINE      :=
+PACKCXXFLAGS :=
+PACKCFLAGS   :=
+PACKDCXXFLAGS:=
+
+EINCLUDE := HLT/BASE/interface HLT/BASE