]> www.ginac.de Git - ginac.git/blob - ginac/indexed.h
- corrected meaning of "GiNaC" acronym
[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 #include <ginac/exprseq.h>
27
28 /** Base class for non-commutative indexed objects */
29 class indexed : public exprseq
30 {
31 // member functions
32
33     // default constructor, destructor, copy constructor assignment operator and helpers
34 public:
35     indexed();
36     ~indexed();
37     indexed(indexed const & other);
38     indexed const & operator=(indexed const & other);
39 protected:
40     void copy(indexed const & other); 
41     void destroy(bool call_parent);
42
43     // other constructors
44 public:
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);
50
51     // functions overriding virtual functions from base classes
52 public:
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;
61 protected:
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;
68
69     // new virtual functions which can be overridden by derived classes
70     // none
71     
72     // non-virtual functions in this class
73 protected:
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;
78
79 // member variables
80     // none
81 };
82
83 // global constants
84
85 extern const indexed some_indexed;
86 extern type_info const & typeid_indexed;
87
88 // macros
89
90 #define ex_to_indexed(X) static_cast<indexed const &>(*(X).bp)
91
92 #endif // ndef __GINAC_INDEXED_H__
93
94