Struct basic_collector<>

Synopsis

#include <src/entt/entity/observer.hpp>

template<>
struct basic_collector<>

Description

Collector.

A collector contains a set of rules (literally, matchers) to use to track entities.
Its main purpose is to generate a descriptor that allows an observer to know how to connect to a registry.

Methods

groupAdds a grouping matcher to the collector.
updateAdds an observing matcher to the collector.

Source

Lines 46-68 in src/entt/entity/observer.hpp.

template<>
struct basic_collector<> {
    /**
     * @brief Adds a grouping matcher to the collector.
     * @tparam AllOf Types of components tracked by the matcher.
     * @tparam NoneOf Types of components used to filter out entities.
     * @return The updated collector.
     */
    template<typename... AllOf, typename... NoneOf>
    static constexpr auto group(exclude_t<NoneOf...> = {}) ENTT_NOEXCEPT {
        return basic_collector<matcher<type_list<>, type_list<>, type_list<NoneOf...>, AllOf...>>{};
    }

    /**
     * @brief Adds an observing matcher to the collector.
     * @tparam AnyOf Type of component for which changes should be detected.
     * @return The updated collector.
     */
    template<typename AnyOf>
    static constexpr auto update() ENTT_NOEXCEPT {
        return basic_collector<matcher<type_list<>, type_list<>, AnyOf>>{};
    }
};





Add Discussion

Log in to comment