CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418384
1
/*
2
* Normaliz
3
* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*
17
* As an exception, when this program is distributed through (i) the App Store
18
* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play
19
* by Google Inc., then that store may impose any digital rights management,
20
* device limits and/or redistribution restrictions that are required by its
21
* terms of service.
22
*/
23
24
#ifndef NORMALIZ_EXEPTION_H_
25
#define NORMALIZ_EXEPTION_H_
26
27
#include <exception>
28
#include <string>
29
#include <sstream>
30
#include <libQnormaliz/libQnormaliz.h>
31
#include <libQnormaliz/Qcone_property.h>
32
33
namespace libQnormaliz {
34
35
class NormalizException: public std::exception {
36
public:
37
virtual const char* what() const throw() = 0;
38
};
39
40
class ArithmeticException: public NormalizException {
41
public:
42
ArithmeticException() : msg("Arithmetic Overflow detected, try a bigger integer type!") {}
43
~ArithmeticException() throw() {}
44
45
template<typename Number>
46
ArithmeticException(const Number& convert_number){
47
std::stringstream stream;
48
stream << "Could not convert " << convert_number << ".\n";
49
stream << "Arithmetic Overflow detected, try a bigger integer type!";
50
msg = stream.str();
51
}
52
53
virtual const char* what() const throw() {
54
return msg.c_str();
55
}
56
57
private:
58
std::string msg;
59
};
60
61
class NonpointedException: public NormalizException {
62
public:
63
virtual const char* what() const throw() {
64
return "Cone is not pointed.";
65
}
66
};
67
68
class NotIntegrallyClosedException: public NormalizException {
69
public:
70
virtual const char* what() const throw() {
71
return "Original monoid is not integrally closed.";
72
}
73
};
74
75
class BadInputException: public NormalizException {
76
public:
77
BadInputException(const std::string& message) :
78
msg("Some error in the normaliz input data detected: " + message)
79
{}
80
~BadInputException() throw() {}
81
82
virtual const char* what() const throw() {
83
return msg.c_str();
84
}
85
86
private:
87
std::string msg;
88
};
89
90
class NotComputableException: public NormalizException {
91
public:
92
NotComputableException(const std::string& message) : msg("Could not compute: " + message) {}
93
NotComputableException(const ConeProperties& missing) {
94
std::stringstream stream;
95
stream << "Could not compute: " << missing << "!";
96
msg = stream.str();
97
}
98
~NotComputableException() throw() {}
99
100
virtual const char* what() const throw() {
101
return msg.c_str();
102
}
103
104
private:
105
std::string msg;
106
};
107
108
class FatalException: public NormalizException {
109
public:
110
FatalException(const std::string& message) :
111
msg("Fatal error: " + message +"\nThis should not happen, please contact the developers!")
112
{}
113
~FatalException() throw() {}
114
115
virtual const char* what() const throw() {
116
return msg.c_str();
117
}
118
119
private:
120
std::string msg;
121
};
122
123
124
} /* end namespace */
125
126
#endif /* LIBNORMALIZ_H_ */
127
128