source: git/factory/int_cf.h @ ab547e2

spielwiese
Last change on this file since ab547e2 was 341696, checked in by Hans Schönemann <hannes@…>, 14 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.5 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 "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 int comparesame ( InternalCF * ) PVIRT_INT("comparesame");
71    virtual int comparecoeff ( InternalCF * ) PVIRT_INT("comparecoeff");
72
73    virtual InternalCF* addsame( InternalCF* ) PVIRT_INTCF("addsame");
74    virtual InternalCF* subsame( InternalCF* ) PVIRT_INTCF("subsame");
75    virtual InternalCF* mulsame( InternalCF* ) PVIRT_INTCF("mulsame");
76    virtual InternalCF* dividesame( InternalCF* ) PVIRT_INTCF("dividesame");
77    virtual InternalCF* modulosame( InternalCF* ) PVIRT_INTCF("modulosame");
78    virtual InternalCF* divsame( InternalCF* ) PVIRT_INTCF("divsame");
79    virtual InternalCF* modsame( InternalCF* ) PVIRT_INTCF("modsame");
80    virtual void divremsame( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_VOID("divremsame");
81    virtual bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ) PVIRT_BOOL("divremsamet");
82
83    virtual InternalCF* addcoeff( InternalCF* ) PVIRT_INTCF("addcoeff");
84    virtual InternalCF* subcoeff( InternalCF*, bool ) PVIRT_INTCF("subcoeff");
85    virtual InternalCF* mulcoeff( InternalCF* ) PVIRT_INTCF("mulcoeff");
86    virtual InternalCF* dividecoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
87    virtual InternalCF* modulocoeff( InternalCF*, bool ) PVIRT_INTCF("dividecoeff");
88    virtual InternalCF* divcoeff( InternalCF*, bool ) PVIRT_INTCF("divcoeff");
89    virtual InternalCF* modcoeff( InternalCF*, bool ) PVIRT_INTCF("modcoeff");
90    virtual void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_VOID("divremcoeff");
91    virtual bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ) PVIRT_BOOL("divremcoefft");
92
93    virtual InternalCF * bgcdsame ( const InternalCF * const ) const;
94    virtual InternalCF * bgcdcoeff ( const InternalCF * const ); // semantically const, changes refcount
95
96    virtual InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
97    virtual InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & ); // semantically const, changes refcount
98
99    virtual InternalCF* sqrt();
100    virtual int ilog2();
101    virtual CanonicalForm lc();
102    virtual CanonicalForm Lc();
103    virtual CanonicalForm LC();
104    virtual CanonicalForm coeff( int i );
105    virtual int degree();
106    virtual int taildegree();
107    virtual CanonicalForm tailcoeff();
108};
109
110#endif /* ! INCL_INT_CF_H */
Note: See TracBrowser for help on using the repository browser.