]> www.ginac.de Git - ginac.git/blob - ginac/isospin.h
Hunted down some output bugs. Hope it can be safely piped into Maple now.
[ginac.git] / ginac / isospin.h
1 /** @file isospin.h
2  *
3  *  Interface to GiNaC's isospin objects. */
4
5 #ifndef _ISOSPIN_H_
6 #define _ISOSPIN_H_
7
8 #include <string>
9
10 class isospin;
11
12 #include "indexed.h"
13
14 /** Base class for isospin object */
15 class isospin : public indexed
16 {
17 // member functions
18
19     // default constructor, destructor, copy constructor assignment operator and helpers
20 public:
21     isospin();
22     ~isospin();
23     isospin(isospin const & other);
24     isospin const & operator=(isospin const & other);
25 protected:
26     void copy(isospin const & other); 
27     void destroy(bool call_parent);
28
29     // other constructors
30 public:
31     explicit isospin(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 isospin some_isospin;
67 extern type_info const & typeid_isospin;
68
69 // macros
70
71 #define ex_to_isospin(X) static_cast<isospin const &>(*(X).bp)
72
73 #endif // ndef _ISOSPIN_H_
74
75