X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=sidebyside;f=ginac%2Ffail.h;h=a681d5598ccfa1734abfa8eb9bfd3b892b7b7237;hb=dbd9c306a74f1cb258c0d15a346b973b39deaad2;hp=c2942cc7e32185a40cdb2a1a2ead328a478e37cb;hpb=1bd972bf8e4eeeb8aec6081100876e81a7f18450;p=ginac.git diff --git a/ginac/fail.h b/ginac/fail.h index c2942cc7..a681d559 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 }; -#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__