]> www.ginac.de Git - ginac.git/blob - ginac/structure.h
b1c8bef7480cde3dc4c953c1b1c5087d7f9e869e
[ginac.git] / ginac / structure.h
1 /** @file structure.h
2  *
3  *  Interface to 'abstract' class structure. */
4
5 #ifndef _STRUCTURE_H_
6 #define _STRUCTURE_H_
7
8 class structure;
9
10 #include "basic.h"
11
12 struct registered_structure_info {
13     char const * name;
14 };
15
16 /** The class structure is used to implement user defined classes
17     with named members which behave similar to ordinary C structs.
18     structure is an 'abstract' base class (it is possible but not
19     meaningful to make instances), the user defined structures
20     will be create by the perl script structure.pl */
21
22 class structure : public basic
23 {
24 // member functions
25
26     // default constructor, destructor, copy constructor assignment operator and helpers
27 public:
28     structure();
29     ~structure();
30     structure(structure const & other);
31     structure const & operator=(structure const & other);
32 protected:
33     void copy(structure const & other);
34     void destroy(bool call_parent);
35
36     // other constructors
37     // none
38
39     // functions overriding virtual functions from bases classes
40 public:
41     basic * duplicate() const;
42     void printraw(ostream & os) const; 
43     void print(ostream & os, unsigned upper_precedence=0) const;
44     void printtree(ostream & os, unsigned indent) const;
45     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
46 protected:
47     int compare_same_type(basic const & other) const;
48     bool is_equal_same_type(basic const & other) const;
49     
50     // new virtual functions which can be overridden by derived classes
51     // none
52     
53     // non-virtual functions in this class
54 protected:
55     static vector<registered_structure_info> & registered_structures(void);
56 public:
57     static unsigned register_new(char const * nm);
58
59 // member variables
60 // none
61
62 };
63
64 // global constants
65
66 extern const structure some_structure;
67 extern type_info const & typeid_structure;
68
69 #endif // ndef _STRUCTURE_H_
70