glucat 0.13.0
errors_imp.h
Go to the documentation of this file.
1#ifndef _GLUCAT_ERRORS_IMP_H
2#define _GLUCAT_ERRORS_IMP_H
3/***************************************************************************
4 GluCat : Generic library of universal Clifford algebra templates
5 errors_imp.h : Define error functions
6 -------------------
7 begin : Sun 2001-12-20
8 copyright : (C) 2001-2007 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 "glucat/errors.h"
35
36#include <string>
37#include <iostream>
38#include <ostream>
39
40namespace glucat
41{
43 template< class Class_T >
45 error(const std::string& msg)
46 : glucat_error(Class_T::classname(), msg)
47 { }
48
49 template< class Class_T >
51 error(const std::string& context, const std::string& msg)
52 : glucat_error(context, msg)
53 { }
54
55 template< class Class_T >
56 auto
58 heading() const noexcept -> const std::string
59 { return "Error in glucat::"; }
61 template< class Class_T >
62 auto
64 classname() const noexcept -> const std::string
65 { return name; }
66
67 template< class Class_T >
68 void
70 print_error_msg() const
71 { std::cerr << heading() << classname() << std::endl << what() << std::endl; }
72}
73#endif // _GLUCAT_ERRORS_IMP_H
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
Definition errors_imp.h:64
void print_error_msg() const override
Definition errors_imp.h:70
glucat_error(const std::string &context, const std::string &msg)
Definition errors.h:44
std::string name
Definition errors.h:51