]> www.ginac.de Git - ginac.git/blob - ginac/fail.cpp
documentation update
[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 namespace GiNaC {
29
30 GINAC_IMPLEMENT_REGISTERED_CLASS(fail, basic)
31
32 //////////
33 // default ctor, dtor, copy ctor assignment operator and helpers
34 //////////
35
36 // public
37
38 fail::fail() : inherited(TINFO_fail)
39 {
40         debugmsg("fail default ctor",LOGLEVEL_CONSTRUCT);
41 }
42
43 // protected
44
45 void fail::copy(const fail & other)
46 {
47         inherited::copy(other);
48 }
49
50 void fail::destroy(bool call_parent)
51 {
52         if (call_parent) inherited::destroy(call_parent);
53 }
54
55 //////////
56 // archiving
57 //////////
58
59 /** Construct object from archive_node. */
60 fail::fail(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
61 {
62         debugmsg("fail ctor from archive_node", LOGLEVEL_CONSTRUCT);
63 }
64
65 /** Unarchive the object. */
66 ex fail::unarchive(const archive_node &n, const lst &sym_lst)
67 {
68         return (new fail(n, sym_lst))->setflag(status_flags::dynallocated);
69 }
70
71 /** Archive the object. */
72 void fail::archive(archive_node &n) const
73 {
74         inherited::archive(n);
75 }
76
77 //////////
78 // functions overriding virtual functions from bases classes
79 //////////
80
81 // public
82
83 void fail::print(std::ostream & os, unsigned upper_precedence) const
84 {
85         debugmsg("fail print",LOGLEVEL_PRINT);
86         os << "FAIL";
87 }
88
89 void fail::printraw(std::ostream & os) const
90 {
91         debugmsg("fail printraw",LOGLEVEL_PRINT);
92         os << "FAIL";
93 }
94
95 // protected
96
97 int fail::compare_same_type(const basic & other) const
98 {
99         // two fails are always identical
100         return 0;
101 }
102
103 } // namespace GiNaC