]> www.ginac.de Git - ginac.git/blob - ginac/fail.cpp
- account for new GNU-automake built-scheme
[ginac.git] / ginac / fail.cpp
1 /** @file fail.cpp
2  *
3  *  Implementation of class signaling failure of operation. Considered
4  *  obsolete all this stuff ought to be replaced by exceptions.
5  *
6  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #include "fail.h"
24
25 //////////
26 // default constructor, destructor, copy constructor assignment operator and helpers
27 //////////
28
29 // public
30
31 fail::fail() : basic(TINFO_fail)
32 {
33     debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT);
34 }
35
36 fail::~fail()
37 {
38     debugmsg("fail destructor",LOGLEVEL_DESTRUCT);
39     destroy(0);
40 }
41
42 fail::fail(fail const & other)
43 {
44     debugmsg("fail copy constructor",LOGLEVEL_CONSTRUCT);
45     copy(other);
46 }
47
48 fail const & fail::operator=(fail const & other)
49 {
50     debugmsg("fail operator=",LOGLEVEL_ASSIGNMENT);
51     if (this != &other) {
52         destroy(1);
53         copy(other);
54     }
55     return *this;
56 }
57
58 // protected
59
60 void fail::copy(fail const & other)
61 {
62     basic::copy(other);
63 }
64
65 void fail::destroy(bool call_parent)
66 {
67     if (call_parent) basic::destroy(call_parent);
68 }
69
70
71 //////////
72 // other constructors
73 //////////
74
75 // none
76
77 //////////
78 // functions overriding virtual functions from bases classes
79 //////////
80
81 // public
82
83 basic * fail::duplicate() const
84 {
85     debugmsg("fail duplicate",LOGLEVEL_DUPLICATE);
86     return new fail(*this);
87 }
88
89 // protected
90
91 int fail::compare_same_type(basic const & other) const
92 {
93         // two fails are always identical
94     return 0;
95 }
96
97 //////////
98 // new virtual functions which can be overridden by derived classes
99 //////////
100
101 // none
102
103 //////////
104 // non-virtual functions in this class
105 //////////
106
107 // none
108
109 //////////
110 // static member variables
111 //////////
112
113 // none
114
115 //////////
116 // global constants
117 //////////
118
119 const fail some_fail;
120 type_info const & typeid_fail=typeid(some_fail);
121