BaseModule.hh

00001 
00009 #ifndef BASEMODULE_h
00010 #define BASEMODULE_h
00011 
00012 #include "Event.hh"
00013 #include "ParameterList.hh"
00014 #include "ProcessingCut.hh"
00015 #include <iostream>
00016 #include <string>
00017 #include <set>
00018 
00060 class BaseModule : public ParameterList{
00061 public:
00062   //simple constructor and desctructor
00063   //concrete implemenations should declare dependencies in their constructors
00065   BaseModule(const std::string& name="", const std::string& helptext="");
00067   virtual ~BaseModule();
00069   const std::string& GetName() { return GetDefaultKey(); }
00071   void SetName(const std::string& name){ SetDefaultKey(name); }
00072   //Access operators, to be overridden by concrete implemenation
00073   //all return 0 when no errors
00075   virtual int Initialize() {return 0;};
00077   virtual int Process(EventPtr event)=0;
00079   virtual int Finalize() {return 0;};
00080   
00082   int HandleEvent(EventPtr event, bool process_now = false);
00083   
00084   //all modules have three parameters by default
00085   bool enabled;   
00086   
00088   int GetLastProcessReturn(){ return _last_process_return; }
00089   
00091   int AddDependency(const std::string& module);
00092   
00094   template<class T> int AddDependency()
00095   { return AddDependency(T::GetDefaultName()); }
00096 
00098   const std::set<std::string>* GetDependencies(){ return &_dependencies; }
00099     
00101   void AddProcessingCut(ProcessingCut* cut){ _cuts.push_back(cut); }
00103   const std::vector<ProcessingCut*>* GetCuts(){ return &_cuts; }
00105   void ClearCuts();
00107   bool CheckCuts(EventPtr event);
00108   
00113 protected:  
00114   int _last_process_return; 
00115   std::set<std::string> _dependencies; 
00116   std::vector<ProcessingCut*> _cuts; 
00117   std::set<int> _skip_channels; 
00118   
00119 };
00120 
00121 
00122 #endif
00123   
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 20 Jun 2014 for daqman by  doxygen 1.6.1