30 template <
typename... Components>
47 static_assert(
sizeof...(Components) > 0,
"[BondHandle] Must be queried for at least one component type.");
50 assert(_bond !=
nullptr &&
"[BondHandle] cannot be created with a nullptr Bond!");
53 assert(_bond->get_pool_count() ==
sizeof...(Components) &&
"[BondHandle] BondHandle size and Bond pool count do not match!");
64 const std::vector<Entity>* _entities;
74 Iterator(
const std::vector<Entity>* entities,
size_t index)
75 : _entities(entities), _index(index) { }
83 return (*_entities)[_index];
104 return _index != other._index;
113 return Iterator(&(_bond->get_entities()), 0);
121 return Iterator(&(_bond->get_entities()), _bond->get_bond_size());
Defines the Bond class which will be a permanent group of component pools that are kept sorted so tha...
Defines the Entity alias and the free functions used to pack and unpack it.
uint32_t Entity
A packed identifier: 20 bits of index, 12 bits of generation.
Definition Entity.hpp:20
Definition BondHandle.hpp:61
Entity operator*() const
Dereference the Iterator to access the current element.
Definition BondHandle.hpp:81
Iterator(const std::vector< Entity > *entities, size_t index)
Construct a new Iterator object.
Definition BondHandle.hpp:74
bool operator!=(const Iterator &other) const
Compare the indices of the two Iterators.
Definition BondHandle.hpp:102
Iterator & operator++()
Advances the Iterator to the next element which is just _index + 1.
Definition BondHandle.hpp:90
BondHandle(const Bond *bond)
Constructs a new BondHandle object, initializing it with is according Bond. This can only be called b...
Definition BondHandle.hpp:43
Iterator end() const
Returns an Iterator past the last element.
Definition BondHandle.hpp:119
Iterator begin() const
Returns an Iterator to the first element.
Definition BondHandle.hpp:111
A Bond permanently reorders every pool within it so that every Entity that has all of the components ...
Definition Bond.hpp:29