]>
Commit | Line | Data |
---|---|---|
62bb3cd4 | 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 AliHLTOUT.cxx | |
20 | @author Matthias Richter | |
21 | @date | |
22 | @brief The control class for HLTOUT data. */ | |
23 | ||
4de7334f | 24 | // see header file for class documentation |
25 | // or | |
26 | // refer to README to build package | |
27 | // or | |
28 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
62bb3cd4 | 29 | |
4de7334f | 30 | #include <cerrno> |
62bb3cd4 | 31 | #include "AliHLTOUT.h" |
32 | ||
33 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
34 | ClassImp(AliHLTOUT) | |
35 | ||
36 | AliHLTOUT::AliHLTOUT() | |
4de7334f | 37 | : |
38 | fSearchDataType(kAliHLTVoidDataType), | |
39 | fSearchSpecification(kAliHLTVoidDataSpec), | |
40 | fbLocked(0), | |
41 | fBlockDescList(), | |
42 | fCurrent(fBlockDescList.begin()), | |
43 | fpBuffer(NULL) | |
44 | { | |
62bb3cd4 | 45 | // see header file for class documentation |
46 | // or | |
47 | // refer to README to build package | |
48 | // or | |
49 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
50 | } | |
51 | ||
52 | AliHLTOUT::~AliHLTOUT() | |
4de7334f | 53 | { |
54 | // see header file for class documentation | |
55 | } | |
56 | ||
57 | int AliHLTOUT::GetNofDataBlocks() | |
58 | { | |
59 | // see header file for class documentation | |
60 | return fBlockDescList.size(); | |
61 | } | |
62 | ||
63 | int AliHLTOUT::SelectFirstDataBlock(AliHLTComponentDataType dt, AliHLTUInt32_t spec) | |
64 | { | |
65 | // see header file for class documentation | |
66 | if (fbLocked) return -EPERM; | |
67 | fCurrent=fBlockDescList.begin(); | |
68 | fSearchDataType=dt; | |
69 | fSearchSpecification=spec; | |
70 | return SelectNextDataBlock(); | |
71 | } | |
72 | ||
73 | int AliHLTOUT::SelectNextDataBlock() | |
74 | { | |
75 | // see header file for class documentation | |
76 | if (fbLocked) return -EPERM; | |
77 | int iResult=-ENOENT; | |
78 | while (fCurrent!=fBlockDescList.end() && iResult==-ENOENT) { | |
79 | if ((fSearchDataType==kAliHLTAnyDataType || (*fCurrent)==fSearchDataType) && | |
80 | fSearchSpecification==kAliHLTVoidDataSpec || (*fCurrent)==fSearchSpecification) { | |
81 | iResult=0; | |
82 | } | |
83 | } | |
84 | return iResult; | |
85 | } | |
86 | ||
87 | int AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec) | |
88 | { | |
89 | // see header file for class documentation | |
90 | int iResult=-ENOENT; | |
91 | if (fCurrent!=fBlockDescList.end()) { | |
92 | iResult=0; | |
93 | dt=(*fCurrent); | |
94 | spec=(*fCurrent); | |
95 | } | |
96 | return iResult; | |
97 | } | |
98 | ||
99 | int AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size) | |
100 | { | |
101 | // see header file for class documentation | |
102 | int iResult=-ENOENT; | |
103 | pBuffer=NULL; | |
104 | size=0; | |
105 | if (fCurrent!=fBlockDescList.end()) { | |
106 | if ((iResult=GetDataBuffer((*fCurrent).GetIndex(), pBuffer, size))>=0) { | |
107 | fpBuffer=pBuffer; | |
108 | } | |
109 | } | |
110 | return iResult; | |
111 | } | |
112 | ||
113 | int AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer) | |
114 | { | |
115 | // see header file for class documentation | |
116 | int iResult=0; | |
117 | if (pBuffer==fpBuffer) { | |
118 | fpBuffer=NULL; | |
119 | } else { | |
120 | HLTWarning("buffer %p does not match the provided one %p", pBuffer, fpBuffer); | |
121 | } | |
122 | return iResult; | |
123 | } | |
124 | ||
125 | int AliHLTOUT::AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc) | |
126 | { | |
62bb3cd4 | 127 | // see header file for class documentation |
4de7334f | 128 | if (!fbLocked) return -EPERM; |
129 | int iResult=0; | |
130 | fBlockDescList.push_back(desc); | |
131 | return iResult; | |
62bb3cd4 | 132 | } |