]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataSource.cxx
- workaround for copying and merging of ESDs: The HLTOUT contains ESDs for every...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataSource.cxx
1 // $Id$
2
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        * 
5  * ALICE Experiment at CERN, All rights reserved.                         *
6  *                                                                        *
7  * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8  *                  for The ALICE HLT 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
19 /** @file   AliHLTDataSource.cxx
20     @author Matthias Richter
21     @date   
22     @brief  Base class implementation for HLT data source components. */
23
24 #if __GNUC__>= 3
25 using namespace std;
26 #endif
27
28 #include "AliHLTDataSource.h"
29
30 /** ROOT macro for the implementation of ROOT specific class methods */
31 ClassImp(AliHLTDataSource)
32
33 AliHLTDataSource::AliHLTDataSource()
34
35   // see header file for class documentation
36   // or
37   // refer to README to build package
38   // or
39   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 }
41
42 void* AliHLTDataSource::fgpSpecialEvent=NULL;
43 int AliHLTDataSource::fgSpecialEventSize=0;
44 AliHLTComponentDataType AliHLTDataSource::fgSpecialEventDataType=kAliHLTVoidDataType;
45 AliHLTUInt32_t AliHLTDataSource::fgSpecialEventSpecification=kAliHLTVoidDataSpec;
46
47 AliHLTDataSource::~AliHLTDataSource()
48
49   // see header file for class documentation
50 }
51
52 void AliHLTDataSource::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
53 {
54   // see header file for class documentation
55   list.clear(); // there are no input data types
56 }
57
58
59 int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
60                                     const AliHLTComponentBlockData* /*blocks*/, 
61                                     AliHLTComponentTriggerData& trigData,
62                                     AliHLTUInt8_t* outputPtr, 
63                                     AliHLTUInt32_t& size,
64                                     vector<AliHLTComponentBlockData>& outputBlocks,
65                                     AliHLTComponentEventDoneData*& edd )
66 {
67   // see header file for class documentation
68   int iResult=0;
69   if (evtData.fBlockCnt > 0) {
70     HLTWarning("Data source component skips input data blocks");
71   }
72   if (fgpSpecialEvent==NULL || fgSpecialEventSize==0) {
73     // normal event publishing
74     iResult=GetEvent(evtData, trigData, outputPtr, size, outputBlocks);
75     HLTDebug("component %s (%p) GetEvent finished (%d)", GetComponentID(), this, iResult);
76   } else {
77     // publish special event
78     if (size>=(unsigned)fgSpecialEventSize) {
79       memcpy(outputPtr, fgpSpecialEvent, fgSpecialEventSize);
80       AliHLTComponentBlockData bd;
81       FillBlockData(bd);
82       bd.fOffset=0;
83       bd.fSize=fgSpecialEventSize;
84       bd.fDataType=fgSpecialEventDataType;
85       bd.fSpecification=fgSpecialEventSpecification;
86       outputBlocks.push_back(bd);
87       size=bd.fSize;
88     } else {
89       iResult=-ENOSPC;
90     }
91   }
92   edd = NULL;
93   return iResult;
94 }
95
96 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData,
97                                 AliHLTComponentTriggerData& trigData,
98                                 AliHLTUInt8_t* /*outputPtr*/, 
99                                 AliHLTUInt32_t& /*size*/,
100                                 vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
101 {
102   // we just forward to the high level method, all other parameters already
103   // have been stored internally
104   return GetEvent(evtData, trigData);
105 }
106
107 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
108 {
109   HLTFatal("no processing method implemented");
110   return -ENOSYS;
111 }
112
113 AliHLTDataSource::AliSpecialEventGuard::AliSpecialEventGuard(AliHLTRunDesc* pDesc, AliHLTComponentDataType dt, AliHLTUInt32_t spec)
114 {
115   AliHLTDataSource::fgpSpecialEvent=pDesc; 
116   AliHLTDataSource::fgSpecialEventSize=sizeof(AliHLTRunDesc); 
117   AliHLTDataSource::fgSpecialEventDataType=dt; 
118   AliHLTDataSource::fgSpecialEventSpecification=spec;
119 }
120
121 AliHLTDataSource::AliSpecialEventGuard::~AliSpecialEventGuard()
122 {
123   AliHLTDataSource::fgpSpecialEvent=NULL; 
124   AliHLTDataSource::fgSpecialEventSize=0; 
125   AliHLTDataSource::fgSpecialEventDataType=kAliHLTVoidDataType;
126   AliHLTDataSource::fgSpecialEventSpecification=kAliHLTVoidDataSpec;
127 }