source: git/Singular/InternPoly.h @ dbae50

spielwiese
Last change on this file since dbae50 was dbae50, checked in by Frank Seelisch <seelisch@…>, 14 years ago
changed authors git-svn-id: file:///usr/local/Singular/svn/trunk@12211 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.7 KB
Line 
1#ifndef INTERN_POLY_H
2#define INTERN_POLY_H
3
4#ifdef HAVE_WRAPPERS
5
6#include "Wrappers.h"
7#include "ReferenceCounter.h"
8#include "RingWrapper.h"
9
10/*! \class InternPoly
11 *  \brief Class InternPoly is the superclass of all classes which
12 *         wrap specific polynomial representations.
13 *
14 *  InternPoly is derived from ReferenceCounter, thus any instance of
15 *  InternPoly and of its derived classes deploys reference counting and
16 *  facilities for fast shallow copying.<br>
17 *  Classes derived from InternPoly are intended to wrap specific polynomial
18 *  representations such as SINGULAR-internal polynomials, as done by
19 *  CanonicalPoly. Each such instance needs to <em>know</em> in which ring it
20 *  lives. Therefore, InterPoly has a private member for storing a reference
21 *  to some instance of RingWrapper.<br>
22 *  Any instance of PolyWrapper holds a pointer to an instance of InternPoly
23 *  wherein the polynomial is actually wrapped. This way, technicalities
24 *  can be implemented inside InternPoly (and in the classes derived from it)
25 *  and only the user interface for polynomail actions can by made available
26 *  through PolyWrapper.<br>
27 *  \author Michael Brickenstein, Alexander Dreyer, Oleksandr Motsak, Hans Sch&ouml;nemann, Frank Seelisch, http://www.mathematik.uni-kl.de
28 */
29class InternPoly : public ReferenceCounter
30{
31protected:
32  /*! private member for storing a reference to a RingWrapper
33      which wraps the ring in which the polynomial lives */
34  const RingWrapper& m_ring;
35 
36  /*! an enumeration variable for making the code more readable;
37      for any class C derived from InternPoly, the call <c>C::getPolyType ()</c>
38      is to return one of these enums so that, based on the return value, the
39      programmer may perform a <em>static</em> cast to cast a given instance
40      of InternPoly to the correct derived class */
41  static const int UNSPECIFIED_POLY_TYPE = 0;
42 
43  /*! an enumeration variable for making the code more readable;
44      for any class C derived from InternPoly, the call <c>C::getPolyType ()</c>
45      is to return one of these enums so that, based on the return value, the
46      programmer may perform a <em>static</em> cast to cast a given instance
47      of InternPoly to the correct derived class */
48  static const int CANONICAL_POLY_TYPE   = 1;
49 
50  /*!
51   *  A method for retrieving the type of the represented poly.
52   *  For any class C derived from InternPoly, the call <c>C::getPolyType ()</c>
53   *  is to return one of the defined enums so that, based on the return value, the
54   *  programmer may perform a <em>static</em> cast to cast any given instance
55   *  of InternPoly to the correct derived class.<br>
56   *  This method needs to be reimplemented in each class derived from InternPoly.
57   *  @return the polynomial type, one of the defined enums
58   */
59  virtual int getPolyType () const;
60 
61  /*!
62   *  A method for adding two instances of InterPoly which are known to
63   *  live in the same, or at least in compatible rings.<br>
64   *  The result of the addition will be stored in the InternPoly given by <c>*this</c>;
65   *  hence the given object will be modified by the operation.<br>
66   *  This method needs to be reimplemented in each class derived from InternPoly.
67   *  @param ip another InternPoly to be added to <c>this</c> InternPoly
68   *  @see InternPoly::add (const InternPoly* ip)
69   *  @see RingWrapper::isCompatible (const RingWrapper& r) const
70   */
71  virtual void addCompatible (const InternPoly* ip);
72 
73  /*!
74   *  A method for deeply copying the given instance of InternPoly.<br>
75   *  This method needs to be reimplemented in each class derived from InternPoly.
76   *  @return a pointer to the deep copy of <c>this</c> InternPoly
77   */
78  virtual InternPoly* deepCopy () const;
79 
80  /*!
81   *  A method for retrieving the RingWrapper which wraps the ring in
82   *  which the represented polynomial lives.<br>
83   *  This method needs to be reimplemented in each class derived from InternPoly.
84   *  @return a RingWrapper wrapping the ring in which the polynomial lives
85   */
86  const RingWrapper& getRing () const;
87 
88  /*!
89   *  A method for adding two instances of InterPoly which are not known to
90   *  live in compatible rings.<br>
91   *  In case of compatibility, the result of the addition will be stored
92   *  in the InternPoly given by <c>*this</c>, hence the given object will be
93   *  modified by the operation.<br>
94   *  @param ip another InternPoly to be added to <c>this</c> InternPoly
95   *  @see InternPoly::addCompatible (const InternPoly* ip)
96   *  @see RingWrapper::isCompatible (const RingWrapper& r) const
97   */
98  void add (const InternPoly* ip);
99 
100  /*!
101   *  A method for obtaining a string representation of the given instance.<br>
102   *  This method needs to be reimplemented in each class derived from InternPoly.
103   */
104  virtual char* toString () const;
105public:
106  /*!
107   *  A constructor for InternPoly which just sets the RingWrapper.<br>
108   *  This constructor is assumed to be called implicitely when a constructor
109   *  of one of the classes derived from InternPoly will be called.
110   *  @param r a RingWrapper wrapping the ring in which the polynomial lives
111   */
112  InternPoly (const RingWrapper& r);
113 
114  /*!
115   *  A copy constructor for InternPoly.<br>
116   *  As this constructor should neither be called by the user nor
117   *  implicitely by some method, it will halt the program.
118   *  @param p a reference to another InternPoly
119   */
120  InternPoly (const InternPoly& p);
121 
122  /*!
123   *  A destructor for InternPoly.
124   */
125  virtual ~InternPoly ();
126
127/*! We enable PolyWrapper to "see" all methods of InternPoly. */
128friend class PolyWrapper;
129
130/*! We enable CanonicalPoly to "see" all methods of InternPoly. */
131friend class CanonicalPoly;
132};
133
134#endif
135/* HAVE_WRAPPERS */
136
137#endif
138/* INTERN_POLY_H */
Note: See TracBrowser for help on using the repository browser.