ConditionalFunctionExecutor.cpp 635 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-13
  6. * Changed: 2023-02-23
  7. *
  8. * */
  9. #include <ls-std/core/ConditionalFunctionExecutor.hpp>
  10. using ls::std::core::ConditionalFunctionExecutor;
  11. using std::function;
  12. ConditionalFunctionExecutor::ConditionalFunctionExecutor(bool _condition) : condition(_condition)
  13. {}
  14. ConditionalFunctionExecutor::~ConditionalFunctionExecutor() = default;
  15. void ConditionalFunctionExecutor::execute(const function<void()> &_function) const
  16. {
  17. if (this->condition)
  18. {
  19. _function();
  20. }
  21. }