source: git/factory/variable.h

spielwiese
Last change on this file was 3edea1, checked in by Hans Schoenemann <hannes@…>, 3 years ago
cygwin port: shared lib libfactory
  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[2dd068]2
[b52d27]3/**
4 * @file variable.h
5 *
6 * operations on variables
7**/
[2dd068]8#ifndef INCL_VARIABLE_H
9#define INCL_VARIABLE_H
10
[e4fe2b]11// #include "config.h"
[037633]12
[175e355]13#ifndef NOSTREAMIO
[e4fe2b]14# ifdef HAVE_IOSTREAM
15#  include <iostream>
16#  define OSTREAM std::ostream
17# elif defined(HAVE_IOSTREAM_H)
18#  include <iostream.h>
19#  define OSTREAM ostream
20# endif
[175e355]21#endif /* NOSTREAMIO */
[2dd068]22
23#include "cf_defs.h"
24
25/*BEGINPUBLIC*/
26
27class CanonicalForm;
28
[b52d27]29/**
30 * factory's class for variables
31**/
[3edea1]32class FACTORY_PUBLIC Variable
[2dd068]33{
34private:
35    int _level;
36    Variable( int l, bool flag );
37public:
38    Variable() : _level(LEVELBASE) {}
39    Variable( int l );
40    Variable( char name );
41    Variable( int l, char name );
42    Variable( const Variable & v ) : _level(v._level) {}
43    ~Variable() {};
44    Variable& operator= ( const Variable & v )
45    {
[2bf04b]46        _level = v._level;
47        return *this;
[2dd068]48    }
49    int level() const { return _level; }
50    char name() const;
51    static Variable highest() { return Variable( LEVELQUOT-1 ); }
52    Variable next() const { return Variable( _level+1 ); }
53    friend bool operator == ( const Variable & lhs, const Variable & rhs )
54    {
[2bf04b]55        return lhs._level == rhs._level;
[2dd068]56    }
57    friend bool operator != ( const Variable & lhs, const Variable & rhs )
58    {
[2bf04b]59        return lhs._level != rhs._level;
[2dd068]60    }
61    friend bool operator > ( const Variable & lhs, const Variable & rhs )
62    {
[2bf04b]63        return lhs._level > rhs._level;
[2dd068]64    }
65    friend bool operator < ( const Variable & lhs, const Variable & rhs )
66    {
[2bf04b]67        return lhs._level < rhs._level;
[2dd068]68    }
69    friend bool operator >= ( const Variable & lhs, const Variable & rhs )
70    {
[2bf04b]71        return lhs._level >= rhs._level;
[2dd068]72    }
73    friend bool operator <= ( const Variable & lhs, const Variable & rhs )
74    {
[2bf04b]75        return lhs._level <= rhs._level;
[2dd068]76    }
[175e355]77#ifndef NOSTREAMIO
[e4fe2b]78   friend OSTREAM & operator << ( OSTREAM & os, const Variable & v );
[175e355]79#endif /* NOSTREAMIO */
[c3aa45]80    friend void swap_levels();
[b52d27]81    /** returns a symbolic root of polynomial with name @a name.
82     *  Use it to define algebraic variables
83     *  @note: algebraic variables have a level < 0
84    **/
[6b503c]85    friend Variable rootOf( const CanonicalForm &, char name );
[2dd068]86};
[b52d27]87
88/** returns a symbolic root of polynomial with name @a name
89 *  Use it to define algebraic variables
90 *  @note: algebraic variables have a level < 0
91**/
[3edea1]92Variable FACTORY_PUBLIC rootOf( const CanonicalForm &, char name = '@' );
[2dd068]93
94inline int level( const Variable & v ) { return v.level(); }
95inline char name( const Variable & v ) { return v.name(); }
96
[183688]97void setReduce( const Variable & alpha, bool reduce );
[5ab7d6]98void setMipo ( const Variable & alpha, const CanonicalForm & mipo);
[2dd068]99CanonicalForm getMipo( const Variable & alpha, const Variable & x );
[6981f1]100bool hasMipo( const Variable & alpha );
[2dd068]101
102char getDefaultVarName();
103char getDefaultExtName();
104
[3edea1]105void FACTORY_PUBLIC prune (Variable& alpha);
[03f640]106void prune1 (const Variable& alpha);
[c3aa45]107int ExtensionLevel();
108
[2dd068]109/*ENDPUBLIC*/
110
111// the following functions do not need to be public available
112CanonicalForm getMipo( const Variable & alpha );
113class InternalPoly;
114InternalPoly * getInternalMipo ( const Variable & alpha );
115bool getReduce( const Variable & alpha );
116
[493c477]117#endif /* ! INCL_VARIABLE_H */
Note: See TracBrowser for help on using the repository browser.