ConditionalFunctionExecutor.cpp 615 B

1234567891011121314151617181920212223
  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-21
  7. *
  8. * */
  9. #include <ls-std/core/ConditionalFunctionExecutor.hpp>
  10. ls::std::core::ConditionalFunctionExecutor::ConditionalFunctionExecutor(bool _condition) : condition(_condition)
  11. {}
  12. ls::std::core::ConditionalFunctionExecutor::~ConditionalFunctionExecutor() = default;
  13. void ls::std::core::ConditionalFunctionExecutor::execute(const ::std::function<void()> &_function) const
  14. {
  15. if (this->condition)
  16. {
  17. _function();
  18. }
  19. }