3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLT_C_Component_WrapperInterface.cxx
20 @author Matthias Richter, Timm Steinbeck
22 @brief Pure C interface to the AliRoot HLT component handler
29 #include "AliHLT_C_Component_WrapperInterface.h"
30 #include "AliHLTComponentHandler.h"
31 #include "AliHLTComponent.h"
34 static AliHLTComponentHandler *gComponentHandler_C = NULL;
37 int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ )
39 if ( gComponentHandler_C )
43 gComponentHandler_C = new AliHLTComponentHandler();
44 if ( !gComponentHandler_C )
46 gComponentHandler_C->SetEnvironment( environ );
50 int AliHLT_C_Component_DeinitSystem()
52 if ( gComponentHandler_C )
54 delete gComponentHandler_C;
55 gComponentHandler_C = NULL;
60 int AliHLT_C_Component_LoadLibrary( const char* libraryPath )
62 if ( !gComponentHandler_C )
64 return gComponentHandler_C->LoadLibrary( libraryPath );
67 int AliHLT_C_Component_UnloadLibrary( const char* libraryPath )
69 if ( !gComponentHandler_C )
71 return gComponentHandler_C->UnloadLibrary( libraryPath );
74 int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle )
76 if ( !gComponentHandler_C )
78 AliHLTComponent* comp;
79 int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp );
80 *handle = reinterpret_cast<AliHLTComponentHandle>( comp );
84 void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle )
88 delete reinterpret_cast<AliHLTComponent*>( handle );
91 int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks,
92 AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr,
93 AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt,
94 AliHLTComponent_BlockData** outputBlocks,
95 AliHLTComponent_EventDoneData** edd )
99 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
100 return comp->ProcessEvent( *evtData, blocks, *trigData, outputPtr, *size, *outputBlockCnt, *outputBlocks, *edd );
103 int AliHLT_C_GetOutputDataType( AliHLTComponentHandle handle, AliHLTComponent_DataType* dataType )
107 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
108 *dataType = comp->GetOutputDataType();
112 int AliHLT_C_GetOutputSize( AliHLTComponentHandle handle, unsigned long* constBase, double* inputMultiplier )
116 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
117 comp->GetOutputDataSize( *constBase, *inputMultiplier );