Changeset fea494 in git for libpolys/polys/PolyEnumerator.h
- Timestamp:
- Sep 24, 2014, 1:05:36 PM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 65a40710c408315804772d0a7ff078203be9d9bf
- Parents:
- 46f37cb57098799d8399fc704c5b3ca2020ca0c1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/PolyEnumerator.h
r46f37cb rfea494 1 1 // -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 2 /*****************************************************************************\ 3 * Computer Algebra System SINGULAR 3 * Computer Algebra System SINGULAR 4 4 \*****************************************************************************/ 5 5 /** @file PolyEnumerator.h 6 * 6 * 7 7 * Concrete implementation of enumerators over polynomials 8 8 * … … 22 22 23 23 /** @class CBasePolyEnumerator 24 * 24 * 25 25 * Base polynomial enumerator for simple iteration over terms of polynomials. 26 26 * 27 27 * Note that the first element desn't exist directly after Reset() call. 28 * 28 * 29 29 * The class doesn't inherit from IAccessor and thus doesn't override Current(). 30 30 * … … 37 37 private: 38 38 poly m_poly; ///< essentially immutable original iterable object 39 39 40 40 static const spolyrec m_prevposition_struct; ///< tag for "-1" position 41 41 … … 56 56 m_poly = p; 57 57 m_position = const_cast<poly>(&m_prevposition_struct); 58 assume( !IsValid() ); 58 assume( !IsValid() ); 59 59 } 60 60 … … 63 63 IBaseEnumerator(), m_poly(p), m_position(const_cast<poly>(&m_prevposition_struct)) 64 64 { 65 assume( !IsValid() ); 66 } 67 65 assume( !IsValid() ); 66 } 67 68 68 /// Sets the position marker to the leading term. 69 69 virtual void Reset() 70 70 { 71 71 m_position = const_cast<poly>(&m_prevposition_struct); 72 assume( !IsValid() ); 72 assume( !IsValid() ); 73 73 } 74 74 … … 93 93 } 94 94 } 95 95 96 96 if (m_position == &m_prevposition_struct) // -1 position? 97 97 { … … 114 114 115 115 /** @class CPolyCoeffsEnumerator 116 * 116 * 117 117 * This is a polynomial enumerator for simple iteration over 118 118 * coefficients of polynomials. 119 * 119 * 120 120 * It is required to inherit this class from IEnumerator<number> for 121 121 * its use in coeffs and implement IAccessor<number> interface. … … 131 131 public: 132 132 CPolyCoeffsEnumerator(poly p): CBasePolyEnumerator(p) {} 133 133 134 134 /// Gets the current element in the collection (read and write). 135 135 virtual IPolyCoeffsEnumerator::reference Current() 136 136 { 137 137 assume( IsValid() ); 138 return pGetCoeff(m_position); 138 return pGetCoeff(m_position); 139 139 } 140 140 … … 169 169 { 170 170 return m_global_enumerator.IsValid() && m_local_enumerator.IsValid(); 171 } 172 171 } 172 173 173 public: 174 174 175 175 /// NOTE: carefull: don't destruct the input enumerator before doing it with this one... 176 176 /// this also changes the original IPolyCoeffsEnumerator& itr! … … 198 198 assume( FALSE ); return MoveNext(); // this should not happen as p should be non-zero, but just in case... 199 199 } 200 200 201 201 virtual void Reset() 202 202 { … … 221 221 222 222 223 #endif 223 #endif 224 224 /* #ifndef POLYENUMERATOR_H */ 225 225
Note: See TracChangeset
for help on using the changeset viewer.