- added version announcement to base library
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLT_C_Component_WrapperInterface.cxx
CommitLineData
f23a6e1a 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
f23a6e1a 8 * for The ALICE Off-line Project. *
9 * *
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 **************************************************************************/
18
b22e91eb 19/** @file AliHLT_C_Component_WrapperInterface.cxx
20 @author Matthias Richter, Timm Steinbeck
21 @date
22 @brief Pure C interface to the AliRoot HLT component handler
23*/
f23a6e1a 24
0c0c9d99 25#if __GNUC__>= 3
f23a6e1a 26using namespace std;
27#endif
28
29#include "AliHLT_C_Component_WrapperInterface.h"
30#include "AliHLTComponentHandler.h"
31#include "AliHLTComponent.h"
32#include <errno.h>
33
34static AliHLTComponentHandler *gComponentHandler_C = NULL;
35
36
37int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ )
38{
39 if ( gComponentHandler_C )
40 {
41 return EINPROGRESS;
42 }
43 gComponentHandler_C = new AliHLTComponentHandler();
44 if ( !gComponentHandler_C )
45 return EFAULT;
46 gComponentHandler_C->SetEnvironment( environ );
fa760045 47 gComponentHandler_C->AnnounceVersion();
f23a6e1a 48 return 0;
49}
50
51int AliHLT_C_Component_DeinitSystem()
52{
53 if ( gComponentHandler_C )
54 {
55 delete gComponentHandler_C;
56 gComponentHandler_C = NULL;
57 }
58 return 0;
59}
60
61int AliHLT_C_Component_LoadLibrary( const char* libraryPath )
62{
63 if ( !gComponentHandler_C )
64 return ENXIO;
65 return gComponentHandler_C->LoadLibrary( libraryPath );
66}
67
68int AliHLT_C_Component_UnloadLibrary( const char* libraryPath )
69{
70 if ( !gComponentHandler_C )
71 return ENXIO;
72 return gComponentHandler_C->UnloadLibrary( libraryPath );
73}
74
75int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponentHandle* handle )
76{
77 if ( !gComponentHandler_C )
78 return ENXIO;
79 AliHLTComponent* comp;
80 int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp );
81 *handle = reinterpret_cast<AliHLTComponentHandle>( comp );
82 return ret;
83}
84
85void AliHLT_C_DestroyComponent( AliHLTComponentHandle handle )
86{
87 if ( !handle )
88 return;
89 delete reinterpret_cast<AliHLTComponent*>( handle );
90}
91
71d7c760 92int AliHLT_C_ProcessEvent( AliHLTComponentHandle handle, const AliHLTComponent_EventData* evtData, const AliHLTComponent_BlockData* blocks,
93 AliHLTComponent_TriggerData* trigData, AliHLTUInt8_t* outputPtr,
f23a6e1a 94 AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt,
95 AliHLTComponent_BlockData** outputBlocks,
96 AliHLTComponent_EventDoneData** edd )
97{
98 if ( !handle )
99 return ENXIO;
100 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
71d7c760 101 return comp->ProcessEvent( *evtData, blocks, *trigData, outputPtr, *size, *outputBlockCnt, *outputBlocks, *edd );
102}
103
104int AliHLT_C_GetOutputDataType( AliHLTComponentHandle handle, AliHLTComponent_DataType* dataType )
105{
106 if ( !handle )
107 return ENXIO;
108 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
109 *dataType = comp->GetOutputDataType();
110 return 0;
111}
112
113int AliHLT_C_GetOutputSize( AliHLTComponentHandle handle, unsigned long* constBase, double* inputMultiplier )
114{
115 if ( !handle )
116 return ENXIO;
117 AliHLTComponent* comp = reinterpret_cast<AliHLTComponent*>( handle );
118 comp->GetOutputDataSize( *constBase, *inputMultiplier );
119 return 0;
f23a6e1a 120}