switch.h
1 /***************************************************************************
2  switch.h - description
3  -------------------
4  begin : Mon Jan 22 2007
5  copyright : (C) 2000-2015 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef RECOSWITCH_H
19 #define RECOSWITCH_H
20 
21 #include "step.h"
22 
23 
24 class RecoSwitch : public RecoStep {
25 
26  // implementing virtual functions of RecoStep
27  STD_string label() const {return "switch";}
28  STD_string description() const {return "Branch off different flows through reconstruction pipeline";}
29  bool process(RecoData& rd, RecoController& controller);
30  RecoCoord input_coord() const {return RecoCoord::any();}
31  void modify_coord(RecoCoord& coord) const {} // irrelevant since pipeline ends here
32  RecoStep* allocate() const {return new RecoSwitch;}
33  bool pipeline_init(const RecoController& controller, const RecoCoord& input_coord);
34  bool query(RecoQueryContext& context);
35  void init();
36 
37 
38  LDRstring brancharg;
39 
40 
41  struct BranchKey {
42 // BranchKey(recoDim branchdim, unsigned int branchindex) : dim(branchdim), val(branchindex) {} // does not work with GCC 3.5
43 
44  recoDim dim;
45  unsigned short val;
46 
47  bool operator < (const BranchKey& bs) const {
48  if(dim!=bs.dim) return (dim<bs.dim); // dim has highest priority
49  return (val<bs.val);
50  }
51  };
52 
53 
54  struct BranchValue {
55  RecoStep* step;
56  unsigned short numof[n_recoDims];
57  };
58 
59 
60  typedef STD_map<BranchKey,BranchValue> BranchMap;
61  BranchMap branches;
62 
63  STD_list<RecoStep*> unconditional;
64 };
65 
66 
67 #endif
68 
static RecoCoord any()
Definition: index.h:219
bool operator<(const STD_complex &c1, const STD_complex &c2)
Definition: tjcomplex.h:61
recoDim
Definition: reco.h:74
switch: Branch off different flows through reconstruction pipeline
Definition: switch.h:24