diff options
author | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 13:11:31 -0800 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-01-27 13:11:31 -0800 |
commit | 02819db3483514d49df7ec3f7e372b5aeb831466 (patch) | |
tree | 6a86adac74beac293bc688dafcfa1709a6476901 /vendor/bandit/bandit/run_policies/run_policy.h | |
parent | 2a61dffe127e22c1aaf955db6f085ac2eefbebba (diff) | |
parent | 6f6de67c70fd98815088ce49f046f48f88ea35bd (diff) |
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
# Conflicts:
# src/CMakeLists.txt
# src/config.h
# src/lua/llimits.h
Diffstat (limited to 'vendor/bandit/bandit/run_policies/run_policy.h')
-rw-r--r-- | vendor/bandit/bandit/run_policies/run_policy.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/bandit/bandit/run_policies/run_policy.h b/vendor/bandit/bandit/run_policies/run_policy.h new file mode 100644 index 00000000..4a6e8e1d --- /dev/null +++ b/vendor/bandit/bandit/run_policies/run_policy.h @@ -0,0 +1,44 @@ +#ifndef BANDIT_RUN_POLICY_H +#define BANDIT_RUN_POLICY_H + +namespace bandit { namespace detail { + + struct run_policy + { + run_policy() : encountered_failure_(false) {} + run_policy(const run_policy& other) = default; + run_policy(run_policy&&) = default; + virtual ~run_policy() {} + + virtual bool should_run(const char* it_name, const contextstack_t& contexts) const = 0; + + virtual void encountered_failure() + { + encountered_failure_ = true; + } + + virtual bool has_encountered_failure() const + { + return encountered_failure_; + } + + private: + bool encountered_failure_; + }; + typedef std::unique_ptr<run_policy> run_policy_ptr; + + inline run_policy& registered_run_policy(run_policy* policy = NULL) + { + static struct run_policy* policy_; + + if(policy) + { + policy_ = policy; + } + + return *policy_; + } + +}} + +#endif |