|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
A view that iterates over entities possessing all specified components. More...
#include <ZipView.hpp>
Classes | |
| class | Iterator |
| The actual iterator performing the intersection logic. More... | |
Public Types | |
| using | tuple_arrays_t = std::tuple< Containers... > |
| Tuple type holding references to all SparseArrays. | |
Public Member Functions | |
| ZipView (Containers... arrays) | |
| Constructor for ZipView. | |
| Iterator | begin () |
| Get iterator to the beginning of the zipped view. | |
| Iterator | end () |
| Get iterator to the end of the zipped view. | |
Private Member Functions | |
| template<size_t I> | |
| void | findSmallest (size_t &min_size) |
| Find the index of the SparseArray with the smallest size. | |
| std::span< const Entity > | getEntitiesFromSmallest (size_t index) |
| Get the entity list from the SparseArray at the specified index. | |
Private Attributes | |
| tuple_arrays_t | _arrays |
| Tuple of references to SparseArrays. | |
| size_t | _smallest_idx = 0 |
| Index of the SparseArray with the fewest entities. | |
A view that iterates over entities possessing all specified components.
| Containers | The types of the SparseArrays (e.g., SparseArray<Pos>&, SparseArray<Vel>&) |
Definition at line 26 of file ZipView.hpp.
| using rtp::ecs::ZipView< Containers >::tuple_arrays_t = std::tuple<Containers...> |
Tuple type holding references to all SparseArrays.
Definition at line 31 of file ZipView.hpp.
|
inline |
Constructor for ZipView.
| arrays | References to the SparseArrays to zip |
Definition at line 110 of file ZipView.hpp.
References rtp::ecs::ZipView< Containers >::_arrays, and rtp::ecs::ZipView< Containers >::_smallest_idx.
|
inline |
Get iterator to the beginning of the zipped view.
Definition at line 120 of file ZipView.hpp.
References rtp::ecs::ZipView< Containers >::_arrays, rtp::ecs::ZipView< Containers >::_smallest_idx, and rtp::ecs::ZipView< Containers >::getEntitiesFromSmallest().
|
inline |
Get iterator to the end of the zipped view.
Definition at line 129 of file ZipView.hpp.
References rtp::ecs::ZipView< Containers >::_arrays, rtp::ecs::ZipView< Containers >::_smallest_idx, and rtp::ecs::ZipView< Containers >::getEntitiesFromSmallest().
|
inlineprivate |
Find the index of the SparseArray with the smallest size.
| I | Current index in the tuple |
| min_size | Reference to the current minimum size found |
Definition at line 144 of file ZipView.hpp.
References rtp::ecs::ZipView< Containers >::_arrays, and rtp::ecs::ZipView< Containers >::_smallest_idx.
|
inlineprivate |
Get the entity list from the SparseArray at the specified index.
| index | Index of the SparseArray in the tuple |
Definition at line 160 of file ZipView.hpp.
References rtp::ecs::ZipView< Containers >::_arrays.
Referenced by rtp::ecs::ZipView< Containers >::begin(), and rtp::ecs::ZipView< Containers >::end().
|
private |
Tuple of references to SparseArrays.
Definition at line 135 of file ZipView.hpp.
Referenced by rtp::ecs::ZipView< Containers >::ZipView(), rtp::ecs::ZipView< Containers >::begin(), rtp::ecs::ZipView< Containers >::end(), rtp::ecs::ZipView< Containers >::findSmallest(), and rtp::ecs::ZipView< Containers >::getEntitiesFromSmallest().
|
private |
Index of the SparseArray with the fewest entities.
Definition at line 136 of file ZipView.hpp.
Referenced by rtp::ecs::ZipView< Containers >::ZipView(), rtp::ecs::ZipView< Containers >::begin(), rtp::ecs::ZipView< Containers >::end(), and rtp::ecs::ZipView< Containers >::findSmallest().