Visual Computing Library  devel
Loading...
Searching...
No Matches
exceptions.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_MESH_EXCEPTIONS_H
24#define VCL_MESH_EXCEPTIONS_H
25
26#include <stdexcept>
27#include <string>
28
29namespace vcl {
30
37class InconsistentMeshException : public std::runtime_error
38{
39public:
40 InconsistentMeshException(const std::string& err) : std::runtime_error(err)
41 {
42 }
43
44 virtual const char* what() const throw()
45 {
46 static std::string error;
47 error =
48 std::string("Inconsistent Mesh - ") + std::runtime_error::what();
49 return error.c_str();
50 }
51};
52
60class MissingPreconditionException : public std::runtime_error
61{
62public:
63 MissingPreconditionException(const std::string& err) :
64 std::runtime_error(err)
65 {
66 }
67
68 virtual const char* what() const throw()
69 {
70 static std::string error;
71 error = std::string("Missing Mesh Precondition - ") +
72 std::runtime_error::what();
73 return error.c_str();
74 }
75};
76
83class MissingCompactnessException : public std::runtime_error
84{
85public:
86 MissingCompactnessException(const std::string& err) :
87 std::runtime_error(err)
88 {
89 }
90
91 virtual const char* what() const throw()
92 {
93 static std::string error;
94 error =
95 std::string("Lack of Compactness - ") + std::runtime_error::what();
96 return error.c_str();
97 }
98};
99
107class MissingComponentException : public std::runtime_error
108{
109public:
110 MissingComponentException(const std::string& err) : std::runtime_error(err)
111 {
112 }
113
114 virtual const char* what() const throw()
115 {
116 static std::string error;
117 error =
118 std::string("Missing Component - ") + std::runtime_error::what();
119 return error.c_str();
120 }
121};
122
130class MissingTriangularRequirementException : public std::runtime_error
131{
132public:
133 MissingTriangularRequirementException(const std::string& err) :
134 std::runtime_error(err)
135 {
136 }
137
138 virtual const char* what() const throw()
139 {
140 static std::string error;
141 error = std::string("Missing Triangular Mesh Requirement - ") +
142 std::runtime_error::what();
143 return error.c_str();
144 }
145};
146
153class MissingQuadRequirementException : public std::runtime_error
154{
155public:
156 MissingQuadRequirementException(const std::string& err) :
157 std::runtime_error(err)
158 {
159 }
160
161 virtual const char* what() const throw()
162 {
163 static std::string error;
164 error = std::string("Missing Quad Mesh Requirement - ") +
165 std::runtime_error::what();
166 return error.c_str();
167 }
168};
169
176class BadVertexIndexException : public std::runtime_error
177{
178public:
179 BadVertexIndexException(const std::string& err) : std::runtime_error(err) {}
180
181 virtual const char* what() const throw()
182 {
183 static std::string error;
184 error = std::string("Bad Vertex Index - ") + std::runtime_error::what();
185 return error.c_str();
186 }
187};
188
196class BadCustomComponentTypeException : public std::runtime_error
197{
198public:
199 BadCustomComponentTypeException(const std::string& err) :
200 std::runtime_error(err)
201 {
202 }
203
204 virtual const char* what() const throw()
205 {
206 static std::string error;
207 error = std::string("Bad Custom Component Type - ") +
208 std::runtime_error::what();
209 return error.c_str();
210 }
211};
212
213} // namespace vcl
214
215#endif // VCL_MESH_EXCEPTIONS_H
Exception thrown when the type of a custom component is not the one expected.
Definition exceptions.h:197
Exception thrown when an index is out of bounds in a vertex container.
Definition exceptions.h:177
A class representing a box in N-dimensional space.
Definition box.h:46
Exception thrown when the mesh is inconsistent.
Definition exceptions.h:38
Exception thrown when the mesh is not compact.
Definition exceptions.h:84
Exception thrown when a mesh/element component is missing (not enabled).
Definition exceptions.h:108
Exception thrown when a precondition on an input/output mesh is missing.
Definition exceptions.h:61
Exception thrown when an input/output mesh is not composed of quads.
Definition exceptions.h:154
Exception thrown when an input/output mesh is not composed of triangles.
Definition exceptions.h:131