All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CMergeManager.h
Go to the documentation of this file.
1 /**
2  * \file CMergeManager.h
3  *
4  * \ingroup CMTool
5  *
6  * \brief Class def header for a class CMergeManager
7  *
8  * @author kazuhiro
9  */
10 
11 /** \addtogroup CMTool
12 
13  @{*/
14 #ifndef RECOTOOL_CMERGEMANAGER_H
15 #define RECOTOOL_CMERGEMANAGER_H
16 
19 
21 #include <vector>
22 
23 namespace cmtool {
24 
25  class CBoolAlgoBase;
26 
27  /**
28  \class CMergeManager
29  A class that instantiates merging algorithm(s) and run.
30  The book-keeping of merged cluster sets are done by CMergeBookKeeper.
31  */
32  class CMergeManager : public CMManagerBase {
33  public:
34  CMergeManager();
35 
36  /// Default destructor
37  virtual ~CMergeManager() {}
38 
39  /// Method to reset itself
40  virtual void Reset();
41 
42  /// A simple method to add an algorithm for merging
43  void
45  {
46  _merge_algo = algo;
47  }
48 
49  /// A simple method to add an algorithm for separation
50  void
52  {
53  _separate_algo = algo;
54  }
55 
56  /// A method to obtain output clusters
57  const std::vector<cluster::ClusterParamsAlg>&
58  GetClusters() const
59  {
60  return _out_clusters;
61  }
62 
63  /// A method to obtain book keeper
64  const CMergeBookKeeper&
65  GetBookKeeper() const
66  {
67  return _book_keeper;
68  }
69 
70  protected:
71  //
72  // FMWK functions override
73  //
74 
75  /// FMWK function called @ beginning of Process()
76  virtual void EventBegin();
77 
78  /// FMWK function called @ beginning of iterative loop inside Process()
79  virtual void IterationBegin();
80 
81  /// FMWK function called @ iterative loop inside Process()
82  virtual bool IterationProcess(util::GeometryUtilities const& gser);
83 
84  /// FMWK function called @ end of iterative loop inside Process()
85  virtual void IterationEnd();
86 
87  /// FMWK function called @ end of Process()
88  virtual void EventEnd();
89 
90  protected:
91  void RunMerge(const std::vector<cluster::ClusterParamsAlg>& in_clusters,
92  CMergeBookKeeper& book_keeper) const;
93 
94  void RunMerge(const std::vector<cluster::ClusterParamsAlg>& in_clusters,
95  const std::vector<bool>& merge_flag,
96  CMergeBookKeeper& book_keeper) const;
97 
98  void RunSeparate(const std::vector<cluster::ClusterParamsAlg>& in_clusters,
99  CMergeBookKeeper& book_keeper) const;
100 
101  protected:
102  /// Output clusters
103  std::vector<cluster::ClusterParamsAlg> _out_clusters;
104 
105  /// Book keeper instance
107 
108  /// Merging algorithm
110 
111  /// Separation algorithm
113 
114  size_t _iter_ctr;
115 
116  std::vector<CMergeBookKeeper> _book_keeper_v;
117 
118  std::vector<std::vector<unsigned short>> _tmp_merged_indexes;
119 
120  std::vector<cluster::ClusterParamsAlg> _tmp_merged_clusters;
121  };
122 }
123 
124 #endif
125 /** @} */ // end of doxygen group
virtual void EventEnd()
FMWK function called @ end of Process()
std::vector< CMergeBookKeeper > _book_keeper_v
std::vector< std::vector< unsigned short > > _tmp_merged_indexes
::cmtool::CBoolAlgoBase * _merge_algo
Merging algorithm.
virtual void EventBegin()
FMWK function called @ beginning of Process()
std::vector< cluster::ClusterParamsAlg > _out_clusters
Output clusters.
const std::vector< cluster::ClusterParamsAlg > & GetClusters() const
A method to obtain output clusters.
Definition: CMergeManager.h:58
std::vector< cluster::ClusterParamsAlg > _tmp_merged_clusters
virtual bool IterationProcess(util::GeometryUtilities const &gser)
FMWK function called @ iterative loop inside Process()
virtual void IterationEnd()
FMWK function called @ end of iterative loop inside Process()
virtual ~CMergeManager()
Default destructor.
Definition: CMergeManager.h:37
Class def header for a class CMergeBookKeeper.
virtual void IterationBegin()
FMWK function called @ beginning of iterative loop inside Process()
void RunMerge(const std::vector< cluster::ClusterParamsAlg > &in_clusters, CMergeBookKeeper &book_keeper) const
void RunSeparate(const std::vector< cluster::ClusterParamsAlg > &in_clusters, CMergeBookKeeper &book_keeper) const
::cmtool::CBoolAlgoBase * _separate_algo
Separation algorithm.
CMergeBookKeeper _book_keeper
Book keeper instance.
virtual void Reset()
Method to reset itself.
void AddMergeAlgo(CBoolAlgoBase *algo)
A simple method to add an algorithm for merging.
Definition: CMergeManager.h:44
const CMergeBookKeeper & GetBookKeeper() const
A method to obtain book keeper.
Definition: CMergeManager.h:65
Class def header for a class CMManagerBase.
void AddSeparateAlgo(CBoolAlgoBase *algo)
A simple method to add an algorithm for separation.
Definition: CMergeManager.h:51