PamCut: Collections/BlindCutCollection/BlindCutCollection.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# Collections/BlindCutCollection/BlindCutCollection.cpp

Go to the documentation of this file.

    00001 /*
    00002  * BlindCutCollection.cpp
    00003  *
    00004  *  Created on: 10-mar-2009
    00005  *      Author: Nicola Mori
    00006  */
    00007
    00010 #include "BlindCutCollection.h"
    00011
    00012 int BlindCutCollection::Check(PamLevel2 *event){
    00013
    00014   if (_cuts.size() == 0) {
    00015     return CUTOK;
    00016   }
    00017
    00018   int firstFailed = CUTOK;
    00019   for (unsigned int icut = 0; icut < _cuts.size(); icut++) {
    00020     if (_cuts[icut]->Check(event) != CUTOK && firstFailed == CUTOK) {
    00021       firstFailed = icut;
    00022     }
    00023   }
    00024
    00025   return firstFailed;
    00026
    00027 }
    00028
    00029 int BlindCutCollection::ApplyCut(PamLevel2 *event) {
    00030
    00031   _nEv++;
    00032   if (_cuts.size() == 0) {
    00033     _nGood++;
    00034     OnGood(event);
    00035     return CUTOK;
    00036   }
    00037
    00038   int firstFailed = CUTOK;
    00039   for (unsigned int icut = 0; icut < _cuts.size(); icut++) {
    00040     if (_cuts[icut]->ApplyCut(event) != CUTOK && firstFailed == CUTOK) {
    00041       firstFailed = icut;
    00042     }
    00043   }
    00044
    00045   if (firstFailed == CUTOK) {
    00046     _nGood++;
    00047     OnGood(event);
    00048   }
    00049   else {
    00050     OnBad(event, firstFailed);
    00051   }
    00052   return firstFailed;
    00053 }