-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXtcIterator.cc
55 lines (48 loc) · 1.08 KB
/
XtcIterator.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
** ++
** Package:
** OdfContainer
**
** Abstract:
** non-inline functions for "InXtcIterator.hh"
**
** Author:
** Michael Huffer, SLAC, (415) 926-4269
**
** Creation Date:
** 000 - October 11,1998
**
** Revision History:
** None.
**
** --
*/
#include "pdsdata/xtc/XtcIterator.hh"
#include "pdsdata/xtc/Xtc.hh"
using namespace Pds;
/*
** ++
**
** Iterate over the collection specifed as an argument to the function.
** For each "Xtc" found call back the "process" function. If the
** "process" function returns zero (0) the iteration is aborted and
** control is returned to the caller. Otherwise, control is returned
** when all elements of the collection have been scanned.
**
** --
*/
void XtcIterator::iterate(Xtc* root)
{
if (root->damage.value() & ( 1 << Damage::IncompleteContribution)){
return;
}
Xtc* xtc = (Xtc*)root->payload();
int remaining = root->sizeofPayload();
while(remaining > 0)
{
if(!process(xtc)) break;
remaining -= xtc->sizeofPayload() + sizeof(Xtc);
xtc = xtc->next();
}
return;
}