- #pragma once
-
- #include <ecs/config.h>
-
- namespace ecs {
- namespace core {
- namespace system {
- namespace parallelism {
-
- template<typename T_parameters>
- struct fixed_threshold
- {
- using parameters_type = T_parameters;
- using strategy_lower_type = typename parameters_type::strategy_lower_type;
- using strategy_greater_type = typename parameters_type::strategy_greater_type;
-
- strategy_lower_type _strategy_lower;
- strategy_greater_type _strategy_greater;
-
- template<typename T_context, typename T_instance, typename T_func>
- inline void operator()(T_context& context, T_instance& instance, T_func&& func) const
- {
- bool threshold_reached = instance.subscribed_count() >= parameters_type::get_threshold();
- if (!threshold_reached) _strategy_lower (instance, context, std::forward<T_func>(func));
- else _strategy_greater(instance, context, std::forward<T_func>(func));
- }
- };
-
- } } } }
|