3 * Interface to GiNaC's index carrying objects.
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_INDEXED_H__
23 #define __GINAC_INDEXED_H__
27 /** Base class for non-commutative indexed objects */
28 class indexed : public exprseq
32 // default constructor, destructor, copy constructor assignment operator and helpers
36 indexed(indexed const & other);
37 indexed const & operator=(indexed const & other);
39 void copy(indexed const & other);
40 void destroy(bool call_parent);
44 indexed(ex const & i1);
45 indexed(ex const & i1, ex const & i2);
46 indexed(ex const & i1, ex const & i2, ex const & i3);
47 indexed(exvector const & iv);
48 indexed(exvector * iv);
50 // functions overriding virtual functions from base classes
52 basic * duplicate() const;
53 void printraw(ostream & os) const;
54 void printtree(ostream & os, unsigned indent) const;
55 void print(ostream & os, unsigned upper_precedence=0) const;
56 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
57 bool info(unsigned inf) const;
58 ex diff(symbol const & s) const;
59 exvector get_indices(void) const;
61 int compare_same_type(basic const & other) const;
62 bool is_equal_same_type(basic const & other) const;
63 unsigned return_type(void) const;
64 unsigned return_type_tinfo(void) const;
65 ex thisexprseq(exvector const & v) const;
66 ex thisexprseq(exvector * vp) const;
68 // new virtual functions which can be overridden by derived classes
71 // non-virtual functions in this class
73 void printrawindices(ostream & os) const;
74 void printtreeindices(ostream & os, unsigned indent) const;
75 void printindices(ostream & os) const;
76 bool all_of_type_idx(void) const;
84 extern const indexed some_indexed;
85 extern type_info const & typeid_indexed;
89 #define ex_to_indexed(X) static_cast<indexed const &>(*(X).bp)
91 #endif // ndef __GINAC_INDEXED_H__