24 #ifndef PPL_Ask_Tell_inlines_hh
25 #define PPL_Ask_Tell_inlines_hh 1
28 #include "assertions.hh"
68 const D& x_ask = x.
ask();
69 const D& x_tell = x.
tell();
70 const D& y_ask = y.
ask();
71 const D& y_tell = y.
tell();
72 if (!y_ask.definitely_entails(x_ask)) {
75 else if (x_tell.definitely_entails(y_tell)) {
79 else if (x_tell.definitely_entails(y_ask)) {
83 D x_tell_y_ask = x_tell;
84 x_tell_y_ask.meet_assign(y_ask);
85 return x_tell_y_ask.definitely_entails(y_tell);
91 : sequence(), normalized(true) {
96 : sequence(y.sequence), normalized(y.normalized) {
101 : sequence(), normalized(true) {
102 if (!tell.is_top()) {
107 template <
typename D>
112 template <
typename D>
120 template <
typename D>
127 template <
typename D>
130 return sequence.begin();
133 template <
typename D>
136 return sequence.begin();
139 template <
typename D>
142 return sequence.end();
145 template <
typename D>
148 return sequence.end();
151 template <
typename D>
154 return sequence.rbegin();
157 template <
typename D>
160 return sequence.rbegin();
163 template <
typename D>
166 return sequence.rend();
169 template <
typename D>
172 return sequence.rend();
175 template <
typename D>
178 return sequence.size();
181 template <
typename D>
184 PPL_ASSERT_HEAVY(!ask.definitely_entails(tell));
189 template <
typename D>
192 if (tell.definitely_entails(ask)) {
193 pair_insert_good(ask, tell);
197 new_tell.meet_assign(ask);
198 pair_insert_good(ask, new_tell);
202 template <
typename D>
215 PPL_ASSERT_HEAVY(OK());
218 template <
typename D>
221 if (!normalized && check_normalized()) {
227 template <
typename D>
235 yi = y.
begin(); found && yi != y_end; ++yi) {
238 found = xi->definitely_entails(*yi);
243 template <
typename D>
246 if (!ask.definitely_entails(tell)) {
247 pair_insert(ask, tell);
249 PPL_ASSERT_HEAVY(OK());
254 template <
typename D>
261 template <
typename D>
267 template <
typename D>
270 return sequence.empty();
273 template <
typename D>
280 && xi->ask().is_top() && xi->tell().is_bottom()
284 template <
typename D>
287 return sequence.empty();
290 template <
typename D>
294 std::copy(y.
begin(), y.
end(), back_inserter(sequence));
297 PPL_ASSERT_HEAVY(OK());
302 template <
typename D>
310 while (tell_changed) {
311 tell_changed =
false;
312 for (yi = begin(); yi != end(); ++yi) {
313 if (xtell.definitely_entails(yi->ask())
314 && !xtell.definitely_entails(yi->tell())) {
315 xtell.meet_assign(yi->tell());
316 if (xtell.definitely_entails(ask)) {
327 template <
typename D>
335 #endif // !defined(PPL_Ask_Tell_inlines_hh)
bool probe(const D &tellv, const D &askv) const
void normalize() const
Normalizes the pairs in *this.
iterator begin()
Returns an iterator pointing to the first pair, if *this is not empty; otherwise, returns the past-th...
void swap(CO_Tree &x, CO_Tree &y)
const D & ask() const
Const accessor to the ask component.
bool definitely_entails(const Ask_Tell_Pair &y) const
Returns true if *this definitely entails y. Returns false if *this may not entail y (i...
Ask_Tell & operator=(const Ask_Tell &y)
The assignment operator. (*this and y can be dimension-incompatible.)
void swap(Ask_Tell< D > &x, Ask_Tell< D > &y)
Ask_Tell()
Default constructor: builds the top of the ask-and-tell constraint system (i.e., the empty system)...
Sequence::size_type size_type
bool empty() const
Returns true if and only if there are no pairs in *this.
bool is_bottom() const
Returns true if and only if *this is the bottom element of the ask-and-tell constraint system (i...
void m_swap(Ask_Tell &y)
Swaps *this with y.
bool operator==(const Ask_Tell< D > &x, const Ask_Tell< D > &y)
bool operator!=(const Ask_Tell< D > &x, const Ask_Tell< D > &y)
size_type size() const
Returns the number of pairs.
iterator end()
Returns the past-the-end iterator.
Ask_Tell_Pair(const D &ask, const D &tell)
Pair constructor.
std::reverse_iterator< iterator > reverse_iterator
The reverse iterator type built from Powerset::iterator.
std::reverse_iterator< const_iterator > const_reverse_iterator
The reverse iterator type built from Powerset::const_iterator.
Sequence sequence
The sequence container holding the pairs/.
reverse_iterator rbegin()
Returns a reverse_iterator pointing to the last pair, if *this is not empty; otherwise, returns the before-the-start reverse_iterator.
bool is_normalized() const
Returns true if and only if *this is normalized.
bool definitely_entails(const Ask_Tell &y) const
Returns true if *this definitely entails y. Returns false if *this may not entail y (i...
void meet_assign(const Ask_Tell &y)
Assigns to *this the meet of *this and y.
bool is_top() const
Returns true if and only if *this is the top element of the ask-and-tell constraint system (i...
A const_iterator on a sequence of read-only objects.
Ask_Tell & add_pair(const Ask_Tell_Pair< D > &p)
Adds to *this the pair p.
The entire library is confined to this namespace.
const D & tell() const
Const accessor to the ask component.
void pair_insert_good(const D &a, const D &t)
bool normalized
If true, *this is normalized.
A pair of ask and tell descriptions.
An iterator on a sequence of read-only objects.
reverse_iterator rend()
Returns the before-the-start reverse_iterator.
void pair_insert(const D &a, const D &t)
The ask and tell construction on a base-level domain.