- switched to automake build environment
[ginac.git] / ginac / relational.h
1 /** @file relational.h
2  *
3  *  Interface to relations between expressions. */
4
5 #ifndef _RELATIONAL_H_
6 #define _RELATIONAL_H_
7
8 class relational;
9
10 #include "basic.h"
11
12 /** This class holds a relation consisting of two expressions and a logical
13  *  relation between them. */
14 class relational : public basic
15 {
16
17 // types
18 public:
19     enum operators { equal,
20            not_equal,
21            less,
22            less_or_equal,
23            greater,
24            greater_or_equal
25     };
26     
27 // member functions
28
29     // default constructor, destructor, copy constructor assignment operator and helpers
30 public:
31     relational();
32     ~relational();
33     relational(relational const & other);
34     relational const & operator=(relational const & other);
35 protected:
36     void copy(relational const & other);
37     void destroy(bool call_parent);
38
39     // other constructors
40 public:
41     relational(ex const & lhs, ex const & rhs, operators oper=equal);
42     
43     // functions overriding virtual functions from bases classes
44 public:
45     basic * duplicate() const;
46     void printraw(ostream & os) const;
47     void print(ostream & os, unsigned upper_precedence=0) const;
48     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
49     bool info(unsigned inf) const;
50     int nops() const;
51     ex & let_op(int const i);
52     ex eval(int level=0) const;
53     ex evalf(int level=0) const;
54     ex simplify_ncmul(exvector const & v) const;
55 protected:
56     int compare_same_type(basic const & other) const;
57     unsigned return_type(void) const;
58     unsigned return_type_tinfo(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     operator bool(void) const;
66     
67 // member variables
68     
69 protected:
70     ex lh;
71     ex rh;
72     operators o;
73     static unsigned precedence;
74 };
75
76 // global constants
77
78 extern const relational some_relational;
79 extern type_info const & typeid_relational;
80
81 #define ex_to_relational(X) static_cast<relational const &>(*(X).bp)
82
83 #endif // ndef _RELATIONAL_H_
84
85