Utopia  2
Framework for studying models of complex & adaptive systems.
cell.hh
Go to the documentation of this file.
1 #ifndef UTOPIA_CORE_CELL_HH
2 #define UTOPIA_CORE_CELL_HH
3 
4 #include "tags.hh"
5 #include "types.hh"
6 #include "entity.hh"
7 
8 
9 namespace Utopia {
16 template<typename StateType,
17  Update update_mode,
18  bool use_def_state_constr=false,
19  typename CellTags=EmptyTag,
20  template<class> class CustomLinkContainers=NoCustomLinks>
21 using CellTraits = EntityTraits<StateType,
22  update_mode,
23  use_def_state_constr,
24  CellTags,
25  CustomLinkContainers>;
26 
28 
37 template<typename Traits>
38 class Cell :
39  public Entity<Cell<Traits>, Traits>
40 {
41 public:
43  using Self = Cell<Traits>;
44 
46  using State = typename Traits::State;
47 
49  Cell(const IndexType id, const State initial_state)
50  :
51  Entity<Self, Traits>(id, initial_state)
52  {}
53 };
54 
55 
56 // end group CellManager
61 } // namespace Utopia
62 
63 #endif // UTOPIA_CORE_CELL_HH
A cell is a slightly specialized state container.
Definition: cell.hh:40
typename Traits::State State
The type of the state.
Definition: cell.hh:46
Cell(const IndexType id, const State initial_state)
Construct a cell.
Definition: cell.hh:49
An entity is a slightly specialized state container.
Definition: entity.hh:83
Traits Traits
The traits of this entity.
Definition: entity.hh:90
const IndexType & id() const
Return const reference to entity ID.
Definition: entity.hh:134
Update
Update modes when applying rules.
Definition: state.hh:20
Definition: agent.hh:11
std::size_t IndexType
Type for indices, i.e. values used for container indexing, agent IDs, ...
Definition: types.hh:40
The entity traits struct gathers types to be used for specializing an entity.
Definition: entity.hh:49