Helios++
Helios software for LiDAR simulations
OptimizationDragger.hpp
1 #pragma once
2 
3 #include <surfaceinspector/util/SurfaceInspectorException.hpp>
4 #include <surfaceinspector/util/draggers/IDragger.hpp>
5 
6 #include <vector>
7 
10 
11 using std::vector;
12 
13 namespace SurfaceInspector { namespace util { namespace draggers{
24 template <typename E>
25 class OptimizationDragger : public IDragger<E, vector<E>>{
26 protected:
27  // *** ABSTRACT METHODS *** //
28  // ************************** //
36  virtual E pick() = 0;
40  virtual void update() = 0;
41 
42 public:
43  // *** CONCRETE METHODS *** //
44  // ************************** //
56  E next() override {
57  // Check there are more elements to drag
58  if(!this->hasNext()){
60  "Optimization dragger has no more elements to drag"
61  );
62  }
63 
64  // Pick, update and return
65  update();
66  return pick();
67  }
68 };
69 }}}
Base class for surface inspector exceptions.
Definition: SurfaceInspectorException.hpp:18
Dragger interface provide methods to drag elements from a given collection following a certain order....
Definition: IDragger.hpp:21
virtual bool hasNext()=0
Check if dragger supports dragging at least one more element.
Optimization dragger interface provide methods expanding dragger definition to become a optimization ...
Definition: OptimizationDragger.hpp:25
E next() override
Implementation of next method for optimization draggers.
Definition: OptimizationDragger.hpp:56
virtual void update()=0
Update the dragger status advancing one step.
virtual E pick()=0
Pick the element that must be returned when calling next for current dragger status....