summaryrefslogtreecommitdiff
path: root/vendor/bandit/bandit/run_policies/run_policy.h
blob: 7440e1cd54ad3dbf8fce6765a09ca762871f1915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef BANDIT_RUN_POLICY_H
#define BANDIT_RUN_POLICY_H

namespace bandit { namespace detail {

  struct run_policy
  {
    virtual ~run_policy() {}
    virtual bool should_run(const char* it_name, const contextstack_t& contexts) const = 0;
  };
  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