]> www.ginac.de Git - ginac.git/blob - ginac/indexed.h
5aa53185f6c25e948801ce0cc4b1ae483a193583
[ginac.git] / ginac / indexed.h
1 /** @file indexed.h
2  *
3  *  Interface to GiNaC's index carrying objects.
4  *
5  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef __GINAC_INDEXED_H__
23 #define __GINAC_INDEXED_H__
24
25 #include <string>
26
27 /** Base class for non-commutative indexed objects */
28 class indexed : public exprseq
29 {
30 // member functions
31
32     // default constructor, destructor, copy constructor assignment operator and helpers
33 public:
34     indexed();
35     ~indexed();
36     indexed(indexed const & other);
37     indexed const & operator=(indexed const & other);
38 protected:
39     void copy(indexed const & other); 
40     void destroy(bool call_parent);
41
42     // other constructors
43 public:
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);
49
50     // functions overriding virtual functions from base classes
51 public:
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;
60 protected:
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;
67
68     // new virtual functions which can be overridden by derived classes
69     // none
70     
71     // non-virtual functions in this class
72 protected:
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;
77
78 // member variables
79     // none
80 };
81
82 // global constants
83
84 extern const indexed some_indexed;
85 extern type_info const & typeid_indexed;
86
87 // macros
88
89 #define ex_to_indexed(X) static_cast<indexed const &>(*(X).bp)
90
91 #endif // ndef __GINAC_INDEXED_H__
92
93