X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffail.h;h=a537fa0491214480e99a2e9b4e03b43d27d7e882;hp=c2942cc7e32185a40cdb2a1a2ead328a478e37cb;hb=94155cc1f3da766086f4367457be50b20a7ff436;hpb=1bd972bf8e4eeeb8aec6081100876e81a7f18450 diff --git a/ginac/fail.h b/ginac/fail.h index c2942cc7..a537fa04 100644 --- a/ginac/fail.h +++ b/ginac/fail.h @@ -1,10 +1,10 @@ /** @file fail.h * - * Interface to class signaling failure of operation. Considered obsolete all - * this stuff ought to be replaced by exceptions. */ + * Interface to class signaling failure of operation. Considered obsolete + * somewhat obsolete (most of this can be replaced by exceptions). */ /* - * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,36 +26,25 @@ #include "basic.h" -#ifndef NO_NAMESPACE_GINAC namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC class fail : public basic { GINAC_DECLARE_REGISTERED_CLASS(fail, basic) - - // other constructors - // none - - // functions overriding virtual functions from bases classes + + // functions overriding virtual functions from base classes public: - void print(std::ostream & os, unsigned upper_precedence=0) const; - void printraw(std::ostream & os) const; + void print(const print_context & c, unsigned level = 0) const; protected: - unsigned return_type(void) const { return return_types::noncommutative_composite; }; - - // new virtual functions which can be overridden by derived classes - // none - - // non-virtual functions in this class - // none - - // member variables - // none + unsigned return_type() const { return return_types::noncommutative_composite; }; }; -#ifndef NO_NAMESPACE_GINAC +/** Specialization of is_exactly_a(obj) for fail objects. */ +template<> inline bool is_exactly_a(const basic & obj) +{ + return obj.tinfo()==TINFO_fail; +} + } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC #endif // ndef __GINAC_FAIL_H__