4 #ifndef ALIHLTOUTHANDLER_H
5 #define ALIHLTOUTHANDLER_H
6 /* This file is property of and copyright by the ALICE HLT Project *
7 * ALICE Experiment at CERN, All rights reserved. *
8 * See cxx source for full Copyright notice */
10 /** @file AliHLTOUTHandler.h
11 @author Matthias Richter
13 @brief Base class declaration of HLTOUT handlers
15 // see below for class documentation
17 // refer to README to build package
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21 #include "AliHLTLogging.h"
26 * @class AliHLTOUTHandler
27 * Base class declaration of HLT output handlers.
28 * The library implementation of the AliHLTModuleAgent allows to generate
29 * handlers for data blocks of the HLT output. This can be the output of
30 * the real HLT coming from the HLTOUT nodes, or simulated HLT output. <br>
31 * \em Note: The created instance of AliHLTOUTHandler is
32 * deleted by the framework.
34 class AliHLTOUTHandler : public AliHLTLogging {
36 /** standard constructor */
38 /** standard destructor */
39 virtual ~AliHLTOUTHandler();
43 * The data blocks can be selected by AliHLTOUT::SelectFirstDataBlock() and
44 * AliHLTOUT::SelectNextDataBlock()
46 * Properties of the current data block can be retrieved by the following member
47 * functions of AliHLTOUT:
48 * - AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
49 * - AliHLTOUT::GetDataBlockIndex()
50 * - AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
51 * - AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
53 * The handler might decode the data block and produce new data as a
54 * replacement, see GetProcessedData()
55 * @param pData instance of the AliHLTOUT data
56 * @return depending on the overloaded function, neg. error code if failed
58 virtual int ProcessData(AliHLTOUT* pData) = 0;
61 * Get the output data, if available.
62 * Some of the handlers might produce data to replace the original data
63 * block. The handler must ensure the internal storage of the buffer and
64 * is also responsible for cleaning the buffer. The buffer must be valid
65 * until the next call of ProcessData() or ReleaseProcessedData().
67 * The default implementation just returns a NULL pointer to indicate
69 * @param pData target to receive data pointer
70 * @return size of the buffer
72 virtual int GetProcessedData(const AliHLTUInt8_t* &pData);
75 * Release the buffer of processed data.
76 * The handler implementation can do cleanup here.
77 * @param pData pointer to buffer
78 * @param size size of the buffer
79 * @return neg. error code if failed
81 virtual int ReleaseProcessedData(const AliHLTUInt8_t* pData, int size);
84 * Cleanup the current event processing.
86 virtual int FinishEvent();
89 kHandlerUndefined = 0,
91 kHandlerError = 0x1000
95 * Check state flag of the handler.
96 * @return true if flag matches
98 bool CheckStatus(unsigned int flag) {
99 return (fState&flag)!=0;
103 * Reset the state flag.
110 void SetStatusFlag(unsigned int flag) {
114 void ClearStatusFlag(unsigned int flag) {
119 /** copy constructor prohibited */
120 AliHLTOUTHandler(const AliHLTOUTHandler&);
121 /** assignment operator prohibited */
122 AliHLTOUTHandler& operator=(const AliHLTOUTHandler&);
124 /** internal state of the handler */
125 int fState; //!transient
127 ClassDef(AliHLTOUTHandler, 0)