3 * Interface to GiNaC's constant types and some special constants.
5 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GINAC_CONSTANT_H__
23 #define __GINAC_CONSTANT_H__
27 /** This class holds constants, symbols with specific numerical value. Each
28 * object of this class must either provide their own function to evaluate it
29 * to class numeric or provide the constant as a numeric (if it's an exact
31 class constant : public basic
36 // default constructor, destructor, copy constructor assignment operator and helpers
39 constant(constant const & other);
40 // constant const & operator=(constant const & other); /* it's pervert! */
42 void copy(constant const & other);
43 void destroy(bool call_parent);
47 constant(string const & initname, ex (*efun)()=0);
48 constant(string const & initname, numeric const & initnumber);
50 // functions overriding virtual functions from bases classes
52 basic * duplicate() const;
53 void printraw(ostream & os) const;
54 void print(ostream & os, unsigned upper_precedence=0) const;
55 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
56 ex evalf(int level=0) const;
57 ex diff(symbol const & s) const;
59 int compare_same_type(basic const & other) const;
60 bool is_equal_same_type(basic const & other) const;
62 // new virtual functions which can be overridden by derived classes
65 // non-virtual functions in this class
75 unsigned serial; //!< unique serial number for comparision
76 static unsigned next_serial;
81 extern const constant some_constant;
82 extern type_info const & typeid_constant;
84 // extern const numeric I;
85 extern const constant Pi;
86 extern const constant Catalan;
87 extern const constant EulerGamma;
89 #endif // ndef __GINAC_CONSTANT_H__