]> www.ginac.de Git - ginac.git/blob - ginac/clifford.h
- removed translated ginsh sources from CVS; they should be in the distribution,
[ginac.git] / ginac / clifford.h
1 /** @file clifford.h
2  *
3  *  Interface to GiNaC's clifford 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_CLIFFORD_H__
23 #define __GINAC_CLIFFORD_H__
24
25 #include <string>
26 #include <ginac/indexed.h>
27
28 /** Base class for clifford object */
29 class clifford : public indexed
30 {
31 // member functions
32
33     // default constructor, destructor, copy constructor assignment operator and helpers
34 public:
35     clifford();
36     ~clifford();
37     clifford(clifford const & other);
38     clifford const & operator=(clifford const & other);
39 protected:
40     void copy(clifford const & other); 
41     void destroy(bool call_parent);
42
43     // other constructors
44 public:
45     explicit clifford(string const & initname);
46
47     // functions overriding virtual functions from base classes
48 public:
49     basic * duplicate() const;
50     void printraw(ostream & os) const;
51     void printtree(ostream & os, unsigned indent) const;
52     void print(ostream & os, unsigned upper_precedence=0) const;
53     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
54     bool info(unsigned inf) const;
55 protected:
56     int compare_same_type(basic const & other) const;
57     ex simplify_ncmul(exvector const & v) const;
58     unsigned calchash(void) const;
59
60     // new virtual functions which can be overridden by derived classes
61     // none
62     
63     // non-virtual functions in this class
64 public:
65     void setname(string const & n);
66 private:
67     string & autoname_prefix(void);
68
69 // member variables
70
71 protected:
72     string name;
73     unsigned serial; // unique serial number for comparision
74 private:
75     static unsigned next_serial;
76 };
77
78 // global constants
79
80 extern const clifford some_clifford;
81 extern type_info const & typeid_clifford;
82
83 // macros
84
85 #define ex_to_clifford(X) static_cast<clifford const &>(*(X).bp)
86
87 #endif // ndef __GINAC_CLIFFORD_H__
88
89