00001 /* 00002 * SmartCollection.cpp 00003 * 00004 * Created on: 14-mag-2009 00005 * Author: Nicola Mori 00006 */ 00007 00010 #include "SmartCollection.h" 00011 00012 void SmartCollection::AddAction(CollectionAction& action) { 00013 _actions.push_back(&action); 00014 } 00015 00016 CollectionAction *SmartCollection::GetAction(unsigned int iAction) { 00017 if (_actions.size() == 0) 00018 return NULL; 00019 if (iAction < 0 || iAction > _actions.size() - 1) 00020 return NULL; 00021 else 00022 return _actions[iAction]; 00023 } 00024 00025 void SmartCollection::Setup(PamLevel2 *events) { 00026 PamCutCollection::Setup(events); 00027 00028 for (unsigned int i = 0; i < _actions.size(); i++) { 00029 _actions[i]->Setup(events); 00030 } 00031 } 00032 00033 void SmartCollection::Finalize() { 00034 PamCutCollection::Finalize(); 00035 00036 for (unsigned int i = 0; i < _actions.size(); i++) { 00037 _actions[i]->Finalize(); 00038 } 00039 } 00040 00041 void SmartCollection::OnGood(PamLevel2 *event) { 00042 PamCutCollection::OnGood(event); 00043 00044 for (unsigned int i = 0; i < _actions.size(); i++) { 00045 _actions[i]->OnGood(event); 00046 } 00047 } 00048 00049 void SmartCollection::OnBad(PamLevel2 *event, int selectionResult) { 00050 PamCutCollection::OnBad(event, selectionResult); 00051 00052 for (unsigned int i = 0; i < _actions.size(); i++) { 00053 _actions[i]->OnBad(event, selectionResult); 00054 } 00055 }