3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
9 * for The ALICE HLT Project. *
11 * Permission to use, copy, modify and distribute this software and its *
12 * documentation strictly for non-commercial purposes is hereby granted *
13 * without fee, provided that the above copyright notice appears in all *
14 * copies and that both the copyright notice and this permission notice *
15 * appear in the supporting documentation. The authors make no claims *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
20 /** @file AliHLTExternalInterface.cxx
21 @author Matthias Richter, Timm Steinbeck
23 @brief Pure C interface to the AliRoot HLT component handler
30 #include "AliHLTExternalInterface.h"
31 #include "AliHLTComponentHandler.h"
32 #include "AliHLTComponent.h"
33 #include "AliHLTSystem.h"
36 static AliHLTComponentHandler *gComponentHandler_C = NULL;
39 int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ )
41 if ( gComponentHandler_C )
45 gComponentHandler_C = new AliHLTComponentHandler(environ);
46 if ( !gComponentHandler_C )
48 gComponentHandler_C->InitAliLogTrap(gComponentHandler_C);
49 gComponentHandler_C->AnnounceVersion();
53 int AliHLT_C_Component_DeinitSystem()
55 if ( gComponentHandler_C )
57 delete gComponentHandler_C;
58 gComponentHandler_C = NULL;
63 int AliHLT_C_Component_LoadLibrary( const char* libraryPath )
65 if ( !gComponentHandler_C )
67 return gComponentHandler_C->LoadLibrary( libraryPath );
70 int AliHLT_C_Component_UnloadLibrary( const char* libraryPath )
72 if ( !gComponentHandler_C )
74 return gComponentHandler_C->UnloadLibrary( libraryPath );
77 int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle )
79 if ( !gComponentHandler_C )
81 AliHLTComponent* comp;
82 int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp );
83 *handle = reinterpret_cast<AliHLTComponentHandle>( comp );
87 void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle )
92 AliHLTComponent* pComp=reinterpret_cast<AliHLTComponent*>( handle );
97 int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks,
98 AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr,
99 AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt,
100 AliHLTComponent_BlockData** outputBlocks,
101 AliHLTComponent_EventDoneData** edd )
105 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
106 return comp->ProcessEvent( *evtData, blocks, *trigData, outputPtr, *size, *outputBlockCnt, *outputBlocks, *edd );
109 int AliHLT_C_GetOutputDataType( AliHLTComponentHandle handle, AliHLTComponent_DataType* dataType )
113 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
114 *dataType = comp->GetOutputDataType();
118 int AliHLT_C_GetOutputSize( AliHLTComponentHandle handle, unsigned long* constBase, double* inputMultiplier )
122 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
123 comp->GetOutputDataSize( *constBase, *inputMultiplier );
128 int AliHLTSystemSetOptions(AliHLTSystem* pInstance, const char* options)
132 AliHLTSystem* pSystem=reinterpret_cast<AliHLTSystem*>(pInstance);
134 iResult=pSystem->ScanOptions(options);
144 int AliHLTSystemProcessHLTOUT(AliHLTSystem* pInstance, AliHLTOUT* pHLTOUT, AliESDEvent* esd)
148 AliHLTSystem* pSystem=reinterpret_cast<AliHLTSystem*>(pInstance);
150 iResult=pSystem->ProcessHLTOUT(pHLTOUT, esd);