1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | |
---|
3 | #ifndef INCL_VARIABLE_H |
---|
4 | #define INCL_VARIABLE_H |
---|
5 | |
---|
6 | // #include "config.h" |
---|
7 | |
---|
8 | #ifndef NOSTREAMIO |
---|
9 | # ifdef HAVE_IOSTREAM |
---|
10 | # include <iostream> |
---|
11 | # define OSTREAM std::ostream |
---|
12 | # elif defined(HAVE_IOSTREAM_H) |
---|
13 | # include <iostream.h> |
---|
14 | # define OSTREAM ostream |
---|
15 | # endif |
---|
16 | #endif /* NOSTREAMIO */ |
---|
17 | |
---|
18 | #include "cf_defs.h" |
---|
19 | |
---|
20 | /*BEGINPUBLIC*/ |
---|
21 | |
---|
22 | class CanonicalForm; |
---|
23 | |
---|
24 | class Variable |
---|
25 | { |
---|
26 | private: |
---|
27 | int _level; |
---|
28 | Variable( int l, bool flag ); |
---|
29 | public: |
---|
30 | Variable() : _level(LEVELBASE) {} |
---|
31 | Variable( int l ); |
---|
32 | Variable( char name ); |
---|
33 | Variable( int l, char name ); |
---|
34 | Variable( const Variable & v ) : _level(v._level) {} |
---|
35 | ~Variable() {}; |
---|
36 | Variable& operator= ( const Variable & v ) |
---|
37 | { |
---|
38 | _level = v._level; |
---|
39 | return *this; |
---|
40 | } |
---|
41 | int level() const { return _level; } |
---|
42 | char name() const; |
---|
43 | static Variable highest() { return Variable( LEVELQUOT-1 ); } |
---|
44 | Variable next() const { return Variable( _level+1 ); } |
---|
45 | friend bool operator == ( const Variable & lhs, const Variable & rhs ) |
---|
46 | { |
---|
47 | return lhs._level == rhs._level; |
---|
48 | } |
---|
49 | friend bool operator != ( const Variable & lhs, const Variable & rhs ) |
---|
50 | { |
---|
51 | return lhs._level != rhs._level; |
---|
52 | } |
---|
53 | friend bool operator > ( const Variable & lhs, const Variable & rhs ) |
---|
54 | { |
---|
55 | return lhs._level > rhs._level; |
---|
56 | } |
---|
57 | friend bool operator < ( const Variable & lhs, const Variable & rhs ) |
---|
58 | { |
---|
59 | return lhs._level < rhs._level; |
---|
60 | } |
---|
61 | friend bool operator >= ( const Variable & lhs, const Variable & rhs ) |
---|
62 | { |
---|
63 | return lhs._level >= rhs._level; |
---|
64 | } |
---|
65 | friend bool operator <= ( const Variable & lhs, const Variable & rhs ) |
---|
66 | { |
---|
67 | return lhs._level <= rhs._level; |
---|
68 | } |
---|
69 | #ifndef NOSTREAMIO |
---|
70 | friend OSTREAM & operator << ( OSTREAM & os, const Variable & v ); |
---|
71 | #endif /* NOSTREAMIO */ |
---|
72 | friend void swap_levels(); |
---|
73 | friend Variable rootOf( const CanonicalForm &, char name ); |
---|
74 | }; |
---|
75 | Variable rootOf( const CanonicalForm &, char name = '@' ); |
---|
76 | |
---|
77 | inline int level( const Variable & v ) { return v.level(); } |
---|
78 | inline char name( const Variable & v ) { return v.name(); } |
---|
79 | |
---|
80 | void setReduce( const Variable & alpha, bool reduce ); |
---|
81 | void setMipo ( const Variable & alpha, const CanonicalForm & mipo); |
---|
82 | CanonicalForm getMipo( const Variable & alpha, const Variable & x ); |
---|
83 | bool hasMipo( const Variable & alpha ); |
---|
84 | |
---|
85 | char getDefaultVarName(); |
---|
86 | char getDefaultExtName(); |
---|
87 | |
---|
88 | int ExtensionLevel(); |
---|
89 | |
---|
90 | /*ENDPUBLIC*/ |
---|
91 | |
---|
92 | // the following functions do not need to be public available |
---|
93 | CanonicalForm getMipo( const Variable & alpha ); |
---|
94 | class InternalPoly; |
---|
95 | InternalPoly * getInternalMipo ( const Variable & alpha ); |
---|
96 | bool getReduce( const Variable & alpha ); |
---|
97 | |
---|
98 | #endif /* ! INCL_VARIABLE_H */ |
---|