]> www.ginac.de Git - ginac.git/blob - ginac/lst.h
08b75f78b101985c04a3bbc49d5c07d88212e18f
[ginac.git] / ginac / lst.h
1 /** @file lst.h
2  *
3  *  Definition of GiNaC's lst. 
4  *  This file was generated automatically by container.pl.
5  *  Please do not modify it directly, edit the perl script instead!
6  *  container.pl options: $CONTAINER=lst
7  *                        $STLHEADER=list
8  *                        $reserve=0
9  *                        $prepend=1
10  *                        $let_op=1
11  *                        $open_bracket=[
12  *                        $close_bracket=]
13  *
14  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
15  *
16  *  This program is free software; you can redistribute it and/or modify
17  *  it under the terms of the GNU General Public License as published by
18  *  the Free Software Foundation; either version 2 of the License, or
19  *  (at your option) any later version.
20  *
21  *  This program is distributed in the hope that it will be useful,
22  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  *  GNU General Public License for more details.
25  *
26  *  You should have received a copy of the GNU General Public License
27  *  along with this program; if not, write to the Free Software
28  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29  */
30
31 #ifndef __GINAC_LST_H__
32 #define __GINAC_LST_H__
33
34 #include <list>
35 #include <ginac/ginac.h>
36
37 typedef list<ex> exlist;
38
39 class lst : public basic
40 {
41
42 public:
43     lst();
44     ~lst();
45     lst(lst const & other);
46     lst const & operator=(lst const & other);
47 protected:
48     void copy(lst const & other);
49     void destroy(bool call_parent);
50
51 public:
52     lst(exlist const & s, bool discardable=0);
53     lst(exlist * vp); // vp will be deleted
54     explicit lst(ex const & e1);
55     explicit lst(ex const & e1, ex const & e2);
56     explicit lst(ex const & e1, ex const & e2, ex const & e3);
57     explicit lst(ex const & e1, ex const & e2, ex const & e3,
58              ex const & e4);
59     explicit lst(ex const & e1, ex const & e2, ex const & e3,
60              ex const & e4, ex const & e5);
61     explicit lst(ex const & e1, ex const & e2, ex const & e3,
62              ex const & e4, ex const & e5, ex const & e6);
63     explicit lst(ex const & e1, ex const & e2, ex const & e3,
64              ex const & e4, ex const & e5, ex const & e6,
65              ex const & e7);
66     explicit lst(ex const & e1, ex const & e2, ex const & e3,
67              ex const & e4, ex const & e5, ex const & e6,
68              ex const & e7, ex const & e8);
69     explicit lst(ex const & e1, ex const & e2, ex const & e3,
70              ex const & e4, ex const & e5, ex const & e6,
71              ex const & e7, ex const & e8, ex const & e9);
72     explicit lst(ex const & e1, ex const & e2, ex const & e3,
73              ex const & e4, ex const & e5, ex const & e6,
74              ex const & e7, ex const & e8, ex const & e9,
75              ex const &e10);
76
77 public:
78     basic * duplicate() const;
79     void printraw(ostream & os) const;
80     void print(ostream & os, unsigned upper_precedence=0) const;
81     void printtree(ostream & os, unsigned indent) const;
82     bool info(unsigned inf) const;
83     int nops() const;
84     ex & let_op(int const i);
85     ex expand(unsigned options=0) const;
86     bool has(ex const & other) const;
87     ex eval(int level=0) const;
88     ex evalf(int level=0) const;
89     ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
90     ex diff(symbol const & s) const;
91     ex subs(lst const & ls, lst const & lr) const;
92 protected:
93     int compare_same_type(basic const & other) const;
94     bool is_equal_same_type(basic const & other) const;
95     unsigned return_type(void) const;
96
97     // new virtual functions which can be overridden by derived classes
98 public:
99     virtual lst & append(ex const & b);
100     virtual lst & prepend(ex const & b);
101
102 protected:
103     virtual void printseq(ostream & os, char openbracket, char delim,
104                           char closebracket, unsigned this_precedence,
105                           unsigned upper_precedence=0) const;
106     virtual ex thislst(exlist const & v) const;
107     virtual ex thislst(exlist * vp) const;
108
109 protected:
110     bool is_canonical() const;
111     exlist evalchildren(int level) const;
112     exlist evalfchildren(int level) const;
113     exlist normalchildren(int level) const;
114     exlist diffchildren(symbol const & s) const;
115     exlist * subschildren(lst const & ls, lst const & lr) const;
116
117 protected:
118     exlist seq;
119     static unsigned precedence;
120 };
121
122 // global constants
123
124 extern const lst some_lst;
125 extern type_info const & typeid_lst;
126
127 // macros
128
129 #define ex_to_lst(X) (static_cast<lst const &>(*(X).bp))
130
131 #endif // ndef __GINAC_LST_H__
132