More ecs::accessor docs

This commit is contained in:
Nikita Lisitsa 2023-12-16 19:58:17 +03:00
parent e1150a98fc
commit 6833531edb

View file

@ -38,9 +38,18 @@ namespace psemek::ecs
struct accessor
{
/** Create an invalid accessor, i.e. one that doesn't refer to an entity.
*/
accessor() = default;
/** Copy the accessor.
*/
accessor(accessor const &) = default;
/** Check if this accessor is valid, i.e. refers to an entity.
*
* @return True if the accessor is valid, false otherwise
*/
explicit operator bool() const;
/** Obtain the component of the specified type of the accessed entity.
@ -48,6 +57,7 @@ namespace psemek::ecs
* @tparam Component The type of component to obtain
* @return A pointer to the component of the specified type, or a null
* pointer if the entity doesn't contain a component of this type
* @pre The accessor is valid
*/
template <typename Component>
Component * get_if();
@ -58,6 +68,7 @@ namespace psemek::ecs
* @return A reference to the component of the specified type
* @throw component_not_found_exception if the entity doesn't
* contain a component of this type
* @pre The accessor is valid
*/
template <typename Component>
Component & get();
@ -67,6 +78,7 @@ namespace psemek::ecs
* @tparam Component The type of component to obtain
* @return True if the entity contains a component of the specified
* type, false otherwise
* @pre The accessor is valid
*/
template <typename Component>
bool contains() const;