AddCutFunctor.cc

00001 #include "AddCutFunctor.hh"
00002 #include "BaseModule.hh"
00003 #include "CheckRegion.hh"
00004 #include "Message.hh"
00005 #include <stdexcept>
00006 
00007 using namespace ProcessingCuts;
00008 std::istream& AddCutFunctor::operator()(std::istream& in)
00009 {
00010   cuts_list* all_cuts = GetListOfCuts();
00011   ProcessingCut* cut = 0;
00012   std::string key;
00013   in>>key;
00014   cuts_list::iterator cutit= all_cuts->find(key);
00015   if(cutit != all_cuts->end()){
00016     cut = (cutit->second)->GetCut();  
00017     in>>*cut;
00018     if(!in){
00019       Message(ERROR)<<"Error reading cut parameters for "<<key<<std::endl;
00020     }
00021     else{
00022       Message(DEBUG)<<"Adding cut "<<cut->GetName()<<" to module "
00023                     <<_parent->GetName()<<std::endl;
00024       _parent->AddProcessingCut(cut);
00025       cut->AddDependenciesToModule(_parent);
00026     }
00027   }
00028   else{
00029     Message(ERROR)<<"Unkown cut :\""<<key<<"\"\n";
00030     throw std::invalid_argument(key);
00031   }
00032 
00033   return in;
00034 }
00035 
00036 std::ostream& AddCutFunctor::operator()(std::ostream& out)
00037 {
00038   const std::vector<ProcessingCut*>* cuts = _parent->GetCuts();
00039   std::vector<ProcessingCut*>::const_iterator cutit = cuts->begin();
00040   for( ; cutit != cuts->end(); cutit++){
00041     out<<GetFunctionName()<<" "<<(*cutit)->GetDefaultKey()<<" "<<*(*cutit)<<" ";
00042   }
00043   return out;
00044 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1