CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/CommonTools/UtilAlgos/interface/DummySelector.h

Go to the documentation of this file.
00001 #ifndef CommonTools_UtilAlgos_DummySelector_h
00002 #define CommonTools_UtilAlgos_DummySelector_h
00003 /* \class DummySelector
00004  *
00005  * Dummy generic selector following the
00006  * interface proposed in the document:
00007  *
00008  * https://twiki.cern.ch/twiki/bin/view/CMS/SelectorInterface
00009  *
00010  * \author Luca Lista, INFN
00011  */
00012 #include "FWCore/Utilities/interface/EDMException.h"
00013 
00014 namespace edm { 
00015   class ParameterSet; 
00016   class Event;
00017   class EventSetup;
00018 }
00019 
00020 class DummySelector {
00021 public:
00022   explicit DummySelector(const edm::ParameterSet&) : updated_(false) { }
00023   void newEvent(const edm::Event&, const edm::EventSetup&) { updated_ = true; }
00024   template<typename T>
00025   bool operator()(const T&) { 
00026     if(!updated_)     
00027       throw edm::Exception(edm::errors::Configuration)
00028         << "DummySelector: forgot to call newEvent\n"; 
00029     return true; 
00030   }  
00031 private:
00032   bool updated_;
00033 };
00034 
00035 namespace dummy {
00036   template<typename T>
00037   inline bool select(const T&) { return true; }
00038 }
00039 
00040 EVENTSETUP_STD_INIT(DummySelector);
00041 
00042 #endif