From 76f94a8cdd2945e26d716191b664eb906ebb9032 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 7 Dec 2024 14:36:08 +0100 Subject: add doxygen comments --- src/crepe/manager/ComponentManager.h | 40 +++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'src/crepe') diff --git a/src/crepe/manager/ComponentManager.h b/src/crepe/manager/ComponentManager.h index e7eeaa2..19a8e81 100644 --- a/src/crepe/manager/ComponentManager.h +++ b/src/crepe/manager/ComponentManager.h @@ -155,18 +155,55 @@ public: RefVector get_components_by_tag(const std::string & tag) const; private: + /** + * \brief Get object IDs by predicate function + * + * This function calls the predicate function \c pred for all components matching type \c T, + * and adds their parent game_object_id to a \c std::set if the predicate returns true. + * + * \tparam T The type of the component to check the predicate against + * \param pred Predicate function + * + * \note The predicate function may be called for multiple components with the same \c + * game_object_id. In this case, the ID is added if *any* call returns \c true. + * + * \returns game_object_id for all components where the predicate returned true + */ template std::set get_objects_by_predicate(const std::function & pred) const; + + /** + * \brief Get components of type \c T for multiple game object IDs + * + * \tparam T The type of the components to return + * \param ids The object IDs + * + * \return All components matching type \c T and one of the IDs in \c ids + */ template RefVector get_components_by_ids(const std::set & ids) const; + /** + * \brief Get object IDs for objects with name \c name + * + * \param name Object name to match + * \returns Object IDs where Metadata::name is equal to \c name + */ std::set get_objects_by_name(const std::string & name) const; + /** + * \brief Get object IDs for objects with tag \c tag + * + * \param tag Object tag to match + * \returns Object IDs where Metadata::tag is equal to \c tag + */ std::set get_objects_by_tag(const std::string & tag) const; private: + //! By Component \c std::type_index (readability helper type) template using by_type = std::unordered_map; + //! By \c game_object_id index (readability helper type) template using by_id_index = std::vector; /** @@ -188,9 +225,6 @@ private: game_object_id_t next_id = 0; }; -// template <> -// RefVector ComponentManager::get_components_by_id(game_object_id_t id) const; - } // namespace crepe #include "ComponentManager.hpp" -- cgit v1.2.3