wfmath
1.0.3
A math library for the Worldforge system.
error.h
1
// -*-C++-*-
2
// error.h (Class structures for errors thrown by the WFMath library)
3
//
4
// The WorldForge Project
5
// Copyright (C) 2001 The WorldForge Project
6
//
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
//
21
// For information about WorldForge and its authors, please contact
22
// the Worldforge Web Site at http://www.worldforge.org.
23
24
// Author: Ron Steinke
25
// Created: 2001-12-7
26
27
#ifndef WFMATH_ERROR_H
28
#define WFMATH_ERROR_H
29
30
#include <stdexcept>
31
#include <wfmath/vector.h>
32
33
namespace
WFMath
{
34
36
template
<
int
dim>
37
struct
ColinearVectors
:
virtual
public
std::exception {
38
ColinearVectors
(
const
Vector <dim>
& v1_in,
const
Vector <dim>
& v2_in)
39
: v1(v1_in), v2(v2_in) {}
40
41
ColinearVectors
(
const
ColinearVectors
& rhs) noexcept
42
: v1(rhs.v1), v2(rhs.v2) {}
43
44
~
ColinearVectors
() noexcept
override
=
default
;
45
46
Vector <dim>
v1, v2;
47
48
const
char
* what()
const
noexcept
override
{
49
return
"WFMath::ColinearVectors exception. Supplied vectors are parallel."
;
50
}
51
};
52
54
struct
ParseError
:
virtual
public
std::runtime_error {
55
ParseError
() : std::runtime_error(
"WFMath::ParseError exception."
) {}
56
57
~
ParseError
() noexcept
override
=
default
;
58
};
59
60
}
// namespace WFMath
61
62
#endif // WFMATH_ERROR_H
WFMath::ColinearVectors
An error thrown by certain functions when passed parallel vectors.
Definition:
error.h:37
WFMath
Generic library namespace.
Definition:
shape.h:41
WFMath::Vector
A dim dimensional vector.
Definition:
const.h:55
WFMath::ParseError
An error thrown by operator>>() when it fails to parse wfmath types.
Definition:
error.h:54
src
wfmath
error.h
Generated by
1.8.18