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__
26 #include <ginac/exprseq.h>
28 /** Base class for non-commutative indexed objects */
29 class indexed : public exprseq
33 // default constructor, destructor, copy constructor assignment operator and helpers
37 indexed(indexed const & other);
38 indexed const & operator=(indexed const & other);
40 void copy(indexed const & other);
41 void destroy(bool call_parent);
45 indexed(ex const & i1);
46 indexed(ex const & i1, ex const & i2);
47 indexed(ex const & i1, ex const & i2, ex const & i3);
48 indexed(exvector const & iv);
49 indexed(exvector * iv);
51 // functions overriding virtual functions from base classes
53 basic * duplicate() const;
54 void printraw(ostream & os) const;
55 void printtree(ostream & os, unsigned indent) const;
56 void print(ostream & os, unsigned upper_precedence=0) const;
57 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const;
58 bool info(unsigned inf) const;
59 ex diff(symbol const & s) const;
60 exvector get_indices(void) const;
62 int compare_same_type(basic const & other) const;
63 bool is_equal_same_type(basic const & other) const;
64 unsigned return_type(void) const;
65 unsigned return_type_tinfo(void) const;
66 ex thisexprseq(exvector const & v) const;
67 ex thisexprseq(exvector * vp) const;
69 // new virtual functions which can be overridden by derived classes
72 // non-virtual functions in this class
74 void printrawindices(ostream & os) const;
75 void printtreeindices(ostream & os, unsigned indent) const;
76 void printindices(ostream & os) const;
77 bool all_of_type_idx(void) const;
85 extern const indexed some_indexed;
86 extern type_info const & typeid_indexed;
90 #define ex_to_indexed(X) static_cast<indexed const &>(*(X).bp)
92 #endif // ndef __GINAC_INDEXED_H__