00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef polybori_groebner_PolyEntryReference_h_ 00017 #define polybori_groebner_PolyEntryReference_h_ 00018 00019 // include basic definitions 00020 #include "groebner_defs.h" 00021 #include <set> 00022 00023 #include "PolyEntryIndices.h" 00024 #include "PolyEntry.h" 00025 00026 BEGIN_NAMESPACE_PBORIGB 00027 00034 class PolyEntryReference { 00035 typedef PolyEntryReference self; 00036 00037 public: 00038 typedef PolyEntryIndices vector_type; 00039 typedef PolyEntry value_type; 00040 00042 PolyEntryReference(value_type &entry, vector_type& parent): 00043 vPairCalculated(entry.vPairCalculated), minimal(entry.minimal), 00044 m_entry(entry), m_parent(parent) { } 00045 00047 bool operator==(const self& rhs) const { return m_entry == rhs; } 00048 00050 00051 void markVariablePairsCalculated() { 00052 return m_entry.markVariablePairsCalculated(); } 00053 00054 bool propagatableBy(const PolyEntry& other) const { 00055 return m_entry.propagatableBy(other); 00056 } 00057 00058 std::set<idx_type>& vPairCalculated; 00059 bool& minimal; 00061 00063 template <class Type> 00064 self& operator=(const Type& rhs) { 00065 Monomial lm(m_entry.lead); 00066 m_entry = rhs; 00067 m_parent.update(lm, m_entry); 00068 return *this; 00069 } 00070 00072 const value_type& get() const { return const_cast<const value_type&>(m_entry); } 00073 00075 operator const value_type&() const { return get(); } 00076 00077 private: 00078 value_type& m_entry; 00079 vector_type& m_parent; 00080 }; 00081 00082 00083 END_NAMESPACE_PBORIGB 00084 00085 #endif /* polybori_groebner_PolyEntryReference_h_ */