|
- #pragma once
-
- #include <ecs/config.h>
- #include <ecs/core/system/data_proxy/base.h>
-
- namespace ecs {
- namespace core {
- namespace system {
- namespace data_proxy {
-
- /**
- * data proxy to execute system non-parallel
- *
- * @tparam T_context context type of the ECS environment
- * @tparam T_instance system instance type
- */
- template<typename T_context, typename T_instance>
- struct multi
- : public base<T_context, T_instance>
- {
- private:
- using context_type = T_context;
- using instance_type = T_instance;
- using base_type = base<context_type, instance_type>;
-
- public: // private:
- size_t _index;
- size_t _begin;
- size_t _end;
-
- public:
- /**
- * create the multi data proxy
- *
- * @param p_context context of the ECS environment
- * @param p_instance system instance
- * @param p_index index of this data proxy
- * @param p_begin index of the first entity to process
- * @param p_end index of the first entity not to process
- */
- inline multi(context_type& p_context, instance_type& p_instance, size_t p_index, size_t p_begin, size_t p_end);
-
- /**
- * execute the given function for all entities handled by this data proxy
- *
- * @tparam T_func function type to execute
- *
- * @param func function to execute
- */
- template<typename T_func>
- inline void for_entities(T_func&& func) const;
-
- /**
- * execute the given function for all entities not handled by this data proxy
- *
- * @tparam T_func function type to execute
- *
- * @param func function to execute
- */
- template<typename T_func>
- void for_other_entities(T_func&& func) const;
-
- /**
- * execute the given function for all entities
- *
- * @tparam T_func function type to execute
- *
- * @param func function to execute
- */
- template<typename T_func>
- void for_all_entities(T_func&& func) const;
-
- /**
- * get the number of entities handled by this data proxy
- *
- * @return number of entities handle by this data proxy
- */
- inline size_t entity_count() const;
-
- /**
- * get the number of entities not handled by this data proxy
- *
- * @return number of entities not handle by this data proxy
- */
- inline size_t other_entity_count() const;
-
- /**
- * get the number of all entities
- *
- * @return number of all entities
- */
- inline size_t all_entity_count() const;
- };
-
- /**
- * create a multi data proxy (data proxy that does not execute in parallel)
- *
- * @tparam T_context context type
- * @tparam T_instance instance type
- *
- * @param context context
- * @param instance instance
- * @param index index of this data proxy
- * @param begin index of the first entity to process
- * @param end index of the first entity not to process
- *
- * @return multi data proxy
- */
- template<typename T_context, typename T_instance>
- constexpr decltype(auto) make_multi(T_context&& context, T_instance&& instance, size_t index, size_t begin, size_t end);
-
- } } } }
|