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