1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id: variable.h,v 1.6 2006-05-15 08:17:55 Singular Exp $ */ |
---|
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 | #elif defined(HAVE_IOSTREAM_H) |
---|
13 | #include <iostream.h> |
---|
14 | #endif |
---|
15 | #endif /* NOSTREAMIO */ |
---|
16 | |
---|
17 | #include "cf_defs.h" |
---|
18 | |
---|
19 | /*BEGINPUBLIC*/ |
---|
20 | |
---|
21 | class CanonicalForm; |
---|
22 | |
---|
23 | class Variable |
---|
24 | { |
---|
25 | private: |
---|
26 | int _level; |
---|
27 | Variable( int l, bool flag ); |
---|
28 | public: |
---|
29 | Variable() : _level(LEVELBASE) {} |
---|
30 | Variable( int l ); |
---|
31 | Variable( char name ); |
---|
32 | Variable( int l, char name ); |
---|
33 | Variable( const Variable & v ) : _level(v._level) {} |
---|
34 | ~Variable() {}; |
---|
35 | Variable& operator= ( const Variable & v ) |
---|
36 | { |
---|
37 | _level = v._level; |
---|
38 | return *this; |
---|
39 | } |
---|
40 | int level() const { return _level; } |
---|
41 | char name() const; |
---|
42 | static Variable highest() { return Variable( LEVELQUOT-1 ); } |
---|
43 | Variable next() const { return Variable( _level+1 ); } |
---|
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 | friend bool operator <= ( const Variable & lhs, const Variable & rhs ) |
---|
65 | { |
---|
66 | return lhs._level <= rhs._level; |
---|
67 | } |
---|
68 | #ifndef NOSTREAMIO |
---|
69 | friend ostream & operator << ( ostream & os, const Variable & v ); |
---|
70 | #endif /* NOSTREAMIO */ |
---|
71 | friend void swap_levels(); |
---|
72 | friend Variable rootOf( const CanonicalForm &, char name ); |
---|
73 | }; |
---|
74 | Variable rootOf( const CanonicalForm &, char name = '@' ); |
---|
75 | |
---|
76 | inline int level( const Variable & v ) { return v.level(); } |
---|
77 | inline char name( const Variable & v ) { return v.name(); } |
---|
78 | |
---|
79 | CanonicalForm getMipo( const Variable & alpha, const Variable & x ); |
---|
80 | |
---|
81 | char getDefaultVarName(); |
---|
82 | char getDefaultExtName(); |
---|
83 | |
---|
84 | int ExtensionLevel(); |
---|
85 | |
---|
86 | /*ENDPUBLIC*/ |
---|
87 | |
---|
88 | // the following functions do not need to be public available |
---|
89 | CanonicalForm getMipo( const Variable & alpha ); |
---|
90 | class InternalPoly; |
---|
91 | InternalPoly * getInternalMipo ( const Variable & alpha ); |
---|
92 | bool getReduce( const Variable & alpha ); |
---|
93 | void setReduce( const Variable & alpha, bool reduce ); |
---|
94 | |
---|
95 | #endif /* ! INCL_VARIABLE_H */ |
---|