From d098ebd4ea5596d0598448653918ecb2d20b8982 Mon Sep 17 00:00:00 2001 From: richterm Date: Tue, 8 May 2007 14:10:38 +0000 Subject: [PATCH] new interface library added to be independent of AliRoot dependecies --- HLT/BASE/Makefile.am | 2 +- .../interface/AliHLTExternalInterface.cxx | 123 ++++++++++++++ HLT/BASE/interface/AliHLTExternalInterface.h | 153 ++++++++++++++++++ HLT/BASE/interface/Makefile.am | 55 +++++++ HLT/Makefile.am | 1 + HLT/configure.ac | 3 + HLT/libHLTinterface.pkg | 22 +++ 7 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 HLT/BASE/interface/AliHLTExternalInterface.cxx create mode 100644 HLT/BASE/interface/AliHLTExternalInterface.h create mode 100644 HLT/BASE/interface/Makefile.am create mode 100644 HLT/libHLTinterface.pkg diff --git a/HLT/BASE/Makefile.am b/HLT/BASE/Makefile.am index 5a9891c6b6e..28bd52b2125 100644 --- a/HLT/BASE/Makefile.am +++ b/HLT/BASE/Makefile.am @@ -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 index 00000000000..a770af94018 --- /dev/null +++ b/HLT/BASE/interface/AliHLTExternalInterface.cxx @@ -0,0 +1,123 @@ +// $Id$ + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Authors: Matthias Richter * + * Timm Steinbeck * + * 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 + +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( comp ); + return ret; +} + +void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle ) +{ + if ( !handle ) + return; + + AliHLTComponent* pComp=reinterpret_cast( 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( 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( 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( 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 index 00000000000..010dca5a2e2 --- /dev/null +++ b/HLT/BASE/interface/AliHLTExternalInterface.h @@ -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 +/* 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 index 00000000000..d2c60560086 --- /dev/null +++ b/HLT/BASE/interface/Makefile.am @@ -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;}' >> $@ diff --git a/HLT/Makefile.am b/HLT/Makefile.am index da4c5af9427..e016667c5ac 100644 --- a/HLT/Makefile.am +++ b/HLT/Makefile.am @@ -26,6 +26,7 @@ SUBDIRS = BASE \ doc EXTRA_DIST = libHLTbase.pkg \ + libHLTinterface.pkg \ libAliHLTUtil.pkg \ libAliHLTSample.pkg \ libAliHLTPHOS.pkg \ diff --git a/HLT/configure.ac b/HLT/configure.ac index f3f091a42c2..d20111c7c74 100644 --- a/HLT/configure.ac +++ b/HLT/configure.ac @@ -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 index 00000000000..2637f6de6e4 --- /dev/null +++ b/HLT/libHLTinterface.pkg @@ -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 -- 2.43.0