More ecs::accessor docs
This commit is contained in:
parent
e1150a98fc
commit
6833531edb
1 changed files with 12 additions and 0 deletions
|
|
@ -38,9 +38,18 @@ namespace psemek::ecs
|
||||||
|
|
||||||
struct accessor
|
struct accessor
|
||||||
{
|
{
|
||||||
|
/** Create an invalid accessor, i.e. one that doesn't refer to an entity.
|
||||||
|
*/
|
||||||
accessor() = default;
|
accessor() = default;
|
||||||
|
|
||||||
|
/** Copy the accessor.
|
||||||
|
*/
|
||||||
accessor(accessor const &) = default;
|
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;
|
explicit operator bool() const;
|
||||||
|
|
||||||
/** Obtain the component of the specified type of the accessed entity.
|
/** 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
|
* @tparam Component The type of component to obtain
|
||||||
* @return A pointer to the component of the specified type, or a null
|
* @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
|
* pointer if the entity doesn't contain a component of this type
|
||||||
|
* @pre The accessor is valid
|
||||||
*/
|
*/
|
||||||
template <typename Component>
|
template <typename Component>
|
||||||
Component * get_if();
|
Component * get_if();
|
||||||
|
|
@ -58,6 +68,7 @@ namespace psemek::ecs
|
||||||
* @return A reference to the component of the specified type
|
* @return A reference to the component of the specified type
|
||||||
* @throw component_not_found_exception if the entity doesn't
|
* @throw component_not_found_exception if the entity doesn't
|
||||||
* contain a component of this type
|
* contain a component of this type
|
||||||
|
* @pre The accessor is valid
|
||||||
*/
|
*/
|
||||||
template <typename Component>
|
template <typename Component>
|
||||||
Component & get();
|
Component & get();
|
||||||
|
|
@ -67,6 +78,7 @@ namespace psemek::ecs
|
||||||
* @tparam Component The type of component to obtain
|
* @tparam Component The type of component to obtain
|
||||||
* @return True if the entity contains a component of the specified
|
* @return True if the entity contains a component of the specified
|
||||||
* type, false otherwise
|
* type, false otherwise
|
||||||
|
* @pre The accessor is valid
|
||||||
*/
|
*/
|
||||||
template <typename Component>
|
template <typename Component>
|
||||||
bool contains() const;
|
bool contains() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue