1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 
3 /*
4  *  Main authors:
5  *     Guido Tack <guido.tack@monash.edu>
6  */
7 
8 /* This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 
12 #pragma once
13 
14 #include <minizinc/flatten_internal.hh>
15 #include <minizinc/hash.hh>
16 
17 namespace MiniZinc {
18 
19 class OptimizeRegistry {
20 public:
21   enum ConstraintStatus { CS_NONE, CS_OK, CS_FAILED, CS_ENTAILED, CS_REWRITE };
22   typedef ConstraintStatus (*optimizer)(EnvI& env, Item* i, Call* c, Expression*& rewrite);
23 
24 protected:
25   ASTStringMap<optimizer> _m;
26 
27 public:
28   void reg(const ASTString& call, optimizer opt);
29   ConstraintStatus process(EnvI& env, Item* i, Call* c, Expression*& rewrite);
30 
31   static OptimizeRegistry& registry();
32 };
33 
34 }  // namespace MiniZinc
35