1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* BlindCutCollection.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 10-mar-2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file BlindCutCollection.cpp The BlindCutCollection class implementation file */ |
9 |
|
|
|
10 |
|
|
#include "BlindCutCollection.h" |
11 |
|
|
|
12 |
|
|
int BlindCutCollection::Check(PamLevel2 *event){ |
13 |
|
|
|
14 |
|
|
if (_cuts.size() == 0) { |
15 |
|
|
return CUTOK; |
16 |
|
|
} |
17 |
|
|
|
18 |
|
|
int firstFailed = CUTOK; |
19 |
|
|
for (unsigned int icut = 0; icut < _cuts.size(); icut++) { |
20 |
|
|
if (_cuts[icut]->Check(event) != CUTOK && firstFailed == CUTOK) { |
21 |
|
|
firstFailed = icut; |
22 |
|
|
} |
23 |
|
|
} |
24 |
|
|
|
25 |
|
|
return firstFailed; |
26 |
|
|
|
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
int BlindCutCollection::ApplyCut(PamLevel2 *event) { |
30 |
|
|
|
31 |
|
|
_nEv++; |
32 |
|
|
if (_cuts.size() == 0) { |
33 |
|
|
_nGood++; |
34 |
|
|
OnGood(event); |
35 |
|
|
return CUTOK; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
int firstFailed = CUTOK; |
39 |
|
|
for (unsigned int icut = 0; icut < _cuts.size(); icut++) { |
40 |
|
|
if (_cuts[icut]->ApplyCut(event) != CUTOK && firstFailed == CUTOK) { |
41 |
|
|
firstFailed = icut; |
42 |
|
|
} |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
if (firstFailed == CUTOK) { |
46 |
|
|
_nGood++; |
47 |
|
|
OnGood(event); |
48 |
|
|
} |
49 |
|
|
else { |
50 |
|
|
OnBad(event, firstFailed); |
51 |
|
|
} |
52 |
|
|
return firstFailed; |
53 |
|
|
} |