algo_base.hh

Go to the documentation of this file.
00001 
00015 #ifndef ALGO_BASE
00016 #define ALGO_BASE
00017 
00018 #include "storage_manager.hh"
00019 #include <deque>
00020 
00026 class algo_base : public decoder_base {
00027 
00028 public:
00029 
00031   algo_base() { 
00032     _name="algo_base"; 
00033     _storage=0; 
00034     _debug_mode=false; 
00035     _bt_mode=false;
00036     _bt_nwords=0;
00037     _bt_nwords_filled=false;
00038   };
00039 
00041   virtual ~algo_base(){}; 
00042 
00044 
00049   virtual bool process_word(const PMT::word_t word)=0;
00050 
00052   virtual void finalize(){};
00053 
00055   virtual inline PMT::PMT_WORD get_word_class(const PMT::word_t word) const
00056   {if(word) return PMT::UNDEFINED_WORD; else return PMT::UNDEFINED_WORD;};
00057 
00059   void set_debug_mode(bool doit){_debug_mode=doit;};
00060 
00062   void set_storage_ptr(storage_manager* storage){_storage=storage;};
00063 
00065   virtual void set_backtrace_mode(size_t nwords=0){
00066     _bt_nwords=nwords;
00067     _bt_mode=(bool)(nwords);
00068   };
00069 
00071   size_t backtrace_mode() const {return _bt_nwords;};
00072 
00076   virtual bool check_event_quality() {return false;};
00077 
00079   virtual void reset(){ init_checker_info(); _storage=0;};
00080 
00082   inline void backtrace() const
00083   {
00084     Message::send(MSG::WARNING,__FUNCTION__,"Dumping a backtrace...");
00085     int ctr=1;
00086     for(std::deque<PMT::word_t>::const_iterator iter(_bt_words.begin());
00087     iter!=_bt_words.end();
00088     ++iter) {
00089       printf("%08x ",(*iter));
00090       if(ctr%8==0 && ctr) std::cout<<std::endl;
00091       ctr++;
00092     }
00093     std::cout<<std::endl<<std::endl;
00094   };
00095   
00097   virtual bool is_event_empty()=0;
00098 
00099 protected:
00100 
00102   virtual void init_checker_info();
00103 
00104 protected:
00105   //
00106   // Run control 
00107   //
00108   bool    _debug_mode;  
00109   bool    _bt_mode;     
00110 
00111   //
00112   // Constants
00113   //
00114   static const size_t BEAM_REF_CHANNEL=39; 
00115   static const size_t BEAM_NWORDS=21;      
00116   static const size_t FRAME_WIDTH=8192;    
00117 
00118   //
00119   // Data
00120   // 
00121   storage_manager* _storage;  
00122 
00123   //
00124   // Checker variables
00125   //
00126   PMT::word_t _checksum;  
00127   PMT::word_t _nwords;    
00128 
00129   //
00130   // Back-trace tools
00131   //
00132   std::deque<PMT::word_t> _bt_words; 
00133   size_t _bt_nwords;                 
00134   bool   _bt_nwords_filled;          
00135 
00136 };
00137 #endif
00138  // end of doxygen group

Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7