]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/latex/classAliHLTDataBuffer.tex
New component for writing calibration data to fxs (Oystein)
[u/mrichter/AliRoot.git] / HLT / PHOS / latex / classAliHLTDataBuffer.tex
CommitLineData
a34b6698 1\section{Ali\-HLTData\-Buffer Class Reference}
2\label{classAliHLTDataBuffer}\index{AliHLTDataBuffer@{AliHLTDataBuffer}}
3{\tt \#include $<$Ali\-HLTData\-Buffer.h$>$}
4
5Inheritance diagram for Ali\-HLTData\-Buffer::\begin{figure}[H]
6\begin{center}
7\leavevmode
8\includegraphics[height=2cm]{classAliHLTDataBuffer}
9\end{center}
10\end{figure}
11
12
13\subsection{Detailed Description}
14Handling of data buffers for the HLT.
15
16The class provides handling of data buffers for HLT tasks. Each task gets its own Data Buffer instance. The buffer is grouped into different data segments according to the output of the component.\par
17 The Data Buffer keeps control over the data requests of the 'child' components. Each component can subscribe to a certain segment of the data buffer. It's state is then changed from 'reserved' to 'active'. After the data processing, the component has to release the segment and it's state is set to 'processed'. If all components have requested and released their data, the Raw Buffer is released and pushed back in the list of available buffers.
18
19\begin{Desc}
20\item[Note:]This class is only used for the {\bf HLT integration into Ali\-Root}{\rm (p.\,\pageref{group__alihlt__system})}. \end{Desc}
21
22
23
24
25Definition at line 41 of file Ali\-HLTData\-Buffer.h.\subsection*{Public Member Functions}
26\begin{CompactItemize}
27\item
28{\bf Ali\-HLTData\-Buffer} ()
29\item
30{\bf Ali\-HLTData\-Buffer} (const {\bf Ali\-HLTData\-Buffer} \&)
31\item
32{\bf Ali\-HLTData\-Buffer} \& {\bf operator=} (const {\bf Ali\-HLTData\-Buffer} \&)
33\item
34virtual {\bf $\sim$Ali\-HLTData\-Buffer} ()
35\item
36int {\bf Set\-Consumer} ({\bf Ali\-HLTComponent} $\ast$p\-Consumer)
37\item
38int {\bf Find\-Matching\-Data\-Blocks} (const {\bf Ali\-HLTComponent} $\ast$p\-Consumer, vector$<$ {\bf Ali\-HLTComponent\-Data\-Type} $>$ $\ast$tgt\-List=NULL)
39\item
40int {\bf Subscribe} (const {\bf Ali\-HLTComponent} $\ast$p\-Consumer, {\bf Ali\-HLTComponent\-Block\-Data} $\ast$array\-Block\-Desc, int i\-Array\-Size)
41\item
42int {\bf Release} ({\bf Ali\-HLTComponent\-Block\-Data} $\ast$p\-Block\-Desc, const {\bf Ali\-HLTComponent} $\ast$p\-Consumer)
43\item
44{\bf Ali\-HLTUInt8\_\-t} $\ast$ {\bf Get\-Target\-Buffer} (int i\-Min\-Size)
45\item
46int {\bf Set\-Segments} ({\bf Ali\-HLTUInt8\_\-t} $\ast$p\-Tgt, {\bf Ali\-HLTComponent\-Block\-Data} $\ast$array\-Segments, int i\-Size)
47\item
48int {\bf Is\-Empty} ()
49\item
50int {\bf Get\-Nof\-Segments} ()
51\item
52int {\bf Get\-Nof\-Consumers} ()
53\item
54int {\bf Get\-Nof\-Active\-Consumers} ()
55\item
56int {\bf Find\-Consumer} ({\bf Ali\-HLTComponent} $\ast$p\-Consumer, int b\-All\-Lists=1)
57\item
58int {\bf Reset} ()
59\end{CompactItemize}
60\subsection*{Private Member Functions}
61\begin{CompactItemize}
62\item
63int {\bf Find\-Matching\-Data\-Segments} (const {\bf Ali\-HLTComponent} $\ast$p\-Consumer, vector$<$ {\bf Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment} $>$ \&tgt\-List)
64\item
65int {\bf Reset\-Data\-Buffer} ()
66\item
67{\bf Ali\-HLTConsumer\-Descriptor} $\ast$ {\bf Find\-Consumer} (const {\bf Ali\-HLTComponent} $\ast$p\-Consumer, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \&list) const
68\begin{CompactList}\small\item\em transient/////////////////////////////////////////////////////////////////////////// \item\end{CompactList}\item
69int {\bf Change\-Consumer\-State} ({\bf Ali\-HLTConsumer\-Descriptor} $\ast$p\-Desc, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \&src\-List, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \&tgt\-List)
70\item
71int {\bf Cleanup\-Consumer\-List} ()
72\end{CompactItemize}
73\subsection*{Static Private Member Functions}
74\begin{CompactItemize}
75\item
76{\bf Ali\-HLTRaw\-Buffer} $\ast$ {\bf Create\-Raw\-Buffer} ({\bf Ali\-HLTUInt32\_\-t} size)
77\item
78int {\bf Release\-Raw\-Buffer} ({\bf Ali\-HLTRaw\-Buffer} $\ast$p\-Buffer)
79\item
80int {\bf Delete\-Raw\-Buffers} ()
81\end{CompactItemize}
82\subsection*{Private Attributes}
83\begin{CompactItemize}
84\item
85vector$<$ {\bf Ali\-HLTData\-Segment} $>$ {\bf f\-Segments}
86\item
87vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ {\bf f\-Consumers}
88\item
89vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ {\bf f\-Active\-Consumers}
90\item
91vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ {\bf f\-Released\-Consumers}
92\item
93{\bf Ali\-HLTRaw\-Buffer} $\ast$ {\bf fp\-Buffer}
94\item
95{\bf Ali\-HLTUInt32\_\-t} {\bf f\-Flags}
96\begin{CompactList}\small\item\em transient \item\end{CompactList}\end{CompactItemize}
97\subsection*{Static Private Attributes}
98\begin{CompactItemize}
99\item
100int {\bf fg\-Nof\-Instances} = 0
101\item
102vector$<$ {\bf Ali\-HLTRaw\-Buffer} $\ast$ $>$ {\bf fg\-Free\-Buffers}
103\item
104vector$<$ {\bf Ali\-HLTRaw\-Buffer} $\ast$ $>$ {\bf fg\-Active\-Buffers}
105\item
106{\bf Ali\-HLTUInt32\_\-t} {\bf fg\-Margin} = 1024
107\item
108{\bf Ali\-HLTLogging} {\bf fg\-Logging}
109\item
110const Int\_\-t {\bf fgk\-Safety\-Pattern\-Size} = 16
111\item
112const char {\bf fgk\-Safety\-Pattern} [$\,$] = \{0x28, 0x63, 0x29, 0x4d, 0x52, 0x49, 0x43, 0x48, 0x54, 0x45, 0x52, 0x20, 0x32, 0x30, 0x30, 0x37\}
113\end{CompactItemize}
114
115
116\subsection{Constructor \& Destructor Documentation}
117\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!AliHLTDataBuffer@{AliHLTDataBuffer}}
118\index{AliHLTDataBuffer@{AliHLTDataBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
119\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Ali\-HLTData\-Buffer::Ali\-HLTData\-Buffer ()}\label{classAliHLTDataBuffer_a0}
120
121
122\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!AliHLTDataBuffer@{AliHLTDataBuffer}}
123\index{AliHLTDataBuffer@{AliHLTDataBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
124\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Ali\-HLTData\-Buffer::Ali\-HLTData\-Buffer (const {\bf Ali\-HLTData\-Buffer} \&)}\label{classAliHLTDataBuffer_a1}
125
126
127not a valid copy constructor, defined according to effective C++ style
128
129Definition at line 59 of file Ali\-HLTData\-Buffer.cxx.
130
131References HLTFatal.
132
133\footnotesize\begin{verbatim}60 :
13461 TObject(),
13562 AliHLTLogging(),
13663 fSegments(),
13764 fConsumers(),
13865 fActiveConsumers(),
13966 fReleasedConsumers(),
14067 fpBuffer(NULL),
14168 fFlags(0)
14269 {
14370 // see header file for function documentation
14471 HLTFatal("copy constructor untested");
14572 }
146
147\end{verbatim}\normalsize
148
149
150\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!~AliHLTDataBuffer@{$\sim$AliHLTDataBuffer}}
151\index{~AliHLTDataBuffer@{$\sim$AliHLTDataBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
152\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Ali\-HLTData\-Buffer::$\sim${\bf Ali\-HLTData\-Buffer} ()\hspace{0.3cm}{\tt [virtual]}}\label{classAliHLTDataBuffer_a3}
153
154
155destructor
156
157Definition at line 89 of file Ali\-HLTData\-Buffer.cxx.
158
159References Cleanup\-Consumer\-List(), Delete\-Raw\-Buffers(), and fg\-Nof\-Instances.
160
161\footnotesize\begin{verbatim}90 {
16291 // see header file for function documentation
16392 if (--fgNofInstances<=0) {
16493 DeleteRawBuffers();
16594 }
16695 CleanupConsumerList();
16796 }
168\end{verbatim}\normalsize
169
170
171
172
173\subsection{Member Function Documentation}
174\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!ChangeConsumerState@{ChangeConsumerState}}
175\index{ChangeConsumerState@{ChangeConsumerState}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
176\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Change\-Consumer\-State ({\bf Ali\-HLTConsumer\-Descriptor} $\ast$ {\em p\-Desc}, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \& {\em src\-List}, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \& {\em tgt\-List})\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_d3}
177
178
179Change the state of a consumer. The state of a consumer is determined by the list it is strored in, the method moves a consumer from the source to the target list. \begin{Desc}
180\item[Parameters:]
181\begin{description}
182\item[{\em p\-Desc}]pointer to consumer descriptor \item[{\em src\-List}]list where the consumer is currently to be found \item[{\em tgt\-List}]list where to move the consumer \end{description}
183\end{Desc}
184
185
186Definition at line 526 of file Ali\-HLTData\-Buffer.cxx.
187
188References HLTError.
189
190Referenced by Release(), and Subscribe().
191
192\footnotesize\begin{verbatim}527 {
193528 // see header file for function documentation
194529 int iResult=-ENOENT;
195530 if (pDesc) {
196531 vector<AliHLTConsumerDescriptor*>::iterator desc=srcList.begin();
197532 while (desc!=srcList.end()) {
198533 if ((*desc)==pDesc) {
199534 srcList.erase(desc);
200535 tgtList.push_back(pDesc);
201536 iResult=0;
202537 break;
203538 }
204539 desc++;
205540 }
206541 if (iResult<0) {
207542 HLTError("can not find consumer descriptor %p in list", pDesc);
208543 }
209544 } else {
210545 HLTError("invalid parameter");
211546 iResult=-EINVAL;
212547 }
213548 return iResult;
214549 }
215\end{verbatim}\normalsize
216
217
218\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!CleanupConsumerList@{CleanupConsumerList}}
219\index{CleanupConsumerList@{CleanupConsumerList}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
220\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Cleanup\-Consumer\-List ()\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_d4}
221
222
223Cleanup a consumer list. Release all allocated data structures. {\bf Note:} Not the component itself!
224
225Definition at line 551 of file Ali\-HLTData\-Buffer.cxx.
226
227References f\-Consumers, and Reset\-Data\-Buffer().
228
229Referenced by $\sim$Ali\-HLTData\-Buffer().
230
231\footnotesize\begin{verbatim}552 {
232553 // see header file for function documentation
233554 int iResult=0;
234555 ResetDataBuffer();
235556 vector<AliHLTConsumerDescriptor*>::iterator desc=fConsumers.begin();
236557 while (desc!=fConsumers.end()) {
237558 delete *desc;
238559 fConsumers.erase(desc);
239560 desc=fConsumers.begin();
240561 }
241562 return iResult;
242563 }
243\end{verbatim}\normalsize
244
245
246\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!CreateRawBuffer@{CreateRawBuffer}}
247\index{CreateRawBuffer@{CreateRawBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
248\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer} $\ast$ Ali\-HLTData\-Buffer::Create\-Raw\-Buffer ({\bf Ali\-HLTUInt32\_\-t} {\em size})\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_h0}
249
250
251Create a raw buffer of a certain size. The function tries to find a buffer of the given size (or a bit bigger by a certain margin {\bf fg\-Margin}{\rm (p.\,\pageref{classAliHLTDataBuffer_v3})}) from the list of free buffers. If no buffer is available, a new one is created and added to the buffer handling. \begin{Desc}
252\item[Parameters:]
253\begin{description}
254\item[{\em size}]min. size of the requested buffer \end{description}
255\end{Desc}
256\begin{Desc}
257\item[Returns:]pointer to raw buffer \end{Desc}
258
259
260Definition at line 348 of file Ali\-HLTData\-Buffer.cxx.
261
262References fg\-Active\-Buffers, fg\-Free\-Buffers, fgk\-Safety\-Pattern, fg\-Logging, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Ptr, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Size, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Total\-Size, k\-HLTLog\-Debug, k\-HLTLog\-Error, and Ali\-HLTLogging::Logging().
263
264Referenced by Get\-Target\-Buffer().
265
266\footnotesize\begin{verbatim}349 {
267350 // see header file for function documentation
268351 AliHLTRawBuffer* pRawBuffer=NULL;
269352 unsigned int reqSize=size+fgkSafetyPatternSize;
270353 vector<AliHLTRawBuffer*>::iterator buffer=fgFreeBuffers.begin();
271354 while (buffer!=fgFreeBuffers.end() && pRawBuffer==NULL) {
272355 if ((*buffer)->fTotalSize>=reqSize && ((*buffer)->fTotalSize-reqSize)<fgMargin) {
273356 // assign this element
274357 pRawBuffer=*buffer;
275358 pRawBuffer->fSize=size;
276359 fgFreeBuffers.erase(buffer);
277360 fgLogging.Logging(kHLTLogDebug, "AliHLTDataBuffer::CreateRawBuffer", "data buffer handling", "raw buffer container %p provided for request of %d bytes (total %d available in buffer %p)", pRawBuffer, size, pRawBuffer->fTotalSize, pRawBuffer->fPtr);
278361 fgActiveBuffers.push_back(pRawBuffer);
279362 break;
280363 }
281364 buffer++;
282365 }
283366 if (pRawBuffer==NULL) {
284367 // no buffer found, create a new one
285368 pRawBuffer=new AliHLTRawBuffer;
286369 if (pRawBuffer) {
287370 pRawBuffer->fPtr=malloc(reqSize);
288371 if (pRawBuffer->fPtr) {
289372 pRawBuffer->fSize=size;
290373 pRawBuffer->fTotalSize=reqSize;
291374 fgActiveBuffers.push_back(pRawBuffer);
292375 fgLogging.Logging(kHLTLogDebug, "AliHLTDataBuffer::CreateRawBuffer", "data buffer handling", "new raw buffer %p of size %d created (container %p)", pRawBuffer->fPtr, pRawBuffer->fTotalSize, pRawBuffer);
293376 if (fgkSafetyPatternSize>0) {
294377 memcpy(((char*)pRawBuffer->fPtr)+pRawBuffer->fSize, fgkSafetyPattern, fgkSafetyPatternSize);
295378 }
296379 } else {
297380 delete pRawBuffer;
298381 pRawBuffer=NULL;
299382 fgLogging.Logging(kHLTLogError, "AliHLTDataBuffer::CreateRawBuffer", "data buffer handling", "memory allocation failed");
300383 }
301384 } else {
302385 fgLogging.Logging(kHLTLogError, "AliHLTDataBuffer::CreateRawBuffer", "data buffer handling", "memory allocation failed");
303386 }
304387 }
305388 return pRawBuffer;
306389 }
307\end{verbatim}\normalsize
308
309
310\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!DeleteRawBuffers@{DeleteRawBuffers}}
311\index{DeleteRawBuffers@{DeleteRawBuffers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
312\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Delete\-Raw\-Buffers ()\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_h2}
313
314
315Deletes all the raw buffers. When the last Data Buffer object is destructed, all raw data buffers are relesed.
316
317Definition at line 421 of file Ali\-HLTData\-Buffer.cxx.
318
319References fg\-Active\-Buffers, fg\-Free\-Buffers, fg\-Logging, k\-HLTLog\-Warning, and Ali\-HLTLogging::Logging().
320
321Referenced by $\sim$Ali\-HLTData\-Buffer().
322
323\footnotesize\begin{verbatim}422 {
324423 // see header file for function documentation
325424 int iResult=0;
326425 vector<AliHLTRawBuffer*>::iterator buffer=fgFreeBuffers.begin();
327426 while (buffer!=fgFreeBuffers.end()) {
328427 free((*buffer)->fPtr);
329428 delete *buffer;
330429 fgFreeBuffers.erase(buffer);
331430 buffer=fgFreeBuffers.begin();
332431 }
333432 buffer=fgActiveBuffers.begin();
334433 while (buffer!=fgActiveBuffers.end()) {
335434 fgLogging.Logging(kHLTLogWarning, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "request to delete active raw buffer container (raw buffer %p, size %d)", (*buffer)->fPtr, (*buffer)->fTotalSize);
336435 free((*buffer)->fPtr);
337436 delete *buffer;
338437 fgActiveBuffers.erase(buffer);
339438 buffer=fgActiveBuffers.begin();
340439 }
341440 return iResult;
342441 }
343\end{verbatim}\normalsize
344
345
346\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!FindConsumer@{FindConsumer}}
347\index{FindConsumer@{FindConsumer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
348\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTConsumer\-Descriptor} $\ast$ Ali\-HLTData\-Buffer::Find\-Consumer (const {\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer}, vector$<$ {\bf Ali\-HLTConsumer\-Descriptor} $\ast$ $>$ \& {\em list}) const\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_d2}
349
350
351transient///////////////////////////////////////////////////////////////////////////
352
353Find the consumer descriptor for a certain component and data type in a list of consumers.\par
354 {\bf Note:} There are three lists which contain the consumers in the different states. \begin{Desc}
355\item[Parameters:]
356\begin{description}
357\item[{\em p\-Consumer}]pointer to consumer component \item[{\em list}]list where to search for the consumer \end{description}
358\end{Desc}
359
360
361Definition at line 443 of file Ali\-HLTData\-Buffer.cxx.
362
363\footnotesize\begin{verbatim}444 {
364445 // see header file for function documentation
365446 AliHLTConsumerDescriptor* pDesc=NULL;
366447 vector<AliHLTConsumerDescriptor*>::iterator desc=list.begin();
367448 while (desc!=list.end() && pDesc==NULL) {
368449 if ((pConsumer==NULL || (*desc)->GetComponent()==pConsumer)) {
369450 pDesc=*desc;
370451 }
371452 desc++;
372453 }
373454 return pDesc;
374455 }
375\end{verbatim}\normalsize
376
377
378\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!FindConsumer@{FindConsumer}}
379\index{FindConsumer@{FindConsumer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
380\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Find\-Consumer ({\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer}, int {\em b\-All\-Lists} = {\tt 1})}\label{classAliHLTDataBuffer_a14}
381
382
383Check if a consumer is already in the list \begin{Desc}
384\item[Parameters:]
385\begin{description}
386\item[{\em p\-Consumer}]pointer to consumer component \item[{\em b\-All\-Lists}]search in all lists if 1 search only in f\-Consumer list if 0 \end{description}
387\end{Desc}
388\begin{Desc}
389\item[Returns:]1 if found, 0 if not \end{Desc}
390
391
392Definition at line 565 of file Ali\-HLTData\-Buffer.cxx.
393
394References f\-Active\-Consumers, f\-Consumers, and f\-Released\-Consumers.
395
396Referenced by Release(), Set\-Consumer(), and Subscribe().
397
398\footnotesize\begin{verbatim}566 {
399567 // see header file for function documentation
400568 vector<AliHLTConsumerDescriptor*>::iterator desc=fConsumers.begin();
401569 while (desc!=fConsumers.end()) {
402570 if ((*desc)->GetComponent()==pConsumer)
403571 return 1;
404572 desc++;
405573 }
406574 if (bAllLists==0) return 0;
407575
408576 desc=fActiveConsumers.begin();
409577 while (desc!=fActiveConsumers.end()) {
410578 if ((*desc)->GetComponent()==pConsumer)
411579 return 1;
412580 desc++;
413581 }
414582 desc=fReleasedConsumers.begin();
415583 while (desc!=fReleasedConsumers.end()) {
416584 if ((*desc)->GetComponent()==pConsumer)
417585 return 1;
418586 desc++;
419587 }
420588 return 0;
421589 }
422\end{verbatim}\normalsize
423
424
425\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!FindMatchingDataBlocks@{FindMatchingDataBlocks}}
426\index{FindMatchingDataBlocks@{FindMatchingDataBlocks}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
427\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Find\-Matching\-Data\-Blocks (const {\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer}, vector$<$ {\bf Ali\-HLTComponent\-Data\-Type} $>$ $\ast$ {\em tgt\-List} = {\tt NULL})}\label{classAliHLTDataBuffer_a5}
428
429
430Determine the number of matching data blocks for the component and a consumer component. \par
431 The first approach will support only one output data type for processing components. \begin{Desc}
432\item[Parameters:]
433\begin{description}
434\item[{\em p\-Consumer}]the component which subscribes to the buffer \item[{\em tgt\-List}](optional) the list to receive the data types \end{description}
435\end{Desc}
436\begin{Desc}
437\item[Returns:]: number of data blocks which match the input data types of the consumer, neg. error code if failed \par
438 -EINVAL invalid parameter \par
439 \end{Desc}
440
441
442Definition at line 121 of file Ali\-HLTData\-Buffer.cxx.
443
444References Find\-Matching\-Data\-Segments().
445
446Referenced by Ali\-HLTTask::Get\-Nof\-Matching\-Data\-Blocks().
447
448\footnotesize\begin{verbatim}122 {
449123 // see header file for function documentation
450124 int iResult=0;
451125 if (pConsumer) {
452126 vector<AliHLTDataBuffer::AliHLTDataSegment> segments;
453127 if ((iResult=FindMatchingDataSegments(pConsumer, segments))>=0) {
454128 if (tgtList) {
455129 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator segment=segments.begin();
456130 while (segment!=segments.end()) {
457131 tgtList->push_back((*segment).fDataType);
458132 segment++;
459133 }
460134 }
461135 iResult=segments.size();
462136 }
463137 } else {
464138 iResult=-EINVAL;
465139 }
466140 return iResult;
467141 }
468\end{verbatim}\normalsize
469
470
471\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!FindMatchingDataSegments@{FindMatchingDataSegments}}
472\index{FindMatchingDataSegments@{FindMatchingDataSegments}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
473\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Find\-Matching\-Data\-Segments (const {\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer}, vector$<$ {\bf Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment} $>$ \& {\em tgt\-List})\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_d0}
474
475
476Find those data segments which match the input types of a component. \begin{Desc}
477\item[Parameters:]
478\begin{description}
479\item[{\em p\-Consumer}]the component which subscribes to the buffer \item[{\em tgt\-List}]the list to receive the data segment descriptors \end{description}
480\end{Desc}
481\begin{Desc}
482\item[Returns:]: number of data blocks which match the input data types of the consumer, neg. error code if failed \par
483 -EINVAL invalid parameter \par
484 \end{Desc}
485
486
487Definition at line 143 of file Ali\-HLTData\-Buffer.cxx.
488
489References f\-Segments.
490
491Referenced by Find\-Matching\-Data\-Blocks(), and Subscribe().
492
493\footnotesize\begin{verbatim}144 {
494145 // see header file for function documentation
495146 int iResult=0;
496147 if (pConsumer) {
497148 vector<AliHLTComponentDataType> dtlist;
498149 ((AliHLTComponent*)pConsumer)->GetInputDataTypes(dtlist);
499150 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator segment=fSegments.begin();
500151 while (segment!=fSegments.end()) {
501152 vector<AliHLTComponentDataType>::iterator type=dtlist.begin();
502153 while (type!=dtlist.end()) {
503154 if ((*segment).fDataType==(*type) ||
504155 (*type)==kAliHLTAnyDataType) {
505156 tgtList.push_back(*segment);
506157 iResult++;
507158 break;
508159 }
509160 type++;
510161 }
511162 segment++;
512163 }
513164 } else {
514165 iResult=-EINVAL;
515166 }
516167 return iResult;
517168 }
518\end{verbatim}\normalsize
519
520
521\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!GetNofActiveConsumers@{GetNofActiveConsumers}}
522\index{GetNofActiveConsumers@{GetNofActiveConsumers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
523\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Get\-Nof\-Active\-Consumers ()}\label{classAliHLTDataBuffer_a13}
524
525
526Get the number of active consumers \begin{Desc}
527\item[Returns:]number of active consumers \end{Desc}
528
529
530Definition at line 341 of file Ali\-HLTData\-Buffer.cxx.
531
532References f\-Active\-Consumers.
533
534Referenced by Get\-Nof\-Consumers(), and Release().
535
536\footnotesize\begin{verbatim}342 {
537343 // see header file for function documentation
538344 int iResult=fActiveConsumers.size();
539345 return iResult;
540346 }
541\end{verbatim}\normalsize
542
543
544\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!GetNofConsumers@{GetNofConsumers}}
545\index{GetNofConsumers@{GetNofConsumers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
546\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Get\-Nof\-Consumers ()}\label{classAliHLTDataBuffer_a12}
547
548
549Get the number of consumers \begin{Desc}
550\item[Returns:]number of consumers \end{Desc}
551
552
553Definition at line 334 of file Ali\-HLTData\-Buffer.cxx.
554
555References f\-Consumers, f\-Released\-Consumers, and Get\-Nof\-Active\-Consumers().
556
557\footnotesize\begin{verbatim}335 {
558336 // see header file for function documentation
559337 int iResult=fConsumers.size() + GetNofActiveConsumers() + fReleasedConsumers.size();
560338 return iResult;
561339 }
562\end{verbatim}\normalsize
563
564
565\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!GetNofSegments@{GetNofSegments}}
566\index{GetNofSegments@{GetNofSegments}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
567\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Get\-Nof\-Segments ()}\label{classAliHLTDataBuffer_a11}
568
569
570Get the number of segments \begin{Desc}
571\item[Returns:]number of segments \end{Desc}
572
573
574Definition at line 327 of file Ali\-HLTData\-Buffer.cxx.
575
576References f\-Segments.
577
578Referenced by Is\-Empty().
579
580\footnotesize\begin{verbatim}328 {
581329 // see header file for function documentation
582330 int iResult=fSegments.size();
583331 return iResult;
584332 }
585\end{verbatim}\normalsize
586
587
588\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!GetTargetBuffer@{GetTargetBuffer}}
589\index{GetTargetBuffer@{GetTargetBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
590\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTUInt8\_\-t} $\ast$ Ali\-HLTData\-Buffer::Get\-Target\-Buffer (int {\em i\-Min\-Size})}\label{classAliHLTDataBuffer_a8}
591
592
593Get a target buffer of minimum size i\-Min\-Size. The method is used by the component which owns the Data Buffer to allocate a buffer for the data it is going to produce. \begin{Desc}
594\item[Parameters:]
595\begin{description}
596\item[{\em i\-Min\-Size}]minumum size of the requested buffer \end{description}
597\end{Desc}
598\begin{Desc}
599\item[Returns:]: pointer to target buffer if \end{Desc}
600
601
602Definition at line 270 of file Ali\-HLTData\-Buffer.cxx.
603
604References Ali\-HLTUInt8\_\-t, Create\-Raw\-Buffer(), fp\-Buffer, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Ptr, and HLTError.
605
606Referenced by Ali\-HLTTask::Process\-Task().
607
608\footnotesize\begin{verbatim}271 {
609272 // see header file for function documentation
610273 AliHLTUInt8_t* pTargetBuffer=NULL;
611274 fpBuffer=CreateRawBuffer(iMinSize);
612275 if (fpBuffer) {
613276 pTargetBuffer=(AliHLTUInt8_t*)fpBuffer->fPtr;
614277 } else {
615278 HLTError("can not create raw buffer");
616279 }
617280 return pTargetBuffer;
618281 }
619\end{verbatim}\normalsize
620
621
622\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!IsEmpty@{IsEmpty}}
623\index{IsEmpty@{IsEmpty}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
624\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Is\-Empty ()}\label{classAliHLTDataBuffer_a10}
625
626
627Check if the data buffer is empty. \begin{Desc}
628\item[Returns:]1 if empty, 0 if not \end{Desc}
629
630
631Definition at line 320 of file Ali\-HLTData\-Buffer.cxx.
632
633References fp\-Buffer, and Get\-Nof\-Segments().
634
635\footnotesize\begin{verbatim}321 {
636322 // see header file for function documentation
637323 int iResult=fpBuffer==NULL || GetNofSegments()==0;
638324 return iResult;
639325 }
640\end{verbatim}\normalsize
641
642
643\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!operator=@{operator=}}
644\index{operator=@{operator=}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
645\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTData\-Buffer} \& Ali\-HLTData\-Buffer::operator= (const {\bf Ali\-HLTData\-Buffer} \&)}\label{classAliHLTDataBuffer_a2}
646
647
648not a valid assignment op, but defined according to effective C++ style
649
650Definition at line 74 of file Ali\-HLTData\-Buffer.cxx.
651
652References HLTFatal.
653
654\footnotesize\begin{verbatim}75 {
65576 // see header file for function documentation
65677 HLTFatal("assignment operator untested");
65778 return *this;
65879 }
659\end{verbatim}\normalsize
660
661
662\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!Release@{Release}}
663\index{Release@{Release}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
664\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Release ({\bf Ali\-HLTComponent\-Block\-Data} $\ast$ {\em p\-Block\-Desc}, const {\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer})}\label{classAliHLTDataBuffer_a7}
665
666
667Release an instance of the data buffer. Resets the variables of the block descriptor. If all buffer segments are released, the Data Buffer is reseted and the Raw Buffer released.\par
668 The method is used by the consumer component. \begin{Desc}
669\item[Parameters:]
670\begin{description}
671\item[{\em p\-Block\-Desc}]descriptor of the data segment \item[{\em p\-Consumer}]the component which subscribes to the buffer \end{description}
672\end{Desc}
673\begin{Desc}
674\item[Returns:]: $>$0 if success, negative error code if failed \par
675 -EACCESS the consumer state can not be changed (de-activated) -ENOENT consumer has not subscribed to the buffer \par
676 -EINVAL invalid parameter \par
677 \end{Desc}
678
679
680Definition at line 231 of file Ali\-HLTData\-Buffer.cxx.
681
682References Change\-Consumer\-State(), Ali\-HLTConsumer\-Descriptor::Check\-Active\-Data\-Segment(), f\-Active\-Consumers, Find\-Consumer(), Ali\-HLTComponent\-Block\-Data::f\-Offset, Ali\-HLTComponent\-Block\-Data::f\-Ptr, f\-Released\-Consumers, Ali\-HLTComponent\-Block\-Data::f\-Size, Get\-Nof\-Active\-Consumers(), Ali\-HLTConsumer\-Descriptor::Get\-Nof\-Active\-Segments(), HLTError, HLTWarning, Ali\-HLTConsumer\-Descriptor::Release\-Active\-Data\-Segment(), and Reset\-Data\-Buffer().
683
684Referenced by Ali\-HLTTask::Release().
685
686\footnotesize\begin{verbatim}232 {
687233 // see header file for function documentation
688234 int iResult=0;
689235 if (pBlockDesc && pConsumer) {
690236 AliHLTConsumerDescriptor* pDesc=FindConsumer(pConsumer, fActiveConsumers);
691237 if (pDesc) {
692238 if ((iResult=pDesc->CheckActiveDataSegment(pBlockDesc->fOffset, pBlockDesc->fSize))!=1) {
693239 HLTWarning("data segment missmatch, component %p has not subscribed to a segment with offset %#x and size %d", pConsumer, pBlockDesc->fOffset, pBlockDesc->fSize);
694240 // TODO: appropriate error handling, but so far optional
695241 iResult=0;
696242 } else {
697243 pDesc->ReleaseActiveDataSegment(pBlockDesc->fOffset, pBlockDesc->fSize);
698244 pBlockDesc->fOffset=0;
699245 pBlockDesc->fPtr=NULL;
700246 pBlockDesc->fSize=0;
701247 }
702248 if (pDesc->GetNofActiveSegments()==0) {
703249 if ((iResult=ChangeConsumerState(pDesc, fActiveConsumers, fReleasedConsumers))>=0) {
704250 if (GetNofActiveConsumers()==0) {
705251 // this is the last consumer, reset the consumer list and release the raw buffer
706252 ResetDataBuffer();
707253 }
708254 } else {
709255 HLTError("can not deactivate consumer %p for data buffer %p", pConsumer, this);
710256 iResult=-EACCES;
711257 }
712258 }
713259 } else {
714260 HLTWarning("component %p has currently not subscribed to the data buffer %p", pConsumer, this);
715261 iResult=-ENOENT;
716262 }
717263 } else {
718264 HLTError("inavalid parameter: pBlockDesc=%p pConsumer=%p", pBlockDesc, pConsumer);
719265 iResult=-EINVAL;
720266 }
721267 return iResult;
722268 }
723\end{verbatim}\normalsize
724
725
726\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!ReleaseRawBuffer@{ReleaseRawBuffer}}
727\index{ReleaseRawBuffer@{ReleaseRawBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
728\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Release\-Raw\-Buffer ({\bf Ali\-HLTRaw\-Buffer} $\ast$ {\em p\-Buffer})\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_h1}
729
730
731Mark a buffer as free. After the Data Buffer has finnished using the raw buffer, it is released and added to the list of available buffers. \begin{Desc}
732\item[Parameters:]
733\begin{description}
734\item[{\em p\-Buffer}]the raw buffer to release \end{description}
735\end{Desc}
736\begin{Desc}
737\item[Returns:]$>$=0 if succeeded, neg. error code if failed \end{Desc}
738
739
740Definition at line 391 of file Ali\-HLTData\-Buffer.cxx.
741
742References fg\-Active\-Buffers, fg\-Free\-Buffers, fgk\-Safety\-Pattern, fgk\-Safety\-Pattern\-Size, fg\-Logging, k\-HLTLog\-Error, k\-HLTLog\-Fatal, k\-HLTLog\-Warning, and Ali\-HLTLogging::Logging().
743
744Referenced by Reset\-Data\-Buffer().
745
746\footnotesize\begin{verbatim}392 {
747393 // see header file for function documentation
748394 int iResult=0;
749395 if (pBuffer) {
750396 vector<AliHLTRawBuffer*>::iterator buffer=fgActiveBuffers.begin();
751397 while (buffer!=fgActiveBuffers.end() && (*buffer)!=pBuffer) {
752398 buffer++;
753399 }
754400 if (buffer!=fgActiveBuffers.end()) {
755401 if (fgkSafetyPatternSize>0) {
756402 if (memcmp(((char*)(*buffer)->fPtr)+(*buffer)->fSize, fgkSafetyPattern, fgkSafetyPatternSize)!=0) {
757403 fgLogging.Logging(kHLTLogFatal, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "component has written beyond end of data buffer %p size %d", (*buffer)->fPtr, (*buffer)->fSize);
758404 }
759405 }
760406 (*buffer)->fSize=0;
761407 fgFreeBuffers.push_back(*buffer);
762408 fgActiveBuffers.erase(buffer);
763409 } else {
764410 fgLogging.Logging(kHLTLogWarning, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "can not find raw buffer container %p in the list of active containers", pBuffer);
765411 iResult=-ENOENT;
766412 }
767413 } else {
768414 fgLogging.Logging(kHLTLogError, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "invalid parameter");
769415 iResult=-EINVAL;
770416 }
771417 return iResult;
772418 }
773\end{verbatim}\normalsize
774
775
776\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!Reset@{Reset}}
777\index{Reset@{Reset}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
778\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Reset ()}\label{classAliHLTDataBuffer_a15}
779
780
781Public method to reset the buffer. Eventually with some additional checks. In normal operation, an external reset should not be necessary.
782
783Definition at line 495 of file Ali\-HLTData\-Buffer.cxx.
784
785References Reset\-Data\-Buffer().
786
787Referenced by Ali\-HLTTask::Process\-Task().
788
789\footnotesize\begin{verbatim}496 {
790497 // see header file for function documentation
791498 return ResetDataBuffer();
792499 }
793\end{verbatim}\normalsize
794
795
796\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!ResetDataBuffer@{ResetDataBuffer}}
797\index{ResetDataBuffer@{ResetDataBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
798\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Reset\-Data\-Buffer ()\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_d1}
799
800
801Reset the data buffer. Removes all consumers back to the {\bf f\-Consumers}{\rm (p.\,\pageref{classAliHLTDataBuffer_r1})} list, deletes segments and releases the Raw Buffer.
802
803Definition at line 457 of file Ali\-HLTData\-Buffer.cxx.
804
805References f\-Active\-Consumers, f\-Consumers, fp\-Buffer, f\-Released\-Consumers, f\-Segments, HLTWarning, and Release\-Raw\-Buffer().
806
807Referenced by Cleanup\-Consumer\-List(), Release(), and Reset().
808
809\footnotesize\begin{verbatim}458 {
810459 // see header file for function documentation
811460 int iResult=0;
812461 AliHLTRawBuffer* pBuffer=fpBuffer;
813462 fpBuffer=NULL;
814463
815464 // cleanup consumer states
816465 vector<AliHLTConsumerDescriptor*>::iterator desc=fReleasedConsumers.begin();
817466 while (desc!=fReleasedConsumers.end()) {
818467 AliHLTConsumerDescriptor* pDesc=*desc;
819468 fReleasedConsumers.erase(desc);
820469 desc=fReleasedConsumers.begin();
821470 fConsumers.push_back(pDesc);
822471 }
823472 desc=fActiveConsumers.begin();
824473 while (desc!=fActiveConsumers.end()) {
825474 AliHLTConsumerDescriptor* pDesc=*desc;
826475 HLTWarning("consumer %p was not released", pDesc);
827476 fActiveConsumers.erase(desc);
828477 desc=fActiveConsumers.begin();
829478 fConsumers.push_back(pDesc);
830479 }
831480
832481 // cleanup segments
833482 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator segment=fSegments.begin();
834483 while (segment!=fSegments.end()) {
835484 fSegments.erase(segment);
836485 segment=fSegments.begin();
837486 }
838487
839488 // cleanup raw buffer
840489 if (pBuffer) {
841490 ReleaseRawBuffer(pBuffer);
842491 }
843492 return iResult;
844493 }
845\end{verbatim}\normalsize
846
847
848\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!SetConsumer@{SetConsumer}}
849\index{SetConsumer@{SetConsumer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
850\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Set\-Consumer ({\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer})}\label{classAliHLTDataBuffer_a4}
851
852
853Add component to the list of consumers \begin{Desc}
854\item[Parameters:]
855\begin{description}
856\item[{\em p\-Consumer}]- a consumer of type {\bf Ali\-HLTComponent}{\rm (p.\,\pageref{classAliHLTComponent})} \end{description}
857\end{Desc}
858
859
860Definition at line 98 of file Ali\-HLTData\-Buffer.cxx.
861
862References f\-Consumers, Find\-Consumer(), Ali\-HLTComponent::Get\-Component\-ID(), HLTDebug, HLTError, and HLTWarning.
863
864Referenced by Ali\-HLTTask::Start\-Run().
865
866\footnotesize\begin{verbatim}99 {
867100 // see header file for function documentation
868101 int iResult=0;
869102 if (pConsumer) {
870103 if (FindConsumer(pConsumer)) {
871104 HLTWarning("consumer %s (%p) already set to data buffer %p", pConsumer->GetComponentID(), pConsumer, this);
872105 }
873106 AliHLTConsumerDescriptor* pDesc=new AliHLTConsumerDescriptor(pConsumer);
874107 if (pDesc) {
875108 fConsumers.push_back(pDesc);
876109 HLTDebug("set consumer %s (%p) to data buffer %p", pConsumer->GetComponentID(), pConsumer, this);
877110 } else {
878111 HLTError("memory allocation failed");
879112 iResult=-ENOMEM;
880113 }
881114 } else {
882115 HLTError("invalid parameter: consumer component (nil)");
883116 iResult=-EINVAL;
884117 }
885118 return iResult;
886119 }
887\end{verbatim}\normalsize
888
889
890\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!SetSegments@{SetSegments}}
891\index{SetSegments@{SetSegments}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
892\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Set\-Segments ({\bf Ali\-HLTUInt8\_\-t} $\ast$ {\em p\-Tgt}, {\bf Ali\-HLTComponent\-Block\-Data} $\ast$ {\em array\-Segments}, int {\em i\-Size})}\label{classAliHLTDataBuffer_a9}
893
894
895Set the segments for the data buffer. This is usually done after the component has written the data to the buffer, which was requested by the {\bf Get\-Target\-Buffer}{\rm (p.\,\pageref{classAliHLTDataBuffer_a8})} method. The component might produce different types of data, for each type a segment has to be defined which describes the data inside the buffer.\par
896 The {\bf Ali\-HLTComponent\-Block\-Data}{\rm (p.\,\pageref{structAliHLTComponentBlockData})} segment descriptor comes directly from the {\bf Ali\-HLTComponent::Process\-Event}{\rm (p.\,\pageref{classAliHLTComponent_a6})} method. \begin{Desc}
897\item[Parameters:]
898\begin{description}
899\item[{\em p\-Tgt}]the target buffer which the segments refer to \item[{\em array\-Segments}]the output block descriptors of the component \item[{\em i\-Size}]size of the array \end{description}
900\end{Desc}
901
902
903Definition at line 283 of file Ali\-HLTData\-Buffer.cxx.
904
905References Ali\-HLTComponent\-Block\-Data::f\-Data\-Type, Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment::f\-Data\-Type, Ali\-HLTComponent\-Block\-Data::f\-Offset, fp\-Buffer, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Ptr, Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment::f\-Segment\-Offset, f\-Segments, Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment::f\-Segment\-Size, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Size, Ali\-HLTComponent\-Block\-Data::f\-Size, Ali\-HLTComponent\-Block\-Data::f\-Specification, Ali\-HLTData\-Buffer::Ali\-HLTData\-Segment::f\-Specification, HLTDebug, HLTError, and HLTFatal.
906
907Referenced by Ali\-HLTTask::Process\-Task().
908
909\footnotesize\begin{verbatim}284 {
910285 // see header file for function documentation
911286 int iResult=0;
912287 if (pTgt && arrayBlockData && iSize>=0) {
913288 if (fpBuffer) {
914289 if (fpBuffer->fPtr==(void*)pTgt) {
915290 AliHLTDataBuffer::AliHLTDataSegment segment;
916291 for (int i=0; i<iSize; i++) {
917292 if (arrayBlockData[i].fOffset+arrayBlockData[i].fSize<=fpBuffer->fSize) {
918293 segment.fSegmentOffset=arrayBlockData[i].fOffset;
919294 segment.fSegmentSize=arrayBlockData[i].fSize;
920295 segment.fDataType=arrayBlockData[i].fDataType;
921296 segment.fSpecification=arrayBlockData[i].fSpecification;
922297 fSegments.push_back(segment);
923298 HLTDebug("set segment %s with size %d at offset %d", AliHLTComponent::DataType2Text(segment.fDataType).data(), segment.fSegmentSize, segment.fSegmentOffset);
924299 } else {
925300 HLTError("block data specification %#d (%s) exceeds size of data buffer", i, AliHLTComponent::DataType2Text(arrayBlockData[i].fDataType).data());
926301 HLTError("block offset=%d, block size=%d, buffer size=%d", arrayBlockData[i].fOffset, arrayBlockData[i].fSize, fpBuffer->fSize);
927302 iResult=-E2BIG;
928303 }
929304 }
930305 } else {
931306 HLTError("this data buffer (%p) does not match the internal data buffer %p of raw buffer %p", pTgt, fpBuffer->fPtr, fpBuffer);
932307 iResult=-EINVAL;
933308 }
934309 } else {
935310 HLTFatal("internal data structur missmatch");
936311 iResult=-EFAULT;
937312 }
938313 } else {
939314 HLTError("invalid parameter: pTgtBuffer=%p arrayBlockData=%p", pTgt, arrayBlockData);
940315 iResult=-EINVAL;
941316 }
942317 return iResult;
943318 }
944\end{verbatim}\normalsize
945
946
947\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!Subscribe@{Subscribe}}
948\index{Subscribe@{Subscribe}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
949\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Ali\-HLTData\-Buffer::Subscribe (const {\bf Ali\-HLTComponent} $\ast$ {\em p\-Consumer}, {\bf Ali\-HLTComponent\-Block\-Data} $\ast$ {\em array\-Block\-Desc}, int {\em i\-Array\-Size})}\label{classAliHLTDataBuffer_a6}
950
951
952Subscribe to a segment of the data buffer. The function prepares the block descriptor for subsequent use with the {\bf Ali\-HLTComponent::Process\-Event}{\rm (p.\,\pageref{classAliHLTComponent_a6})} method, the method can prepare several block descriptors up to the array size specified by i\-Array\-Size. The return value is independent from the array size the number of block descriptors which would have been prepared if there was enough space in the array\par
953 The method is used by the consumer component. \begin{Desc}
954\item[Parameters:]
955\begin{description}
956\item[{\em p\-Consumer}]the component which subscribes to the buffer \item[{\em array\-Block\-Desc}]pointer to block descriptor to be filled \item[{\em i\-Array\-Size}]size of the block descriptor array \end{description}
957\end{Desc}
958\begin{Desc}
959\item[Returns:]: number of matching data blocks, neg. error code if failed\par
960 -EACCESS the consumer state can't be changed (activated) -EBADF unresolved data segments \par
961 -ENOENT consumer component not found \par
962 -ENODATA data buffer does not have raw data \par
963 -EINVAL invalid parameter \par
964 \end{Desc}
965
966
967Definition at line 170 of file Ali\-HLTData\-Buffer.cxx.
968
969References Change\-Consumer\-State(), f\-Active\-Consumers, f\-Consumers, Ali\-HLTComponent\-Block\-Data::f\-Data\-Type, Find\-Consumer(), Find\-Matching\-Data\-Segments(), Ali\-HLTComponent\-Block\-Data::f\-Offset, fp\-Buffer, Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer::f\-Ptr, Ali\-HLTComponent\-Block\-Data::f\-Ptr, Ali\-HLTComponent\-Shm\-Data::f\-Shm\-ID, Ali\-HLTComponent\-Block\-Data::f\-Shm\-Key, Ali\-HLTComponent\-Shm\-Data::f\-Shm\-Type, Ali\-HLTComponent\-Block\-Data::f\-Size, Ali\-HLTComponent\-Block\-Data::f\-Specification, Ali\-HLTComponent\-Shm\-Data::f\-Struct\-Size, Ali\-HLTComponent\-Block\-Data::f\-Struct\-Size, HLTDebug, HLTError, and Ali\-HLTConsumer\-Descriptor::Set\-Active\-Data\-Segment().
970
971Referenced by Ali\-HLTTask::Subscribe().
972
973\footnotesize\begin{verbatim}171 {
974172 // see header file for function documentation
975173 int iResult=0;
976174 if (pConsumer && arrayBlockDesc) {
977175 if (fpBuffer) {
978176 AliHLTConsumerDescriptor* pDesc=FindConsumer(pConsumer, fConsumers);
979177 if (pDesc) {
980178 vector<AliHLTDataBuffer::AliHLTDataSegment> tgtList;
981179 /* TODO: think about a good policy for this check
982180 * is it enough that at least one segment is available, or have all to be available?
983181 * or is it possible to have optional segments?
984182 */
985183 if ((iResult=FindMatchingDataSegments(pConsumer, tgtList))>0) {
986184 int i =0;
987185 vector<AliHLTDataBuffer::AliHLTDataSegment>::iterator segment=tgtList.begin();
988186 while (segment!=tgtList.end() && i<iArraySize) {
989187 // fill the block data descriptor
990188 arrayBlockDesc[i].fStructSize=sizeof(AliHLTComponentBlockData);
991189 // the shared memory key is not used in AliRoot
992190 arrayBlockDesc[i].fShmKey.fStructSize=sizeof(AliHLTComponentShmData);
993191 arrayBlockDesc[i].fShmKey.fShmType=gkAliHLTComponentInvalidShmType;
994192 arrayBlockDesc[i].fShmKey.fShmID=gkAliHLTComponentInvalidShmID;
995193 arrayBlockDesc[i].fOffset=(*segment).fSegmentOffset;
996194 arrayBlockDesc[i].fPtr=fpBuffer->fPtr;
997195 arrayBlockDesc[i].fSize=(*segment).fSegmentSize;
998196 arrayBlockDesc[i].fDataType=(*segment).fDataType;
999197 arrayBlockDesc[i].fSpecification=(*segment).fSpecification;
1000198 pDesc->SetActiveDataSegment(arrayBlockDesc[i].fOffset, arrayBlockDesc[i].fSize);
1001199 HLTDebug("component %p (%s) subscribed to segment #%d offset %d", pConsumer, ((AliHLTComponent*)pConsumer)->GetComponentID(), i, arrayBlockDesc[i].fOffset);
1002200 i++;
1003201 segment++;
1004202 }
1005203 // move this consumer to the active list
1006204 if (ChangeConsumerState(pDesc, fConsumers, fActiveConsumers)>=0) {
1007205 HLTDebug("component %p (%s) subscribed to data buffer %p", pConsumer, ((AliHLTComponent*)pConsumer)->GetComponentID(), this);
1008206 } else {
1009207 // TODO: cleanup the consumer descriptor correctly
1010208 memset(arrayBlockDesc, 0, iArraySize*sizeof(AliHLTComponentBlockData));
1011209 HLTError("can not activate consumer %p for data buffer %p", pConsumer, this);
1012210 iResult=-EACCES;
1013211 }
1014212 } else {
1015213 HLTError("unresolved data segment(s) for component %p (%s)", pConsumer, ((AliHLTComponent*)pConsumer)->GetComponentID());
1016214 iResult=-EBADF;
1017215 }
1018216 } else {
1019217 HLTError("component %p is not a data consumer of data buffer %s", pConsumer, this);
1020218 iResult=-ENOENT;
1021219 }
1022220 } else {
1023221 HLTError("data buffer %p is empty", this);
1024222 iResult=-ENODATA;
1025223 }
1026224 } else {
1027225 HLTError("invalid parameter");
1028226 iResult=-EINVAL;
1029227 }
1030228 return iResult;
1031229 }
1032\end{verbatim}\normalsize
1033
1034
1035
1036
1037\subsection{Member Data Documentation}
1038\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fActiveConsumers@{fActiveConsumers}}
1039\index{fActiveConsumers@{fActiveConsumers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1040\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Ali\-HLTConsumer\-Descriptor}$\ast$$>$ {\bf Ali\-HLTData\-Buffer::f\-Active\-Consumers}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r2}
1041
1042
1043
1044
1045Definition at line 283 of file Ali\-HLTData\-Buffer.h.
1046
1047Referenced by Find\-Consumer(), Get\-Nof\-Active\-Consumers(), Release(), Reset\-Data\-Buffer(), and Subscribe().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fConsumers@{fConsumers}}
1048\index{fConsumers@{fConsumers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1049\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Ali\-HLTConsumer\-Descriptor}$\ast$$>$ {\bf Ali\-HLTData\-Buffer::f\-Consumers}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r1}
1050
1051
1052
1053
1054Definition at line 281 of file Ali\-HLTData\-Buffer.h.
1055
1056Referenced by Cleanup\-Consumer\-List(), Find\-Consumer(), Get\-Nof\-Consumers(), Reset\-Data\-Buffer(), Set\-Consumer(), and Subscribe().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fFlags@{fFlags}}
1057\index{fFlags@{fFlags}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1058\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTUInt32\_\-t} {\bf Ali\-HLTData\-Buffer::f\-Flags}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r5}
1059
1060
1061transient
1062
1063
1064
1065Definition at line 291 of file Ali\-HLTData\-Buffer.h.\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgActiveBuffers@{fgActiveBuffers}}
1066\index{fgActiveBuffers@{fgActiveBuffers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1067\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<$ {\bf Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer} $\ast$ $>$ {\bf Ali\-HLTData\-Buffer::fg\-Active\-Buffers}\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v2}
1068
1069
1070global list of currently active raw buffers
1071
1072Definition at line 83 of file Ali\-HLTData\-Buffer.cxx.
1073
1074Referenced by Create\-Raw\-Buffer(), Delete\-Raw\-Buffers(), and Release\-Raw\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgFreeBuffers@{fgFreeBuffers}}
1075\index{fgFreeBuffers@{fgFreeBuffers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1076\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<$ {\bf Ali\-HLTData\-Buffer::Ali\-HLTRaw\-Buffer} $\ast$ $>$ {\bf Ali\-HLTData\-Buffer::fg\-Free\-Buffers}\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v1}
1077
1078
1079global list of free raw buffers
1080
1081Definition at line 82 of file Ali\-HLTData\-Buffer.cxx.
1082
1083Referenced by Create\-Raw\-Buffer(), Delete\-Raw\-Buffers(), and Release\-Raw\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgkSafetyPattern@{fgkSafetyPattern}}
1084\index{fgkSafetyPattern@{fgkSafetyPattern}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1085\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char {\bf Ali\-HLTData\-Buffer::fgk\-Safety\-Pattern} = \{0x28, 0x63, 0x29, 0x4d, 0x52, 0x49, 0x43, 0x48, 0x54, 0x45, 0x52, 0x20, 0x32, 0x30, 0x30, 0x37\}\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v6}
1086
1087
1088the safety pattern
1089
1090Definition at line 87 of file Ali\-HLTData\-Buffer.cxx.
1091
1092Referenced by Create\-Raw\-Buffer(), and Release\-Raw\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgkSafetyPatternSize@{fgkSafetyPatternSize}}
1093\index{fgkSafetyPatternSize@{fgkSafetyPatternSize}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1094\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const Int\_\-t {\bf Ali\-HLTData\-Buffer::fgk\-Safety\-Pattern\-Size} = 16\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v5}
1095
1096
1097size of the safety pattern
1098
1099Definition at line 86 of file Ali\-HLTData\-Buffer.cxx.
1100
1101Referenced by Release\-Raw\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgLogging@{fgLogging}}
1102\index{fgLogging@{fgLogging}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1103\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTLogging} {\bf Ali\-HLTData\-Buffer::fg\-Logging}\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v4}
1104
1105
1106global instance to HLT logging class for static methods
1107
1108Definition at line 85 of file Ali\-HLTData\-Buffer.cxx.
1109
1110Referenced by Create\-Raw\-Buffer(), Delete\-Raw\-Buffers(), and Release\-Raw\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgMargin@{fgMargin}}
1111\index{fgMargin@{fgMargin}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1112\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTUInt32\_\-t} {\bf Ali\-HLTData\-Buffer::fg\-Margin} = 1024\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v3}
1113
1114
1115determines the raw buffer size margin at buffer requests
1116
1117Definition at line 84 of file Ali\-HLTData\-Buffer.cxx.\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fgNofInstances@{fgNofInstances}}
1118\index{fgNofInstances@{fgNofInstances}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1119\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf Ali\-HLTData\-Buffer::fg\-Nof\-Instances} = 0\hspace{0.3cm}{\tt [static, private]}}\label{classAliHLTDataBuffer_v0}
1120
1121
1122Number of instances of Ali\-HLTData\-Buffer. The statice variable is incremented and decremented in the constructor/ destructor. All internal data structures are cleaned up when the last instance is exiting.
1123
1124Definition at line 81 of file Ali\-HLTData\-Buffer.cxx.
1125
1126Referenced by $\sim$Ali\-HLTData\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fpBuffer@{fpBuffer}}
1127\index{fpBuffer@{fpBuffer}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1128\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Ali\-HLTRaw\-Buffer}$\ast$ {\bf Ali\-HLTData\-Buffer::fp\-Buffer}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r4}
1129
1130
1131
1132
1133Definition at line 288 of file Ali\-HLTData\-Buffer.h.
1134
1135Referenced by Get\-Target\-Buffer(), Is\-Empty(), Reset\-Data\-Buffer(), Set\-Segments(), and Subscribe().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fReleasedConsumers@{fReleasedConsumers}}
1136\index{fReleasedConsumers@{fReleasedConsumers}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1137\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Ali\-HLTConsumer\-Descriptor}$\ast$$>$ {\bf Ali\-HLTData\-Buffer::f\-Released\-Consumers}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r3}
1138
1139
1140
1141
1142Definition at line 285 of file Ali\-HLTData\-Buffer.h.
1143
1144Referenced by Find\-Consumer(), Get\-Nof\-Consumers(), Release(), and Reset\-Data\-Buffer().\index{AliHLTDataBuffer@{Ali\-HLTData\-Buffer}!fSegments@{fSegments}}
1145\index{fSegments@{fSegments}!AliHLTDataBuffer@{Ali\-HLTData\-Buffer}}
1146\subsubsection{\setlength{\rightskip}{0pt plus 5cm}vector$<${\bf Ali\-HLTData\-Segment}$>$ {\bf Ali\-HLTData\-Buffer::f\-Segments}\hspace{0.3cm}{\tt [private]}}\label{classAliHLTDataBuffer_r0}
1147
1148
1149
1150
1151Definition at line 278 of file Ali\-HLTData\-Buffer.h.
1152
1153Referenced by Find\-Matching\-Data\-Segments(), Get\-Nof\-Segments(), Reset\-Data\-Buffer(), and Set\-Segments().
1154
1155The documentation for this class was generated from the following files:\begin{CompactItemize}
1156\item
1157/home/perthi/cern/aliroot/Ali\-Root\_\-head020507/HLT/BASE/{\bf Ali\-HLTData\-Buffer.h}\item
1158/home/perthi/cern/aliroot/Ali\-Root\_\-head020507/HLT/BASE/{\bf Ali\-HLTData\-Buffer.cxx}\end{CompactItemize}