1 | #ifndef CANONICAL_POLY_H |
---|
2 | #define CANONICAL_POLY_H |
---|
3 | |
---|
4 | #ifdef HAVE_WRAPPERS |
---|
5 | |
---|
6 | #include "ring.h" |
---|
7 | #include <string> |
---|
8 | #include "Wrappers.h" |
---|
9 | #include "InternPoly.h" |
---|
10 | |
---|
11 | /*! \class CanonicalPoly |
---|
12 | * \brief Class CanonicalPoly is the class for representing SINGULAR-internal, |
---|
13 | * so-called canonical polynomials. |
---|
14 | * |
---|
15 | * CanonicalPoly is derived from InternPoly which is derived from ReferenceCounter, |
---|
16 | * thus any instance of CanonicalPoly deploys reference counting and |
---|
17 | * facilities for fast shallow copying.<br> |
---|
18 | * Any instance of CanonicalPoly wraps an actual SINGULAR polynomial. |
---|
19 | * \author Frank Seelisch, http://www.mathematik.uni-kl.de/~seelisch |
---|
20 | */ |
---|
21 | class CanonicalPoly : public InternPoly |
---|
22 | { |
---|
23 | private: |
---|
24 | /*! placeholder for a SINGULAR-internal polynomial */ |
---|
25 | SingularPoly m_poly; |
---|
26 | |
---|
27 | /*! |
---|
28 | * A method for retrieving the stored SINGULAR-internal polynomial. |
---|
29 | * @return the stored SINGULAR-internal polynomial |
---|
30 | */ |
---|
31 | const SingularPoly& getSingularPoly () const; |
---|
32 | protected: |
---|
33 | /*! |
---|
34 | * A method for deeply copying the given instance of CanonicalPoly.<br> |
---|
35 | * @return a pointer to the deep copy of <c>this</c> CanonicalPoly |
---|
36 | */ |
---|
37 | CanonicalPoly* deepCopy () const; |
---|
38 | |
---|
39 | /*! |
---|
40 | * A method for adding an instance of CanonicalPoly and an instance of |
---|
41 | * InternPoly.<br> |
---|
42 | * Both polynomials are known to live in compatible rings. For the time being, |
---|
43 | * the implementation of this method will only succeed when the argument InternPoly |
---|
44 | * can also be casted to CanonicalPoly. This cast will be performed static in case |
---|
45 | * that <c>ip.getPolyType()</c> yields the enum CANONICAL_POLY_TYPE. Otherwise the |
---|
46 | * program will halt.<br> |
---|
47 | * In case of success, the result of the addition will be stored in the |
---|
48 | * CanonicalPoly given by <c>*this</c>, hence the given object will then be modified |
---|
49 | * by the operation.<br> |
---|
50 | * @param ip another InternPoly to be added to <c>this</c> CanonicalPoly |
---|
51 | * @see InternPoly::addCompatible (const InternPoly* ip) |
---|
52 | * @see InternPoly::add (const InternPoly* ip) |
---|
53 | * @see RingWrapper::isCompatible (const RingWrapper& r) const |
---|
54 | */ |
---|
55 | void addCompatible (const InternPoly* ip); |
---|
56 | |
---|
57 | /*! |
---|
58 | * A method for retrieving the type of the represented poly. |
---|
59 | * For any class C derived from InternPoly, the call <c>C::getPolyType ()</c> |
---|
60 | * is to return one of the defined enums so that, based on the return value, the |
---|
61 | * programmer may perform a <em>static</em> cast to cast any given instance |
---|
62 | * of InternPoly to the correct derived class.<br> |
---|
63 | * This method needs to be reimplemented in each class derived from InternPoly. |
---|
64 | * @return the enum CANONICAL_POLY_TYPE |
---|
65 | */ |
---|
66 | int getPolyType () const; |
---|
67 | |
---|
68 | /*! |
---|
69 | * A method for obtaining a string representation of the given instance. |
---|
70 | */ |
---|
71 | char* toString () const; |
---|
72 | public: |
---|
73 | ~CanonicalPoly (); |
---|
74 | |
---|
75 | /*! |
---|
76 | * A constructor for CanonicalPoly.<br> |
---|
77 | * This constructor will create a representation of the given integer |
---|
78 | * as a wrapped SINGULAR-internal polynomial. |
---|
79 | * @param r a RingWrapper wrapping the ring in which the polynomial lives |
---|
80 | * @see CanonicalPoly::CanonicalPoly (const SingularPoly&, const RingWrapper& r) |
---|
81 | */ |
---|
82 | CanonicalPoly (const int i, const RingWrapper& r); |
---|
83 | |
---|
84 | /*! |
---|
85 | * A constructor for CanonicalPoly.<br> |
---|
86 | * This constructor will wrap the given SINGULAR-internal polynomial. |
---|
87 | * @param r a RingWrapper wrapping the ring in which the polynomial lives |
---|
88 | * @see CanonicalPoly::CanonicalPoly (const int i, const RingWrapper& r) |
---|
89 | */ |
---|
90 | CanonicalPoly (const SingularPoly&, const RingWrapper& r); |
---|
91 | |
---|
92 | /*! We enable PolyWrapper to "see" all methods of CanonicalPoly. */ |
---|
93 | friend class PolyWrapper; |
---|
94 | }; |
---|
95 | |
---|
96 | #endif |
---|
97 | /* HAVE_WRAPPERS */ |
---|
98 | |
---|
99 | #endif |
---|
100 | /* CANONICAL_POLY_H */ |
---|