3 #ifndef ALIHLTCOMPONENT_H
4 #define ALIHLTCOMPONENT_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
9 base class for HLT components
13 #include "AliHLTDataTypes.h"
16 class AliHLTComponentHandler;
18 class AliHLTComponent {
21 virtual ~AliHLTComponent();
23 enum TComponentType { kUnknown=0, kSource=1, kProcessor=2, kSink=3 };
24 virtual int Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv );
26 virtual int ProcessEvent( AliHLTComponent_EventData evtData, AliHLTComponent_BlockData* blocks,
27 AliHLTComponent_TriggerData trigData, AliHLTUInt8_t* outputPtr,
28 AliHLTUInt32_t* size, AliHLTUInt32_t* outputBlockCnt,
29 AliHLTComponent_BlockData** outputBlocks,
30 AliHLTComponent_EventDoneData** edd ) = 0;
32 // Information member functions for registration.
33 virtual TComponentType GetComponentType() = 0; // Source, sink, or processor
34 virtual const char* GetComponentID() = 0;
35 virtual void GetInputDataTypes( vector<AliHLTComponent_DataType>& ) = 0;
36 virtual AliHLTComponent_DataType GetOutputDataType() = 0;
38 // Spawn function, return new class instance
39 virtual AliHLTComponent* Spawn() = 0;
41 static int SetGlobalComponentHandler(AliHLTComponentHandler* pCH, int bOverwrite=0) {
43 if (fpComponentHandler==NULL || bOverwrite!=0)
44 fpComponentHandler=pCH;
49 static int UnsetGlobalComponentHandler() {
50 return SetGlobalComponentHandler(NULL,1);
54 virtual int DoInit( int argc, const char** argv ){
58 virtual int DoDeinit(){
62 void* AllocMemory( unsigned long size ) {
63 if (fEnvironment.fAllocMemoryFunc)
64 return (*fEnvironment.fAllocMemoryFunc)(fEnvironment.fParam, size );
68 int MakeOutputDataBlockList( const vector<AliHLTComponent_BlockData>& blocks, AliHLTUInt32_t* blockCount,
69 AliHLTComponent_BlockData** outputBlocks ) {
70 if (fEnvironment.fMakeOutputDataBlockListFunc)
71 return (*fEnvironment.fMakeOutputDataBlockListFunc)(fEnvironment.fParam, blocks, blockCount, outputBlocks );
75 int GetEventDoneData( unsigned long size, AliHLTComponent_EventDoneData** edd ) {
76 if (fEnvironment.fGetEventDoneDataFunc)
77 return (*fEnvironment.fGetEventDoneDataFunc)(fEnvironment.fParam, fCurrentEvent, size, edd );
81 int Logging( AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* message, ... );
84 static AliHLTComponentHandler* fpComponentHandler;
85 AliHLTComponentEnvironment fEnvironment;
87 AliHLTEventID_t fCurrentEvent; // Set by ProcessEvent before actual processing starts (e.g. before calling AliHLTProcessor::DoEvent)
89 ClassDef(AliHLTComponent, 0)