ConditionalFunctionExecutor.hpp 910 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-13
  6. * Changed: 2024-09-11
  7. *
  8. * */
  9. #ifndef LS_STD_CONDITIONAL_FUNCTION_EXECUTOR_HPP
  10. #define LS_STD_CONDITIONAL_FUNCTION_EXECUTOR_HPP
  11. #include <functional>
  12. #include <ls-std/os/dynamic-goal.hpp>
  13. /*
  14. * @doc: class(name: 'ConditionalFunctionExecutor', package: 'core')
  15. * @doc: core.ConditionalFunctionExecutor.description('This class can execute any method matching a specific signature based on a specific condition.')
  16. * */
  17. namespace ls::std::core
  18. {
  19. class LS_STD_DYNAMIC_GOAL ConditionalFunctionExecutor
  20. {
  21. public:
  22. explicit ConditionalFunctionExecutor(bool _condition);
  23. ~ConditionalFunctionExecutor();
  24. void execute(const ::std::function<void()> &_function) const;
  25. private:
  26. bool condition{};
  27. };
  28. }
  29. #endif