PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 // include basic definitions 00017 #include "pbori_defs.h" 00018 00019 #include "BoolePolynomial.h" 00020 #include "BooleMonomial.h" 00021 #include "BooleExponent.h" 00022 #include "COrderedIter.h" 00023 #include "PBoRiError.h" 00024 #include "CCheckedIdx.h" 00025 00026 #include <vector> 00027 00028 #ifndef COrderingBase_h_ 00029 #define COrderingBase_h_ 00030 00031 BEGIN_NAMESPACE_PBORI 00032 class BoolePolynomial; 00033 class BooleMonomial; 00034 class BooleExponent; 00035 class CCuddNavigator; 00036 00042 class COrderingBase: 00043 public CTypes::auxtypes_type { 00044 00046 typedef COrderingBase self; 00047 00048 public: 00050 00051 typedef BoolePolynomial poly_type; 00052 typedef BooleMonomial monom_type; 00053 typedef CCuddNavigator navigator; 00054 typedef BooleExponent exp_type; 00055 00056 typedef COrderedIter<navigator, monom_type> ordered_iterator; 00057 typedef COrderedIter<navigator, exp_type> ordered_exp_iterator; 00059 00061 typedef CCheckedIdx checked_idx_type; 00062 00064 typedef std::vector<idx_type> block_idx_type; 00065 00067 typedef block_idx_type::const_iterator block_iterator; 00068 00070 typedef BooleSet set_type; 00071 00073 COrderingBase() { } 00074 00075 // Destructor 00076 virtual ~COrderingBase() = 0; 00077 00079 virtual comp_type compare(idx_type, idx_type) const = 0; 00080 00081 virtual comp_type compare(const monom_type&, const monom_type&) const = 0; 00082 00083 virtual comp_type compare(const exp_type&, const exp_type&) const = 0; 00084 00086 virtual monom_type lead(const poly_type&) const = 0; 00087 00089 virtual monom_type lead(const poly_type&, deg_type) const = 0; 00090 00092 virtual exp_type leadExp(const poly_type&) const = 0; 00093 00095 virtual exp_type leadExp(const poly_type&, deg_type) const = 0; 00096 00098 virtual poly_type leadFirst(const poly_type&) const = 0; 00099 00101 virtual bool_type isLexicographical() const = 0; 00102 00104 virtual bool_type orderedStandardIteration() const = 0; 00105 00107 virtual bool_type isSymmetric() const = 0; 00108 00110 virtual bool_type isDegreeOrder() const = 0; 00111 00113 virtual bool_type isBlockOrder() const = 0; 00114 00116 virtual bool_type isTotalDegreeOrder() const = 0; 00117 00119 virtual bool_type ascendingVariables() const = 0; 00120 00122 virtual bool_type descendingVariables() const = 0; 00123 00125 virtual bool_type isDegreeReverseLexicographical() const = 0; 00126 00128 virtual ordered_iterator leadIteratorBegin(const poly_type&) const = 0; 00129 00131 virtual ordered_iterator leadIteratorEnd() const = 0; 00132 00134 virtual ordered_exp_iterator leadExpIteratorBegin(const poly_type&) const = 0; 00135 00137 virtual ordered_exp_iterator leadExpIteratorEnd() const = 0; 00138 00140 virtual ordercode_type getOrderCode() const = 0; 00141 00143 virtual ordercode_type getBaseOrderCode() const = 0 ; 00144 00146 00147 virtual block_iterator blockBegin() const { return block_iterator(); } 00148 virtual block_iterator blockEnd() const { return block_iterator(); } 00149 virtual void appendBlock(checked_idx_type) {} 00150 virtual void clearBlocks() {} 00152 00155 virtual bool_type lieInSameBlock(idx_type, idx_type) const = 0; 00156 00158 virtual idx_type lastBlockStart() const = 0; 00159 00160 protected: 00162 monom_type monom(const set_type& rhs) const { 00163 if UNLIKELY(rhs.isZero()) 00164 throw PBoRiGenericError<CTypes::illegal_on_zero>(); 00165 return monom_type(rhs); 00166 } 00167 }; 00168 00169 inline 00170 COrderingBase::~COrderingBase() { } 00171 00172 END_NAMESPACE_PBORI 00173 00174 #endif