class
#include <core/ecs/query/filter.hpp>
QueryFilter Used to find matches for the given query terms. Essentially contains the non-templated part of the query logic.
Public types
- struct Match
- Output structure of the iterator.
Constructors, destructors, conversion operators
- QueryFilter(World& world, const std::vector<QueryTerm>& terms)
- Constructs.
-
View(QueryFilter& filter,
QueryNode::
TargetMask pinMask = 0) - Constructs.
- View(const View& view) defaulted
- Copy constructs.
- Iterator(View& view, bool end)
- Constructs.
- Iterator(const Iterator& other) defaulted
- Copy constructs.
Public functions
- auto cursorIndex(std::size_t termIndex) const -> std::size_t
- Gets the cursor index for the given term index.
- void update()
- Fetches any new matching archetypes that have been added since the last call to this function.
- auto view() -> View
- Returns a view which can be used to iterate over the matches.
- auto targetCount() const -> int
- Gets the number of targets.
- auto operator=(const View& view) -> View&
- Copy assigns.
- auto pin(int target, Entity entity) -> View
- Returns a new view equal to this one but with the given target pinned to the given entity.
- auto begin() -> Iterator
- Returns an iterator pointing to the first query match.
- auto end() -> Iterator
- Returns an out of bounds iterator representing the end of the query matches.
- auto operator==(const Iterator& other) const -> bool
- Compares two iterators.
- auto operator*() const -> const Match&
- Accesses the match referenced by this iterator.
- auto operator->() const -> const Match*
- Accesses the match referenced by this iterator.
- auto operator++() -> Iterator&
- Advances the iterator.
- auto targetArchetypes() const -> const ArchetypeId*
- Gets the archetype of each target.
- auto cursorDepths() const -> const int*
- Gets the depth level for each cursor (used for relation terms).
- auto cursorRows() const -> const std::size_t*
- Gets the row number for each cursor.
- auto valid() const -> bool
- Checks if the iterator is out of bounds.
Function documentation
cubos:: core:: ecs:: QueryFilter:: QueryFilter(World& world,
const std::vector<QueryTerm>& terms)
Constructs.
Parameters | |
---|---|
world | World being queried. |
terms | Query terms. |
cubos:: core:: ecs:: QueryFilter:: View(QueryFilter& filter,
QueryNode:: TargetMask pinMask = 0)
Constructs.
Parameters | |
---|---|
filter | Query filter. |
pinMask | Mask with the targets which are pinned. |
cubos:: core:: ecs:: QueryFilter:: View(const View& view) defaulted
Copy constructs.
Parameters | |
---|---|
view | Other view. |
cubos:: core:: ecs:: QueryFilter:: Iterator(const Iterator& other) defaulted
Copy constructs.
Parameters | |
---|---|
other | Other iterator. |
std::size_t cubos:: core:: ecs:: QueryFilter:: cursorIndex(std::size_t termIndex) const
Gets the cursor index for the given term index.
Parameters | |
---|---|
termIndex | Term index. |
Returns | Cursor index. |
int cubos:: core:: ecs:: QueryFilter:: targetCount() const
Gets the number of targets.
Returns | Target count. |
---|
View cubos:: core:: ecs:: QueryFilter:: pin(int target,
Entity entity)
Returns a new view equal to this one but with the given target pinned to the given entity.
Parameters | |
---|---|
target | Target index. |
entity | Entity. |
Returns | View. |
Effectively this filters out all matches where the given target isn't the given entity.
bool cubos:: core:: ecs:: QueryFilter:: operator==(const Iterator& other) const
Compares two iterators.
Parameters | |
---|---|
other | Other iterator. |
Returns | Whether the iterators point to the same match. |
const Match* cubos:: core:: ecs:: QueryFilter:: operator->() const
Accesses the match referenced by this iterator.
Returns | Match. |
---|
Iterator& cubos:: core:: ecs:: QueryFilter:: operator++()
Advances the iterator.
Returns | Reference to this. |
---|
const ArchetypeId* cubos:: core:: ecs:: QueryFilter:: targetArchetypes() const
Gets the archetype of each target.
Returns | Target archetypes array. |
---|
const int* cubos:: core:: ecs:: QueryFilter:: cursorDepths() const
Gets the depth level for each cursor (used for relation terms).
Returns | Cursor depth level array. |
---|
const std::size_t* cubos:: core:: ecs:: QueryFilter:: cursorRows() const
Gets the row number for each cursor.
Returns | Cursor row number array. |
---|
bool cubos:: core:: ecs:: QueryFilter:: valid() const
Checks if the iterator is out of bounds.
Returns | Whether the iterator is valid. |
---|