n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
cell.h
1 
23 #ifndef CELL_H_
24 #define CELL_H_
25 
26 #include <iostream>
27 #include <string>
28 #include <limits>
29 
30 #include <fast_methods/utils/utils.h>
31 
32 
34 class Cell {
35 
36  friend std::ostream& operator << (std::ostream & os, Cell & c);
37 
38  public:
40  Cell() : value_(-1), occupancy_(1) {}
41 
42  Cell(double v, double o = 1) : value_(v), occupancy_(o) {}
43 
44  virtual inline void setValue(double v) {value_ = v;}
45  virtual inline void setOccupancy(double o) {occupancy_ = o;}
46  virtual std::string type() {return std::string("Cell - Basic cell");}
47  virtual inline void setIndex(int i) {index_ = i;}
48 
51  virtual void setDefault();
52 
53  virtual inline double getValue() const {return value_;}
54  virtual inline double getOccupancy() const {return occupancy_;}
55  virtual inline unsigned int getIndex() const {return index_;}
56 
57  virtual inline bool isOccupied() const {
59  return true;
60  return false;
61  }
62 
63  protected:
65  double value_;
66 
68  double occupancy_;
69 
71  unsigned int index_;
72 };
73 
74 #endif /* CELL_H_*/
virtual void setDefault()
Sets default values for the cell. Concretely, restarts value_ = -1 but occupancy_ is not modified...
Definition: cell.h:34
double occupancy_
Binary occupancy, true means clear, false occupied.
Definition: cell.h:68
static constexpr double COMP_MARGIN
When comparing doubles if(a < b), do if(a+COMP_MARGIN < b) to avoid double precission issues...
Definition: utils.h:27
double value_
Value of the cell.
Definition: cell.h:65
unsigned int index_
Definition: cell.h:71
Cell()
Default constructor: sets value_ to -1 and occupancy_ to true (clear cell, not occupied).
Definition: cell.h:40