]> www.ginac.de Git - ginac.git/blob - ginac/add.h
removed unnecessary const_cast
[ginac.git] / ginac / add.h
1 /** @file add.h
2  *
3  *  Interface to GiNaC's sums of expressions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __GINAC_ADD_H__
24 #define __GINAC_ADD_H__
25
26 #include "expairseq.h"
27
28 namespace GiNaC {
29
30 /** Sum of expressions. */
31 class add : public expairseq
32 {
33         GINAC_DECLARE_REGISTERED_CLASS(add, expairseq)
34         
35         friend class mul;
36         friend class power;
37         
38         // other constructors
39 public:
40         add(const ex & lh, const ex & rh);
41         add(const exvector & v);
42         add(const epvector & v);
43         add(const epvector & v, const ex & oc);
44         add(epvector * vp, const ex & oc);
45         
46         // functions overriding virtual functions from base classes
47 public:
48         void print(const print_context & c, unsigned level = 0) const;
49         unsigned precedence() const {return 40;}
50         bool info(unsigned inf) const;
51         int degree(const ex & s) const;
52         int ldegree(const ex & s) const;
53         ex coeff(const ex & s, int n=1) const;
54         ex eval(int level=0) const;
55         ex evalm() const;
56         ex series(const relational & r, int order, unsigned options = 0) const;
57         ex normal(exmap & repl, exmap & rev_lookup, int level=0) const;
58         numeric integer_content() const;
59         ex smod(const numeric &xi) const;
60         numeric max_coefficient() const;
61         exvector get_free_indices() const;
62         ex eval_ncmul(const exvector & v) const;
63 protected:
64         ex derivative(const symbol & s) const;
65         unsigned return_type() const;
66         unsigned return_type_tinfo() const;
67         ex thisexpairseq(const epvector & v, const ex & oc) const;
68         ex thisexpairseq(epvector * vp, const ex & oc) const;
69         expair split_ex_to_pair(const ex & e) const;
70         expair combine_ex_with_coeff_to_pair(const ex & e,
71                                              const ex & c) const;
72         expair combine_pair_with_coeff_to_pair(const expair & p,
73                                                const ex & c) const;
74         ex recombine_pair_to_ex(const expair & p) const;
75         ex expand(unsigned options=0) const;
76 };
77
78 // utility functions
79
80 /** Specialization of is_exactly_a<add>(obj) for add objects. */
81 template<> inline bool is_exactly_a<add>(const basic & obj)
82 {
83         return obj.tinfo()==TINFO_add;
84 }
85
86 } // namespace GiNaC
87
88 #endif // ndef __GINAC_ADD_H__