Skip to content

Commit

Permalink
add condition_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Jul 9, 2017
1 parent 8c2d555 commit 6649c0f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/core/grabber/include/manipulator/condition_manager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "manipulator/manipulator_factory.hpp"

namespace krbn {
namespace manipulator {
class condition_manager final {
public:
condition_manager(const condition_manager&) = delete;

condition_manager(void) {
}

void push_back_condition(const nlohmann::json& json) {
conditions_.push_back(manipulator_factory::make_condition(json));
}

bool is_fulfilled(const krbn::manipulator_environment& manipulator_environment) const {
bool result = true;

for (const auto& c : conditions_) {
if (!c->is_fulfilled(manipulator_environment)) {
result = false;
}
}

return result;
}

private:
std::vector<std::shared_ptr<krbn::manipulator::details::conditions::base>> conditions_;
};
} // namespace manipulator
} // namespace krbn

0 comments on commit 6649c0f

Please sign in to comment.