Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
entity.hh
Go to the documentation of this file.
1#ifndef UTOPIA_CORE_GRAPH_ENTITY_HH
2#define UTOPIA_CORE_GRAPH_ENTITY_HH
3
4#include "../tags.hh"
5#include "../types.hh"
6#include "../entity.hh"
7
8namespace Utopia {
16
19template<typename StateType,
20 typename GraphEntityTags=EmptyTag,
21 template<class> class CustomLinkContainers=NoCustomLinks>
24 false, // use_def_state_constr
26 CustomLinkContainers>;
27
28
30
39template<typename Traits>
41 public Entity<GraphEntity<Traits>, Traits>
42{
43public:
46
48 using State = typename Traits::State;
49
50private:
52 static inline IndexType id_counter = 0;
53
54public:
57 :
59 {};
60
66
69 Entity<Self, Traits>(id_counter++, ge.state)
70 {};
71
74 std::swap(this->state, ge.state);
75 std::swap(this->custom_links(), ge.custom_links());
76 return *this;
77 }
78
83};
84
85// end group GraphEntity
90} // namespace Utopia
91
92#endif // UTOPIA_CORE_GRAPH_ENTITY_HH
An entity is a slightly specialized state container.
Definition entity.hh:83
Traits Traits
The traits of this entity.
Definition entity.hh:90
CustomLinkContainers & custom_links()
Return reference to custom link containers.
Definition entity.hh:139
A graph entity is a slightly specialized state container.
Definition entity.hh:42
IndexType get_id_counter()
Get the id counter.
Definition entity.hh:80
GraphEntity & operator=(GraphEntity ge)
Copy-assign a graph entity.
Definition entity.hh:73
GraphEntity(const State &initial_state)
Construct a graph entity with initial state.
Definition entity.hh:62
typename Traits::State State
The type of the state.
Definition entity.hh:48
GraphEntity(const GraphEntity &ge)
Copy-construct a graph entity.
Definition entity.hh:68
GraphEntity()
Construct a graph entity with empty initial state.
Definition entity.hh:56
static IndexType id_counter
The id counter that counts how many graph entities exist.
Definition entity.hh:52
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
@ manual
User chooses update type when calling apply_rule()
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