source: git/factory/int_cf.h @ 9c6887

spielwiese
Last change on this file since 9c6887 was 650f2d8, checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
renamed assert.h -> cf_assert.h in factory
  • Property mode set to 100644
File size: 5.1 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#ifndef INCL_INT_CF_H
5#define INCL_INT_CF_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_assert.h"
20
21#include "cf_defs.h"
22#include "variable.h"
23
24class CanonicalForm;
25
26class InternalCF {
27private:
28    int refCount;
29protected:
30    int getRefCount() { return refCount; };
31    void incRefCount() { refCount++; };
32    int decRefCount() { return --refCount; };
33public:
34    InternalCF() { refCount = 1; };
35    InternalCF( const InternalCF& )
36    {
37        ASSERT( 0, "ups there is something wrong in your code");
38    };
39    virtual ~InternalCF() {};
40    int deleteObject() { return decRefCount() == 0; }
41    InternalCF* copyObject() { incRefCount(); return this; }
42    virtual InternalCF* deepCopyObject() const PVIRT_INTCF("deepCopyObject");
43    virtual const char * const classname() const PVIRT_CHARCC("classname");
44    virtual InternalCF* genZero() PVIRT_INTCF("genZero");
45    virtual InternalCF* genOne() PVIRT_INTCF("genOne");
46    virtual int level() const { return LEVELBASE; }
47    virtual int levelcoeff() const { return UndefinedDomain; }
48    virtual int type() const { return UndefinedDomain; }
49    virtual Variable variable() const { return Variable(); }
50#ifndef NOSTREAMIO
51    virtual void print( OSTREAM&, char* ) PVIRT_VOID("print");
52#endif /* NOSTREAMIO */
53    virtual bool inBaseDomain() const { return true; }
54    virtual bool inExtension() const { return false; }
55    virtual bool inCoeffDomain() const { return true; }
56    virtual bool inPolyDomain() const { return false; }
57    virtual bool inQuotDomain() const { return false; }
58    virtual bool isZero() const;
59    virtual bool isOne() const;
60    virtual bool isUnivariate() const { return false; }
61    virtual int intval() const;
62    virtual int intmod( int ) const { return 0; }
63    virtual int sign() const PVIRT_INT("sign");
64
65    virtual InternalCF* num();
66    virtual InternalCF* den();
67
68    virtual InternalCF* neg() PVIRT_INTCF("neg");
69    virtual InternalCF* invert(); // semantically const, changes refCount
70    virtual InternalCF* tryInvert( const CanonicalForm&, bool& );
71    virtual int comparesame ( InternalCF * ) PVIRT_INT("comparesame");
72    virtual int comparecoeff ( InternalCF * ) PVIRT_INT("comparecoeff");
73
74    virtual InternalCF* addsame( InternalCF* ) PVIRT_INTCF("addsame");
75    virtual InternalCF* subsame( InternalCF* ) PVIRT_INTCF("subsame");
76    virtual InternalCF* mulsame( InternalCF* ) PVIRT_INTCF("mulsame");
77    virtual InternalCF* tryMulsame( InternalCF*, const CanonicalForm& );
78    virtual InternalCF* dividesame( InternalCF* ) PVIRT_INTCF("dividesame");
79    virtual InternalCF* modulosame( InternalCF* ) PVIRT_INTCF("modulosame");
80    virtual InternalCF* divsame( InternalCF* ) PVIRT_INTCF("divsame");
81    virtual InternalCF* tryDivsame ( InternalCF* , const CanonicalForm&, bool& );
82    virtual InternalCF* modsame( InternalCF* ) PVIRT_INTCF("modsame");
83    virtual void divremsame( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_VOID("divremsame");
84    virtual bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_BOOL("divremsamet");
85    virtual bool tryDivremsamet ( InternalCF*, InternalCF*&, InternalCF*&, const CanonicalForm&, bool& );
86
87    virtual InternalCF* addcoeff( InternalCF* ) PVIRT_INTCF("addcoeff");
88    virtual InternalCF* subcoeff( InternalCF*, bool ) PVIRT_INTCF("subcoeff");
89    virtual InternalCF* mulcoeff( InternalCF* ) PVIRT_INTCF("mulcoeff");
90    virtual InternalCF* dividecoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
91    virtual InternalCF* tryDividecoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
92    virtual InternalCF* modulocoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
93    virtual InternalCF* divcoeff( InternalCF*, bool ) PVIRT_INTCF("divcoeff");
94    virtual InternalCF* tryDivcoeff ( InternalCF*, bool, const CanonicalForm&, bool& );
95    virtual InternalCF* modcoeff( InternalCF*, bool ) PVIRT_INTCF("modcoeff");
96    virtual void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_VOID("divremcoeff");
97    virtual bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_BOOL("divremcoefft");
98    virtual bool tryDivremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool, const CanonicalForm&, bool& );
99
100    virtual InternalCF * bgcdsame ( const InternalCF * const ) const;
101    virtual InternalCF * bgcdcoeff ( const InternalCF * const ); // semantically const, changes refcount
102
103    virtual InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
104    virtual InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
105
106    virtual InternalCF* sqrt();
107    virtual int ilog2();
108    virtual CanonicalForm lc();
109    virtual CanonicalForm Lc();
110    virtual CanonicalForm LC();
111    virtual CanonicalForm coeff( int i );
112    virtual int degree();
113    virtual int taildegree();
114    virtual CanonicalForm tailcoeff();
115};
116
117#endif /* ! INCL_INT_CF_H */
Note: See TracBrowser for help on using the repository browser.