A set of benchmarks to compare a new prototype MiniZinc implementation
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#ifndef __MINIZINC_EXCEPTION_HH__
13#define __MINIZINC_EXCEPTION_HH__
14
15#include <exception>
16#include <string>
17
18namespace MiniZinc {
19
20class Exception : public std::exception {
21protected:
22 std::string _msg;
23
24public:
25 Exception(const std::string& msg) : _msg(msg) {}
26 virtual ~Exception(void) throw() {}
27 virtual const char* what(void) const throw() = 0;
28 const std::string& msg(void) const { return _msg; }
29};
30
31class ParseException : public Exception {
32public:
33 ParseException(const std::string& msg) : Exception(msg) {}
34 ~ParseException(void) throw() {}
35 virtual const char* what(void) const throw() { return ""; }
36};
37
38class InternalError : public Exception {
39public:
40 InternalError(const std::string& msg) : Exception(msg) {}
41 ~InternalError(void) throw() {}
42 virtual const char* what(void) const throw() { return "MiniZinc: internal error"; }
43};
44
45class Error : public Exception {
46public:
47 Error(const std::string& msg) : Exception(msg) {}
48 ~Error(void) throw() {}
49 virtual const char* what(void) const throw() { return ""; }
50};
51
52class Timeout : public Exception {
53public:
54 Timeout(void) : Exception("time limit reached") {}
55 ~Timeout(void) throw() {}
56 virtual const char* what(void) const throw() { return "MiniZinc: time out"; }
57};
58
59class ArithmeticError : public Exception {
60public:
61 ArithmeticError(const std::string& msg) : Exception(msg) {}
62 virtual ~ArithmeticError(void) throw() {}
63 virtual const char* what(void) const throw() { return "MiniZinc: arithmetic error"; }
64};
65
66} // namespace MiniZinc
67
68#endif