CMlib
Cell mapping algorithms in C++
cell.h
Go to the documentation of this file.
1 #ifndef CELL_MAPPING_CPP_CELL_H
2 #define CELL_MAPPING_CPP_CELL_H
3 
4 #include <cstdint>
5 
6 namespace cm {
7 
11  enum class CellState : uint8_t {
12  Untouched,
14  Processed
15  };
16 
22  class CellBase {
23  private:
24  CellState state;
25  public:
27  state = CellState::Untouched;
28  }
32  CellState getState() const {
33  return state;
34  }
38  void setState(CellState state) {
39  CellBase::state = state;
40  }
41  };
42 
51  template <class IDType>
52  class SCMCell : public CellBase {
53  private:
54  IDType image;
55  IDType group;
56  IDType step;
57  public:
58  SCMCell() : image(0), group(0), step(0) {}
62  IDType getImage() const {
63  return image;
64  }
68  void setImage(IDType image) {
69  SCMCell::image = image;
70  }
74  IDType getGroup() const {
75  return group;
76  }
80  void setGroup(IDType group) {
81  SCMCell::group = group;
82  }
86  IDType getStep() const {
87  return step;
88  }
92  void setStep(IDType step) {
93  SCMCell::step = step;
94  }
95  };
96 
97  template <class IDType>
98  class ClusterableSCMCell : public SCMCell<IDType> {
99  private:
100  IDType clusterID;
101  IDType cellTreeID;
102  public:
103  ClusterableSCMCell() : clusterID(0), cellTreeID(0) {
104  }
105  IDType getClusterID() const {
106  return clusterID;
107  }
108  void setClusterID(IDType clusterID) {
109  ClusterableSCMCell::clusterID = clusterID;
110  }
111  IDType getCellTreeID() const {
112  return cellTreeID;
113  }
114  void setCellTreeID(IDType cellTreeID) {
115  ClusterableSCMCell::cellTreeID = cellTreeID;
116  }
117  };
118 
119 }
120 
121 #endif //CELL_MAPPING_CPP_CELL_H
void setState(CellState state)
Sets the state of the cell.
Definition: cell.h:38
IDType getImage() const
Returns the image of the cell.
Definition: cell.h:62
void setStep(IDType step)
Sets the step number of the cell.
Definition: cell.h:92
Definition: cell.h:98
CellState
Used during cell mapping algorithms.
Definition: cell.h:11
void setGroup(IDType group)
Sets the group number of the cell.
Definition: cell.h:80
IDType getGroup() const
Returns the group number of the cell.
Definition: cell.h:74
Template class for Cells used with Simple Cell Mapping.
Definition: cell.h:52
ClusterableSCMCell()
Definition: cell.h:103
IDType getClusterID() const
Definition: cell.h:105
IDType getCellTreeID() const
Definition: cell.h:111
Definition: cell.h:6
CellState getState() const
Returns the state of the cell.
Definition: cell.h:32
SCMCell()
Step number of this cell (0 for periodic cells, positive for transient cells)
Definition: cell.h:58
void setClusterID(IDType clusterID)
Definition: cell.h:108
IDType getStep() const
Returns the step number of the cell.
Definition: cell.h:86
void setImage(IDType image)
Sets the image of the cell.
Definition: cell.h:68
void setCellTreeID(IDType cellTreeID)
Definition: cell.h:114
CellBase class for state space cells.
Definition: cell.h:22
CellBase()
The state of the cell.
Definition: cell.h:26