4 #ifndef ALIHLTOUTHANDLER_H
5 #define ALIHLTOUTHANDLER_H
6 ///* This file is property of and copyright by the *
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 #include "AliHLTLogging.h"
20 * @class AliHLTOUTHandler
21 * Base class declaration of HLT output handlers.
22 * The library implementation of the AliHLTModuleAgent allows to generate
23 * handlers for data blocks of the HLT output. This can be the output of
24 * the real HLT coming from the HLTOUT nodes, or simulated HLT output. <br>
25 * \em Note: The created instance of AliHLTOUTHandler is
26 * deleted by the framework.
28 class AliHLTOUTHandler : public AliHLTLogging {
30 /** standard constructor */
32 /** standard destructor */
33 virtual ~AliHLTOUTHandler();
37 * The data blocks can be selected by AliHLTOUT::SelectFirstDataBlock() and
38 * AliHLTOUT::SelectNextDataBlock()
40 * Properties of the current data block can be retrieved by the following member
41 * functions of AliHLTOUT:
42 * - AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
43 * - AliHLTOUT::GetDataBlockIndex()
44 * - AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
45 * - AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
47 * The handler might decode the data block and produce new data as a
48 * replacement, see GetProcessedData()
49 * @param pData instance of the AliHLTOUT data
50 * @return depending on the overloaded function, neg. error code if failed
52 virtual int ProcessData(AliHLTOUT* pData) = 0;
55 * Get the output data, if available.
56 * Some of the handlers might produce data to replace the original data
57 * block. The handler must ensure the internal storage of the buffer and
58 * is also responsible for cleaning the buffer. The buffer must be valid
59 * until the next call of ProcessData() or ReleaseProcessedData().
61 * The default implementation just returns a NULL pointer to indicate
63 * @param pData target to receive data pointer
64 * @return size of the buffer
66 virtual int GetProcessedData(const AliHLTUInt8_t* &pData);
69 * Release the buffer of processed data.
70 * The handler implementation can do cleanup here.
71 * @param pData pointer to buffer
72 * @param size size of the buffer
73 * @return neg. error code if failed
75 virtual int ReleaseProcessedData(const AliHLTUInt8_t* pData, int size);
78 * Cleanup the current event processing.
80 virtual int FinishEvent();
83 kHandlerUndefined = 0,
85 kHandlerError = 0x1000
89 * Check state flag of the handler.
90 * @return true if flag matches
92 bool CheckStatus(unsigned int flag) const {
93 return (fState&flag)!=0;
97 * Reset the state flag.
104 void SetStatusFlag(unsigned int flag) {
108 void ClearStatusFlag(unsigned int flag) {
113 /** copy constructor prohibited */
114 AliHLTOUTHandler(const AliHLTOUTHandler&);
115 /** assignment operator prohibited */
116 AliHLTOUTHandler& operator=(const AliHLTOUTHandler&);
118 /** internal state of the handler */
119 int fState; //!transient
121 ClassDef(AliHLTOUTHandler, 0)