ecs::SparseArray
#include <SparseArray.hpp>
Public Types
Public Functions
SparseArray(SparseArray const & other)
SparseArray(SparseArray && other)
~SparseArray() =default
operator=(SparseArray const & other)
operator=(SparseArray && other)
operator[](size_t idx)
operator[](size_t idx) const
begin() const
cBegin() const
end() const
cEnd() const
template <class... Params> referenceType
Detailed Description
template <typename Component >
class ecs::SparseArray;
Template Parameters:
Component The type of component used as with template
SparseArray class is the component container of the ecs.
This can be quite useful to store components that are defined for most entities, because you don't have to store the entity ID alongside the component.
Public Types Documentation
using valueType
using ecs::SparseArray< Component >::valueType = std::optional<Component>;
using referenceType
using ecs::SparseArray< Component >::referenceType = valueType &;
using constReferenceType
using ecs::SparseArray< Component >::constReferenceType = valueType const &;
using container
using ecs::SparseArray< Component >::container = std::vector<valueType>;
using sizeType
using ecs::SparseArray< Component >::sizeType = typename container::size_type;
using iterator
using ecs::SparseArray< Component >::iterator = typename container::iterator;
using constIterator
using ecs::SparseArray< Component >::constIterator = typename container::const_iterator;
Public Functions Documentation
function SparseArray
inline SparseArray()
Default constructor & destructor of the SparseArray class
function SparseArray
inline SparseArray(
SparseArray const & other
)
function SparseArray
inline SparseArray(
SparseArray && other
)
function ~SparseArray
~SparseArray() =default
function operator=
inline SparseArray & operator=(
SparseArray const & other
)
Parameters:
other The SparseArray you want to copy
Return: The Sparse array present in the class at the moment
Operator copy of the SparseArray class
function operator=
inline SparseArray & operator=(
SparseArray && other
)
Parameters:
other The SparseArray you want to move
Return: The Sparse array present in the class at the moment
Operator move of the SparseArray class
function operator[]
inline referenceType operator[](
size_t idx
)
function operator[]
inline constReferenceType operator[](
size_t idx
) const
function begin
inline iterator begin()
function begin
inline constIterator begin() const
function cBegin
inline constIterator cBegin() const
function end
inline iterator end()
function end
inline constIterator end() const
function cEnd
inline constIterator cEnd() const
function size
inline sizeType size() const
function insertAt
inline referenceType insertAt(
sizeType pos,
Component const & c
)
function insertAt
inline referenceType insertAt(
sizeType pos,
Component && c
)
function emplaceAt
template <class... Params>
inline referenceType emplaceAt(
sizeType pos,
Params &&... args
)
function erase
inline void erase(
sizeType pos
)
function getIndex
inline sizeType getIndex(
valueType const & c
) const
Parameters:
c The std::optional, type of the component you want the index
Return: The sizeType of the valueType's index you are looking for
This function is used to get the index of the std::optional of the std::vector<std::optional> _data according to the given valueType (std::optional)
Updated on 2022-11-13 at 17:21:37 +0100
Last updated