glucat 0.12.0
errors.h
Go to the documentation of this file.
1#ifndef _GLUCAT_ERRORS_H
2#define _GLUCAT_ERRORS_H
3/***************************************************************************
4 GluCat : Generic library of universal Clifford algebra templates
5 errors.h : Declare error classes and functions
6 -------------------
7 begin : Sun 2001-12-09
8 copyright : (C) 2001-2012 by Paul C. Leopardi
9 ***************************************************************************
10
11 This library is free software: you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 This library 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 GNU Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with this library. If not, see <http://www.gnu.org/licenses/>.
23
24 ***************************************************************************
25 This library is based on a prototype written by Arvind Raja and was
26 licensed under the LGPL with permission of the author. See Arvind Raja,
27 "Object-oriented implementations of Clifford algebras in C++: a prototype",
28 in Ablamowicz, Lounesto and Parra (eds.)
29 "Clifford algebras with numeric and symbolic computations", Birkhauser, 1996.
30 ***************************************************************************
31 See also Arvind Raja's original header comments in glucat.h
32 ***************************************************************************/
33
34#include <string>
35#include <exception>
36#include <stdexcept>
37
38namespace glucat
39{
41 class glucat_error : public std::logic_error
42 {
43 public:
44 glucat_error(const std::string& context, const std::string& msg)
45 : logic_error(msg), name(context)
46 { }
47 ~glucat_error() noexcept override = default;
48 virtual auto heading() const noexcept -> const std::string =0;
49 virtual auto classname() const noexcept -> const std::string =0;
50 virtual void print_error_msg() const =0;
51 std::string name;
52 };
53
55 template< class Class_T >
56 class error : public glucat_error
57 {
58 public:
59 error(const std::string& msg);
60 error(const std::string& context, const std::string& msg);
61 auto heading() const noexcept -> const std::string override;
62 auto classname() const noexcept -> const std::string override;
63 void print_error_msg() const override;
64 };
65}
66#endif // _GLUCAT_ERRORS_H
error(const std::string &context, const std::string &msg)
Definition errors_imp.h:51
error(const std::string &msg)
Specific exception class.
Definition errors_imp.h:45
auto heading() const noexcept -> const std::string override
Definition errors_imp.h:58
auto classname() const noexcept -> const std::string override
void print_error_msg() const override
virtual auto heading() const noexcept -> const std::string=0
glucat_error(const std::string &context, const std::string &msg)
Definition errors.h:44
virtual void print_error_msg() const =0
~glucat_error() noexcept override=default
std::string name
Definition errors.h:51
virtual auto classname() const noexcept -> const std::string=0