]> www.ginac.de Git - ginac.git/blob - ginac/lorentzidx.h
Hunted down some output bugs. Hope it can be safely piped into Maple now.
[ginac.git] / ginac / lorentzidx.h
1 /** @file lorentzidx.h
2  *
3  *  Interface to GiNaC's lorentz indices. */
4
5 #ifndef _LORENTZIDX_H_
6 #define _LORENTZIDX_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "idx.h"
12
13 class lorentzidx : public idx
14 {
15     friend class simp_lor;
16     friend class scalar_products;
17
18 // member functions
19
20     // default constructor, destructor, copy constructor assignment operator and helpers
21 public:
22     lorentzidx();
23     ~lorentzidx();
24     lorentzidx (lorentzidx const & other);
25     lorentzidx const & operator=(lorentzidx const & other);
26 protected:
27     void copy(lorentzidx const & other);
28     void destroy(bool call_parent);
29
30     // other constructors
31 public:
32     explicit lorentzidx(bool cov, bool oonly=false, unsigned dimp=0);
33     explicit lorentzidx(string const & n, bool cov=false,
34                         bool oonly=false, unsigned dimp=0);
35     explicit lorentzidx(char const * n, bool cov=false,
36                         bool oonly=false, unsigned dimp=0);
37     explicit lorentzidx(unsigned const v, bool cov=false);
38
39     // functions overriding virtual functions from bases classes
40 public:
41     basic * duplicate() const;
42     void printraw(ostream & os) const;
43     void printtree(ostream & os, unsigned indent) const;
44     void print(ostream & os, unsigned upper_precedence=0) const;
45     bool info(unsigned inf) const;
46
47     // new virtual functions which can be overridden by derived classes
48     // none
49
50     // non-virtual functions in this class
51 public:
52     bool is_orthogonal_only(void) const { return orthogonal_only; }
53     unsigned get_dim_parallel_space(void) const { return dim_parallel_space; }
54     lorentzidx create_anonymous_representative(void) const; 
55
56     // member variables
57 protected:
58     bool orthogonal_only;
59     unsigned dim_parallel_space;
60 };
61
62 // global constants
63
64 extern const lorentzidx some_lorentzidx;
65 extern type_info const & typeid_lorentzidx;
66
67 // macros
68
69 #define ex_to_lorentzidx(X) (static_cast<lorentzidx const &>(*(X).bp))
70
71 #endif // ndef _LORENTZIDX_H_