]> www.ginac.de Git - ginac.git/blob - ginac/clifford.h
- switched to automake build environment
[ginac.git] / ginac / clifford.h
1 /** @file clifford.h
2  *
3  *  Interface to GiNaC's clifford objects. */
4
5 #ifndef _CLIFFORD_H_
6 #define _CLIFFORD_H_
7
8 #include <string>
9
10 class clifford;
11
12 #include "indexed.h"
13
14 /** Base class for clifford object */
15 class clifford : public indexed
16 {
17 // member functions
18
19     // default constructor, destructor, copy constructor assignment operator and helpers
20 public:
21     clifford();
22     ~clifford();
23     clifford(clifford const & other);
24     clifford const & operator=(clifford const & other);
25 protected:
26     void copy(clifford const & other); 
27     void destroy(bool call_parent);
28
29     // other constructors
30 public:
31     explicit clifford(string const & initname);
32
33     // functions overriding virtual functions from base classes
34 public:
35     basic * duplicate() const;
36     void printraw(ostream & os) const;
37     void printtree(ostream & os, unsigned indent) const;
38     void print(ostream & os, unsigned upper_precedence=0) const;
39     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
40     bool info(unsigned inf) const;
41 protected:
42     int compare_same_type(basic const & other) const;
43     ex simplify_ncmul(exvector const & v) const;
44     unsigned calchash(void) const;
45
46     // new virtual functions which can be overridden by derived classes
47     // none
48     
49     // non-virtual functions in this class
50 public:
51     void setname(string const & n);
52 private:
53     string & autoname_prefix(void);
54
55 // member variables
56
57 protected:
58     string name;
59     unsigned serial; // unique serial number for comparision
60 private:
61     static unsigned next_serial;
62 };
63
64 // global constants
65
66 extern const clifford some_clifford;
67 extern type_info const & typeid_clifford;
68
69 // macros
70
71 #define ex_to_clifford(X) static_cast<clifford const &>(*(X).bp)
72
73 #endif // ndef _CLIFFORD_H_
74
75