|
- #pragma once
-
- #include <set>
- #include <memory>
-
- #include <cppcore/synchronization/locked.h>
-
- #include "impl/timer_base.h"
- #include "impl/registration.h"
-
- namespace asyncpp {
- namespace timing {
-
- namespace __impl
- {
-
- template<typename T_inner>
- struct storage
- {
- using inner_type = T_inner;
-
- inner_type inner;
-
- template<typename... X_args>
- inline storage(X_args&&... p_args);
- };
-
- }
-
- template<typename T_inner = void>
- struct timer
- : public __impl::timer_base
- {
- public:
- using inner_type = T_inner;
- using storage_type = __impl::storage<inner_type>;
-
- private:
- storage_type _storage;
-
- public:
- /**
- * @brief Constructor.
- */
- template<typename... X_args>
- inline timer(X_args&&... p_args);
-
- /**
- * @brief Handle idle of the runtime.
- *
- * This method is called as soon as the runtime has nothing to do.
- * The passed deadline is the timepoint the method should return (or null if not set).
- */
- inline void idle(const asyncpp::time_point * p_deadline);
-
- private:
- /**
- * @brief Call the idle method of the inner runtime.
- */
- template<typename X = inner_type>
- inline auto inner_idle(const asyncpp::time_point * p_deadline)
- -> std::enable_if_t<std::is_same_v<X, void>>;
-
- /**
- * @brief Call the idle method of the inner runtime.
- */
- template<typename X = inner_type>
- inline auto inner_idle(const asyncpp::time_point * p_deadline)
- -> std::enable_if_t<!std::is_same_v<X, void>>;
- };
-
- } }
|