• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List

step.h

00001 /***************************************************************************
00002                           step.h  -  description
00003                              -------------------
00004     begin                : Sat Dec 30 2006
00005     copyright            : (C) 2001 by Thies Jochimsen
00006     email                : jochimse@cns.mpg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef RECOSTEP_H
00019 #define RECOSTEP_H
00020 
00021 #include <odindata/step.h>
00022 
00023 #include <odinreco/odinreco.h>
00024 #include <odinreco/index.h>
00025 
00032 class RecoData; // forward declaration
00033 class RecoController; // forward declaration
00034 
00036 
00040 struct RecoQueryContext {
00041 
00042 
00049   enum queryMode {prep=0, finalize, print};
00050   queryMode mode;
00051 
00055   RecoController& controller;
00056 
00060   STD_string printprefix;
00061 
00065   STD_string printpostfix;
00066 
00070   RecoCoord coord;
00071 
00072   RecoQueryContext(queryMode m, RecoController& contr, unsigned short numof[n_recoDims]) : mode(m), controller(contr) {
00073     for(int idim=0; idim<n_recoDims; idim++) coord.index[idim].set_numof(numof[idim]); // initializing numof in this branch
00074   }
00075 
00076 };
00077 
00079 
00080 
00084 class RecoStep : public Step<RecoStep> {
00085 
00086  public:
00087 
00088   virtual ~RecoStep() {}
00089 
00098   virtual bool process(RecoData& rd, RecoController& controller) = 0;
00099 
00100 
00104   virtual RecoCoord input_coord() const = 0;
00105 
00109   virtual void modify_coord(RecoCoord& coord) const = 0;
00110 
00111 
00117   virtual bool pipeline_init(const RecoController& controller, const RecoCoord& input_coord) {return true;}
00118 
00119 
00125   virtual bool query(RecoQueryContext& context);
00126 
00127 
00131   void set_next_step(RecoStep* step) {next_step=step;}
00132 
00133 
00134 
00135   // To be used by factory via duck typing
00136   static void create_templates(STD_list<RecoStep*>& result);
00137   static STD_string manual_group() {return "odinreco_steps";}
00138   static void interface_description(const RecoStep* step, STD_string& in, STD_string& out);
00139 
00140 
00141 
00142  protected:
00143   friend class RecoController;
00144 
00148   RecoStep() : next_step(0) {}
00149 
00150 
00151 
00157   bool execute_next_step(RecoData& rd, RecoController& controller);
00158 
00159 
00160  private:
00161 
00162   void interface_dims(int& in, int& out) const;
00163 
00164 
00165   RecoStep* next_step;
00166 
00167 };
00168 
00169 
00171 
00172 
00173 
00174 typedef StepFactory<RecoStep> RecoStepFactory; // The factory for reco steps
00175 
00176 
00177 
00180 #endif
00181 

Generated on Tue Dec 18 2012 15:11:14 by  doxygen 1.7.1