]> www.ginac.de Git - ginac.git/blob - ginac/fail.cpp
Hunted down some output bugs. Hope it can be safely piped into Maple now.
[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 #include "ginac.h"
7
8 //////////
9 // default constructor, destructor, copy constructor assignment operator and helpers
10 //////////
11
12 // public
13
14 fail::fail() : basic(TINFO_FAIL)
15 {
16     debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT);
17 }
18
19 fail::~fail()
20 {
21     debugmsg("fail destructor",LOGLEVEL_DESTRUCT);
22     destroy(0);
23 }
24
25 fail::fail(fail const & other)
26 {
27     debugmsg("fail copy constructor",LOGLEVEL_CONSTRUCT);
28     copy(other);
29 }
30
31 fail const & fail::operator=(fail const & other)
32 {
33     debugmsg("fail operator=",LOGLEVEL_ASSIGNMENT);
34     if (this != &other) {
35         destroy(1);
36         copy(other);
37     }
38     return *this;
39 }
40
41 // protected
42
43 void fail::copy(fail const & other)
44 {
45     basic::copy(other);
46 }
47
48 void fail::destroy(bool call_parent)
49 {
50     if (call_parent) basic::destroy(call_parent);
51 }
52
53
54 //////////
55 // other constructors
56 //////////
57
58 // none
59
60 //////////
61 // functions overriding virtual functions from bases classes
62 //////////
63
64 // public
65
66 basic * fail::duplicate() const
67 {
68     debugmsg("fail duplicate",LOGLEVEL_DUPLICATE);
69     return new fail(*this);
70 }
71
72 // protected
73
74 int fail::compare_same_type(basic const & other) const
75 {
76         // two fails are always identical
77     return 0;
78 }
79
80 //////////
81 // new virtual functions which can be overridden by derived classes
82 //////////
83
84 // none
85
86 //////////
87 // non-virtual functions in this class
88 //////////
89
90 // none
91
92 //////////
93 // static member variables
94 //////////
95
96 // none
97
98 //////////
99 // global constants
100 //////////
101
102 const fail some_fail;
103 type_info const & typeid_fail=typeid(some_fail);
104