]> www.ginac.de Git - ginac.git/blob - ginac/fail.cpp
building in separate directory didn't work
[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 /*
7  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include "fail.h"
25 #include "archive.h"
26 #include "debugmsg.h"
27
28 #ifndef NO_NAMESPACE_GINAC
29 namespace GiNaC {
30 #endif // ndef NO_NAMESPACE_GINAC
31
32 GINAC_IMPLEMENT_REGISTERED_CLASS(fail, basic)
33
34 //////////
35 // default constructor, destructor, copy constructor assignment operator and helpers
36 //////////
37
38 // public
39
40 fail::fail() : inherited(TINFO_fail)
41 {
42         debugmsg("fail default constructor",LOGLEVEL_CONSTRUCT);
43 }
44
45 // protected
46
47 void fail::copy(const fail & other)
48 {
49         inherited::copy(other);
50 }
51
52 void fail::destroy(bool call_parent)
53 {
54         if (call_parent) inherited::destroy(call_parent);
55 }
56
57 //////////
58 // archiving
59 //////////
60
61 /** Construct object from archive_node. */
62 fail::fail(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
63 {
64         debugmsg("fail constructor from archive_node", LOGLEVEL_CONSTRUCT);
65 }
66
67 /** Unarchive the object. */
68 ex fail::unarchive(const archive_node &n, const lst &sym_lst)
69 {
70         return (new fail(n, sym_lst))->setflag(status_flags::dynallocated);
71 }
72
73 /** Archive the object. */
74 void fail::archive(archive_node &n) const
75 {
76         inherited::archive(n);
77 }
78
79 //////////
80 // functions overriding virtual functions from bases classes
81 //////////
82
83 // public
84
85 void fail::print(std::ostream & os, unsigned upper_precedence) const
86 {
87         debugmsg("fail print",LOGLEVEL_PRINT);
88         os << "FAIL";
89 }
90
91 void fail::printraw(std::ostream & os) const
92 {
93         debugmsg("fail printraw",LOGLEVEL_PRINT);
94         os << "FAIL";
95 }
96
97 // protected
98
99 int fail::compare_same_type(const basic & other) const
100 {
101         // two fails are always identical
102         return 0;
103 }
104
105 #ifndef NO_NAMESPACE_GINAC
106 } // namespace GiNaC
107 #endif // ndef NO_NAMESPACE_GINAC