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