16 #ifndef polybori_groebner_PolyEntryVector_h_
17 #define polybori_groebner_PolyEntryVector_h_
29 typedef std::vector<PolyEntry> data_type;
40 bool empty()
const {
return m_data.empty(); }
41 size_type
size()
const {
return m_data.size(); }
42 const_iterator
begin()
const {
return m_data.begin(); }
43 const_iterator
end()
const {
return m_data.end(); }
44 const_reference
front()
const {
return m_data.front(); }
45 const_reference
back()
const {
return m_data.back(); }
48 template <
class KeyType>
50 return operator()(rhs);
55 reference
first() {
return reference(m_data.front(), m_indices); }
58 const_reference
first()
const {
return front(); }
61 reference
last() {
return reference(m_data.back(), m_indices); }
64 const_reference
last()
const {
return back(); }
68 m_data(), m_indices() {}
72 m_data.push_back(element);
75 if(m_indices.checked(back().lead) != (size_type)-1)
76 throw std::runtime_error(
"leading terms not unique when appending to PolyEntryVector");
78 m_indices.insert(back(), size() - 1);
82 template <
class KeyType>
84 return m_data[index(key)];
88 template <
class KeyType>
90 return reference(m_data[index(rhs)], m_indices);
94 template <
class KeyType,
class Type>
95 void exchange(
const KeyType& key,
const Type& rhs) { operator()(key) = rhs; }
98 template <
class KeyType>
99 size_type
index(
const KeyType& key)
const {
return m_indices(key); }
102 template <
class KeyType>
104 return m_indices.checked(key);
107 template <
class KeyType>
109 return operator[](key).p;
const_iterator end() const
Definition: PolyEntryVector.h:43
const_reference first() const
Constant variant, equivalent to front, for completeness reasons.
Definition: PolyEntryVector.h:58
Definition: PolyEntryVector.h:28
data_type::size_type size_type
Definition: PolyEntryVector.h:35
size_type index(const KeyType &key) const
Retrieve index associated to key.
Definition: PolyEntryVector.h:99
data_type::const_reference const_reference
Definition: PolyEntryVector.h:37
reference first()
Alternative to front which allows partial (but consistent) access.
Definition: PolyEntryVector.h:55
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
PolyEntryVector()
Default constructor.
Definition: PolyEntryVector.h:67
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
This class defines PolyEntry.
Definition: PolyEntry.h:32
const_iterator begin() const
Definition: PolyEntryVector.h:42
const_reference operator()(const KeyType &key) const
Read-only access to element by index, leading term or monomial.
Definition: PolyEntryVector.h:83
This class wraps the underlying decicion diagram type and defines the necessary operations.
Definition: BoolePolynomial.h:85
const Polynomial & polynomial(const KeyType &key) const
Retrieve polynomial associated to key.
Definition: PolyEntryVector.h:108
const_reference last() const
Constant variant, equivalent to back, for completeness reasons.
Definition: PolyEntryVector.h:64
const_reference back() const
Definition: PolyEntryVector.h:45
This class defines PolyEntryIndices.
Definition: PolyEntryIndices.h:33
virtual void append(const PolyEntry &element)
Just insert element.
Definition: PolyEntryVector.h:71
void exchange(const KeyType &key, const Type &rhs)
Exchange element given by key.
Definition: PolyEntryVector.h:95
reference operator()(const KeyType &rhs)
(Partially) write access to element by index, leading term or monomial
Definition: PolyEntryVector.h:89
size_type size() const
Definition: PolyEntryVector.h:41
data_type::const_iterator const_iterator
Definition: PolyEntryVector.h:36
data_type::value_type value_type
Vector-style interface.
Definition: PolyEntryVector.h:34
reference last()
Alternative to back() which allows partial (but consistent) access.
Definition: PolyEntryVector.h:61
const_reference operator[](const KeyType &rhs) const
Read-only access to element by index, leading term or monomial.
Definition: PolyEntryVector.h:49
This class defines PolyEntryReference.
Definition: PolyEntryReference.h:34
bool empty() const
Definition: PolyEntryVector.h:40
PolyEntryReference reference
Definition: PolyEntryVector.h:38
const_reference front() const
Definition: PolyEntryVector.h:44
size_type checked_index(const KeyType &key) const
Retrieve index associated to key if key exists, -1 otherwise.
Definition: PolyEntryVector.h:103