PPL  0.12.1
Parma_Polyhedra_Library::Ask_Tell< D > Class Template Reference

The ask and tell construction on a base-level domain. More...

#include <Ask_Tell.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Ask_Tell< D >:

List of all members.

Public Types

typedef Sequence::size_type size_type
typedef Sequence::value_type value_type
typedef iterator_to_const
< Sequence
iterator
 Alias for a read-only bidirectional iterator on the pairs an Ask_Tell object.
typedef
const_iterator_to_const
< Sequence
const_iterator
 A bidirectional const_iterator on the disjuncts of a Powerset element.
typedef std::reverse_iterator
< iterator
reverse_iterator
 The reverse iterator type built from Powerset::iterator.
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 The reverse iterator type built from Powerset::const_iterator.

Public Member Functions

Constructors and Destructor
 Ask_Tell ()
 Default constructor: builds the top of the ask-and-tell constraint system (i.e., the empty system).
 Ask_Tell (const Ask_Tell &y)
 Copy constructor.
 Ask_Tell (const Ask_Tell_Pair< D > &p)
 If p is not top, builds an ask-and-tell system containing only p. Builds the empty system otherwise.
 Ask_Tell (const D &ask, const D &tell)
 If ask and tell do not constitute a top pair, builds an ask-and-tell system containing only that pair. Builds the empty system otherwise.
 ~Ask_Tell ()
 Destructor.
Member Functions that Do Not Modify the Ask_Tell Object
bool definitely_entails (const Ask_Tell &y) const
 Returns true if *this definitely entails y. Returns false if *this may not entail y (i.e., if *this does not entail y or if entailment could not be decided).
bool is_top () const
 Returns true if and only if *this is the top element of the ask-and-tell constraint system (i.e., it represents the universe).
bool is_bottom () const
 Returns true if and only if *this is the bottom element of the ask-and-tell constraint system (i.e., it represents the empty set).
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this.
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this.
int32_t hash_code () const
 Returns a 32-bit hash code for *this.
bool OK () const
 Checks if all the invariants are satisfied.
Member Functions for the Direct Manipulation of Pairs
void normalize () const
 Normalizes the pairs in *this.
size_type size () const
 Returns the number of pairs.
bool empty () const
 Returns true if and only if there are no pairs in *this.
iterator begin ()
 Returns an iterator pointing to the first pair, if *this is not empty; otherwise, returns the past-the-end iterator.
iterator end ()
 Returns the past-the-end iterator.
const_iterator begin () const
 Returns a const_iterator pointing to the first pair, if *this is not empty; otherwise, returns the past-the-end const_iterator.
const_iterator end () const
 Returns the past-the-end const_iterator.
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.
reverse_iterator rend ()
 Returns the before-the-start reverse_iterator.
const_reverse_iterator rbegin () const
 Returns a const_reverse_iterator pointing to the last pair, if *this is not empty; otherwise, returns the before-the-start const_reverse_iterator.
const_reverse_iterator rend () const
 Returns the before-the-start const_reverse_iterator.
Ask_Telladd_pair (const Ask_Tell_Pair< D > &p)
 Adds to *this the pair p.
Ask_Telladd_pair (const D &ask, const D &tell)
 Adds to *this the pair constituted by ask and tell.
iterator drop_pair (iterator position)
 Drops the pair in *this pointed to by position, returning an iterator to the pair following position.
void drop_pairs (iterator first, iterator last)
 Drops all the pairs from first to last (excluded).
void clear ()
 Drops all the pairs, making *this an empty powerset.
Member Functions that May Modify the Ask_Tell Object
Ask_Telloperator= (const Ask_Tell &y)
 The assignment operator. (*this and y can be dimension-incompatible.)
void m_swap (Ask_Tell &y)
 Swaps *this with y.
void upper_bound_assign (const Ask_Tell &y)
 Assigns to *this an upper bound of *this and y.
void meet_assign (const Ask_Tell &y)
 Assigns to *this the meet of *this and y.

Protected Types

typedef Ask_Tell_Pair< D > Pair
 An ask-tell agent is composed of pairs.
typedef std::list
< Ask_Tell_Pair< D > > 
Sequence
 An ask-tell agent is implemented as a sequence of ask-tell pairs.
typedef Sequence::iterator Sequence_iterator
 Alias for the low-level iterator on the pairs.
typedef Sequence::const_iterator Sequence_const_iterator
 Alias for the low-level const_iterator on the pairs.

Protected Member Functions

bool is_normalized () const
 Returns true if and only if *this is normalized.
void pair_insert (const D &a, const D &t)
void pair_insert_good (const D &a, const D &t)
bool reduce ()
bool deduce ()
bool absorb ()
void deabsorb () const
bool check_normalized () const
 Does the hard work of checking whether *this is normalized and returns true if and only if it is.
bool probe (const D &tellv, const D &askv) const

Protected Attributes

Sequence sequence
 The sequence container holding the pairs/.
bool normalized
 If true, *this is normalized.

Related Functions

(Note that these are not member functions.)

template<typename D >
void swap (Ask_Tell< D > &x, Ask_Tell< D > &y)
 Swaps x with y.
template<typename D >
bool operator== (const Ask_Tell< D > &x, const Ask_Tell< D > &y)
 Returns true if and only if x and y are equivalent.
template<typename D >
bool operator!= (const Ask_Tell< D > &x, const Ask_Tell< D > &y)
 Returns true if and only if x and y are not equivalent.
template<typename D >
std::ostream & operator<< (std::ostream &, const Ask_Tell< D > &)
 Output operator.
template<typename D >
bool operator== (const Ask_Tell< D > &x, const Ask_Tell< D > &y)
template<typename D >
bool operator!= (const Ask_Tell< D > &x, const Ask_Tell< D > &y)
template<typename D >
void swap (Ask_Tell< D > &x, Ask_Tell< D > &y)

Detailed Description

template<typename D>
class Parma_Polyhedra_Library::Ask_Tell< D >

The ask and tell construction on a base-level domain.

This class offers a generic implementation of ask-and-tell constraint systems as defined in [Bag98].

Definition at line 106 of file Ask_Tell.defs.hh.


Member Typedef Documentation

A bidirectional const_iterator on the disjuncts of a Powerset element.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 229 of file Ask_Tell.defs.hh.

template<typename D>
typedef std::reverse_iterator<const_iterator> Parma_Polyhedra_Library::Ask_Tell< D >::const_reverse_iterator

The reverse iterator type built from Powerset::const_iterator.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 235 of file Ask_Tell.defs.hh.

Alias for a read-only bidirectional iterator on the pairs an Ask_Tell object.

By using this iterator type, the pairs cannot be overwritten, but they can be removed using methods drop_pair(iterator position) and drop_pairs(iterator first, iterator last), while still ensuring a correct handling of normalization.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 226 of file Ask_Tell.defs.hh.

template<typename D>
typedef Ask_Tell_Pair<D> Parma_Polyhedra_Library::Ask_Tell< D >::Pair
protected

An ask-tell agent is composed of pairs.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 190 of file Ask_Tell.defs.hh.

template<typename D>
typedef std::reverse_iterator<iterator> Parma_Polyhedra_Library::Ask_Tell< D >::reverse_iterator

The reverse iterator type built from Powerset::iterator.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 232 of file Ask_Tell.defs.hh.

template<typename D>
typedef std::list<Ask_Tell_Pair<D> > Parma_Polyhedra_Library::Ask_Tell< D >::Sequence
protected

An ask-tell agent is implemented as a sequence of ask-tell pairs.

The particular sequence employed must support efficient deletion in any position and efficient back insertion.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 197 of file Ask_Tell.defs.hh.

template<typename D>
typedef Sequence::const_iterator Parma_Polyhedra_Library::Ask_Tell< D >::Sequence_const_iterator
protected

Alias for the low-level const_iterator on the pairs.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 203 of file Ask_Tell.defs.hh.

template<typename D>
typedef Sequence::iterator Parma_Polyhedra_Library::Ask_Tell< D >::Sequence_iterator
protected

Alias for the low-level iterator on the pairs.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 200 of file Ask_Tell.defs.hh.

template<typename D>
typedef Sequence::size_type Parma_Polyhedra_Library::Ask_Tell< D >::size_type

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 213 of file Ask_Tell.defs.hh.

template<typename D>
typedef Sequence::value_type Parma_Polyhedra_Library::Ask_Tell< D >::value_type

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 214 of file Ask_Tell.defs.hh.


Constructor & Destructor Documentation

template<typename D >
Parma_Polyhedra_Library::Ask_Tell< D >::Ask_Tell ( )

Default constructor: builds the top of the ask-and-tell constraint system (i.e., the empty system).

Definition at line 87 of file Ask_Tell.inlines.hh.

  : sequence(), normalized(true) {
}
template<typename D >
Parma_Polyhedra_Library::Ask_Tell< D >::Ask_Tell ( const Ask_Tell< D > &  y)

Copy constructor.

Definition at line 92 of file Ask_Tell.inlines.hh.

  : sequence(y.sequence), normalized(y.normalized) {
}
template<typename D>
Parma_Polyhedra_Library::Ask_Tell< D >::Ask_Tell ( const Ask_Tell_Pair< D > &  p)
explicit

If p is not top, builds an ask-and-tell system containing only p. Builds the empty system otherwise.

template<typename D>
Parma_Polyhedra_Library::Ask_Tell< D >::Ask_Tell ( const D &  ask,
const D &  tell 
)

If ask and tell do not constitute a top pair, builds an ask-and-tell system containing only that pair. Builds the empty system otherwise.

Definition at line 97 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::pair_insert().

  : sequence(), normalized(true) {
  if (!tell.is_top())
    pair_insert(ask, tell);
}
template<typename D >
Parma_Polyhedra_Library::Ask_Tell< D >::~Ask_Tell ( )
inline

Destructor.

Definition at line 105 of file Ask_Tell.inlines.hh.

                       {
}

Member Function Documentation

template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::absorb ( )
protected

Definition at line 101 of file Ask_Tell.templates.hh.

References PPL_ASSERT_HEAVY.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::normalize().

                    {
  bool changed = false;
  for (Sequence_iterator x_begin = sequence.begin(),
         x_end = sequence.end(), xi = x_begin; xi != x_end; ) {
    D& xi_ask = xi->ask();
    D& xi_tell = xi->tell();
    // We may strengthen the ask component of the pair referenced by `xi'.
    // If we do it, the pair may become useless (i.e., with the ask
    // component entailing the tell component) and thus to be
    // discarded.
    bool must_check_xi_pair = false;
    bool ask_changed;
    do {
      ask_changed = false;
      for (Sequence_iterator yi = x_begin; yi != x_end; ++yi) {
        if (xi != yi) {
          D& yi_ask = yi->ask();
          D& yi_tell = yi->tell();
          if (xi_ask.definitely_entails(yi_ask)
              && !xi_ask.definitely_entails(yi_tell)) {
            xi_ask.meet_assign(yi_tell);
            must_check_xi_pair = true;
            ask_changed = true;
          }
        }
      }
    } while (ask_changed);
    if (must_check_xi_pair) {
      changed = true;
      if (xi_ask.definitely_entails(xi_tell)) {
        xi = sequence.erase(xi);
        x_begin = sequence.begin();
        x_end = sequence.end();
      }
      else
        ++xi;
    }
    else
      ++xi;
  }
  if (changed)
    (void) reduce();
  PPL_ASSERT_HEAVY(OK());
  return changed;
}
template<typename D>
Ask_Tell& Parma_Polyhedra_Library::Ask_Tell< D >::add_pair ( const Ask_Tell_Pair< D > &  p)

Adds to *this the pair p.

template<typename D>
Ask_Tell< D > & Parma_Polyhedra_Library::Ask_Tell< D >::add_pair ( const D &  ask,
const D &  tell 
)

Adds to *this the pair constituted by ask and tell.

Definition at line 238 of file Ask_Tell.inlines.hh.

References PPL_ASSERT_HEAVY.

                                                 {
  if (!ask.definitely_entails(tell))
    pair_insert(ask, tell);
  PPL_ASSERT_HEAVY(OK());
  return *this;
}
template<typename D >
Ask_Tell< D >::const_iterator Parma_Polyhedra_Library::Ask_Tell< D >::begin ( ) const

Returns a const_iterator pointing to the first pair, if *this is not empty; otherwise, returns the past-the-end const_iterator.

Definition at line 131 of file Ask_Tell.inlines.hh.

                         {
  return sequence.begin();
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::check_normalized ( ) const
protected

Does the hard work of checking whether *this is normalized and returns true if and only if it is.

Definition at line 33 of file Ask_Tell.templates.hh.

                                    {
  for (const_iterator x_begin = begin(),
         x_end = end(), xi = x_begin; xi != x_end; ++xi)
    for (const_iterator yi = x_begin; yi != x_end; ++yi)
      if (xi != yi) {
        if (xi->tell().definitely_entails(yi->tell())) {
          if (yi->ask().definitely_entails(xi->ask()))
            return false;
        }
        else if (xi->tell().definitely_entails(yi->ask()))
          return false;
        if (xi->ask().definitely_entails(yi->ask())
            && !xi->ask().definitely_entails(yi->tell()))
          return false;
      }
  return true;
}
template<typename D>
void Parma_Polyhedra_Library::Ask_Tell< D >::clear ( )

Drops all the pairs, making *this an empty powerset.

template<typename D >
void Parma_Polyhedra_Library::Ask_Tell< D >::deabsorb ( ) const
protected

Definition at line 149 of file Ask_Tell.templates.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::deduce(), PPL_ASSERT_HEAVY, Parma_Polyhedra_Library::Ask_Tell< D >::reduce(), and Parma_Polyhedra_Library::Ask_Tell< D >::sequence.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::upper_bound_assign().

                            {
  if (D::has_nontrivial_weakening()) {
    Sequence new_sequence;
    for (Sequence_const_iterator x_begin = sequence.begin(),
           x_end = sequence.end(), xi = x_begin; xi != x_end; ++xi)
      for (Sequence_const_iterator yi = x_begin; yi != x_end; ++yi) {
        if (xi != yi) {
          const D& xi_ask = xi->ask();
          const D& yi_ask = yi->ask();
          if (xi_ask.definitely_entails(yi_ask)) {
            D new_ask = xi_ask;
            new_ask.weakening_assign(yi->tell());
            new_ask.meet_assign(yi_ask);
            if (!new_ask.definitely_entails(xi_ask))
              new_sequence.push_back(Pair(new_ask, xi->tell()));
          }
        }
      }
    if (!new_sequence.empty()) {
      Ask_Tell& x = const_cast<Ask_Tell&>(*this);
      std::copy(new_sequence.begin(), new_sequence.end(),
                back_inserter(x.sequence));
      x.reduce();
      x.deduce();
      normalized = false;
    }
  }
  else if (!normalized) {
    Ask_Tell& x = const_cast<Ask_Tell&>(*this);
    x.reduce();
    x.deduce();
  }
  PPL_ASSERT_HEAVY(OK());
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::deduce ( )
protected

Definition at line 75 of file Ask_Tell.templates.hh.

References PPL_ASSERT_HEAVY.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::deabsorb(), and Parma_Polyhedra_Library::Ask_Tell< D >::normalize().

                    {
  bool changed = false;
  for (Sequence_iterator x_begin = sequence.begin(),
         x_end = sequence.end(), xi = x_begin; xi != x_end; ++xi) {
    D& xi_tell = xi->tell();
    bool tell_changed;
    do {
      tell_changed = false;
      for (Sequence_iterator yi = x_begin; yi != x_end; ++yi) {
        if (xi != yi
            && xi_tell.definitely_entails(yi->ask())
            && !xi_tell.definitely_entails(yi->tell())) {
          xi_tell.meet_assign(yi->tell());
          changed = tell_changed = true;
          }
        }
    } while (tell_changed);
  }
  if (changed)
    (void) reduce();
  PPL_ASSERT_HEAVY(OK());
  return changed;
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::definitely_entails ( const Ask_Tell< D > &  y) const

Returns true if *this definitely entails y. Returns false if *this may not entail y (i.e., if *this does not entail y or if entailment could not be decided).

Definition at line 222 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::begin(), Parma_Polyhedra_Library::Ask_Tell< D >::end(), and Parma_Polyhedra_Library::Ask_Tell< D >::normalize().

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::operator==().

                                                       {
  const Ask_Tell<D>& x = *this;
  x.normalize();
  y.normalize();
  bool found = true;
  for (const_iterator x_begin = x.begin(), x_end = x.end(), y_end = y.end(),
         yi = y.begin(); found && yi != y_end; ++yi) {
    found = false;
    for (const_iterator xi = x_begin; !found && xi != x_end; ++xi)
      found = xi->definitely_entails(*yi);
  }
  return found;
}
template<typename D>
iterator Parma_Polyhedra_Library::Ask_Tell< D >::drop_pair ( iterator  position)

Drops the pair in *this pointed to by position, returning an iterator to the pair following position.

template<typename D>
void Parma_Polyhedra_Library::Ask_Tell< D >::drop_pairs ( iterator  first,
iterator  last 
)

Drops all the pairs from first to last (excluded).

template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::empty ( ) const

Returns true if and only if there are no pairs in *this.

Definition at line 278 of file Ask_Tell.inlines.hh.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::meet_assign().

                         {
  return sequence.empty();
}
template<typename D >
Ask_Tell< D >::const_iterator Parma_Polyhedra_Library::Ask_Tell< D >::end ( ) const

Returns the past-the-end const_iterator.

Definition at line 143 of file Ask_Tell.inlines.hh.

                       {
  return sequence.end();
}

Returns a lower bound to the size in bytes of the memory managed by *this.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

template<typename D>
int32_t Parma_Polyhedra_Library::Ask_Tell< D >::hash_code ( ) const

Returns a 32-bit hash code for *this.

If x and y are such that x == y, then x.hash_code() == y.hash_code().

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::is_bottom ( ) const

Returns true if and only if *this is the bottom element of the ask-and-tell constraint system (i.e., it represents the empty set).

Definition at line 267 of file Ask_Tell.inlines.hh.

Referenced by Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >::map_space_dimensions().

                             {
  // Must normalize for correctness.
  const_iterator xi = begin();
  const_iterator x_end = end();
  return xi != x_end
    && xi->ask().is_top() && xi->tell().is_bottom()
    && ++xi == x_end;
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::is_normalized ( ) const
protected

Returns true if and only if *this is normalized.

Definition at line 214 of file Ask_Tell.inlines.hh.

                                 {
  if (!normalized && check_normalized())
    normalized = true;
  return normalized;
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::is_top ( ) const

Returns true if and only if *this is the top element of the ask-and-tell constraint system (i.e., it represents the universe).

Definition at line 261 of file Ask_Tell.inlines.hh.

                          {
  return sequence.empty();
}
template<typename D >
void Parma_Polyhedra_Library::Ask_Tell< D >::m_swap ( Ask_Tell< D > &  y)
inline
template<typename D >
void Parma_Polyhedra_Library::Ask_Tell< D >::meet_assign ( const Ask_Tell< D > &  y)

Assigns to *this the meet of *this and y.

Definition at line 284 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::begin(), Parma_Polyhedra_Library::Ask_Tell< D >::empty(), Parma_Polyhedra_Library::Ask_Tell< D >::end(), and PPL_ASSERT_HEAVY.

                                          {
  if (!y.empty()) {
    std::copy(y.begin(), y.end(), back_inserter(sequence));
    normalized = false;
  }
  PPL_ASSERT_HEAVY(OK());
}
template<typename D >
void Parma_Polyhedra_Library::Ask_Tell< D >::normalize ( ) const

Normalizes the pairs in *this.

This method is declared const because, even though normalization may change the syntactic representation of *this, its semantics will be unchanged.

Definition at line 199 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::absorb(), Parma_Polyhedra_Library::Ask_Tell< D >::deduce(), PPL_ASSERT_HEAVY, and Parma_Polyhedra_Library::Ask_Tell< D >::reduce().

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::definitely_entails().

                             {
  if (normalized)
    return;

  Ask_Tell& x = const_cast<Ask_Tell&>(*this);
  x.reduce();
  x.deduce();
  x.absorb();
  normalized = true;

  PPL_ASSERT_HEAVY(OK());
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::OK ( ) const

Checks if all the invariants are satisfied.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

Definition at line 208 of file Ask_Tell.templates.hh.

References Parma_Polyhedra_Library::Ask_Tell_Pair< D >::ask(), and Parma_Polyhedra_Library::Ask_Tell_Pair< D >::tell().

                      {
  for (typename Ask_Tell<D>::const_iterator xi = begin(),
         x_end = end(); xi != x_end; ++xi) {
    const Ask_Tell_Pair<D>& p = *xi;
    if (!p.ask().OK())
      return false;
    if (!p.tell().OK())
      return false;
    if (p.ask().definitely_entails(p.tell())) {
#ifndef NDEBUG
      using namespace IO_Operators;
      std::cerr << "Illegal agent in ask-and-tell: "
                << p.ask() << " -> " << p.tell()
                << std::endl;
#endif
      return false;
    }
  }
  if (normalized && !check_normalized()) {
#ifndef NDEBUG
    std::cerr << "Ask_Tell claims to be normalized, but it is not!"
              << std::endl;
#endif
    return false;
  }
  return true;
}
template<typename D >
Ask_Tell< D > & Parma_Polyhedra_Library::Ask_Tell< D >::operator= ( const Ask_Tell< D > &  y)

The assignment operator. (*this and y can be dimension-incompatible.)

Definition at line 110 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::normalized, and Parma_Polyhedra_Library::Ask_Tell< D >::sequence.

                                        {
  sequence = y.sequence;
  normalized = y.normalized;
  return *this;
}
template<typename D>
void Parma_Polyhedra_Library::Ask_Tell< D >::pair_insert ( const D &  a,
const D &  t 
)
protected

Definition at line 187 of file Ask_Tell.inlines.hh.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::Ask_Tell(), and Parma_Polyhedra_Library::Ask_Tell< D >::upper_bound_assign().

                                                    {
  if (tell.definitely_entails(ask))
    pair_insert_good(ask, tell);
  else {
    D new_tell = tell;
    new_tell.meet_assign(ask);
    pair_insert_good(ask, new_tell);
  }
}
template<typename D>
void Parma_Polyhedra_Library::Ask_Tell< D >::pair_insert_good ( const D &  a,
const D &  t 
)
protected

Definition at line 179 of file Ask_Tell.inlines.hh.

References PPL_ASSERT_HEAVY.

                                                         {
  PPL_ASSERT_HEAVY(!ask.definitely_entails(tell));
  sequence.push_back(Ask_Tell_Pair<D>(ask, tell));
  normalized = false;
}
template<typename D>
bool Parma_Polyhedra_Library::Ask_Tell< D >::probe ( const D &  tellv,
const D &  askv 
) const
protected

Definition at line 296 of file Ask_Tell.inlines.hh.

                                                    {
  const_iterator yi;
  bool tell_changed;

  D xtell(tell);
  tell_changed = true;
  while (tell_changed) {
    tell_changed = false;
    for (yi = begin(); yi != end(); ++yi) {
      if (xtell.definitely_entails(yi->ask())
          && !xtell.definitely_entails(yi->tell())) {
          xtell.meet_assign(yi->tell());
          if (xtell.definitely_entails(ask))
            return true;
          tell_changed = true;
      }
    }
  }
  return false;
}
template<typename D >
Ask_Tell< D >::reverse_iterator Parma_Polyhedra_Library::Ask_Tell< D >::rbegin ( )

Returns a reverse_iterator pointing to the last pair, if *this is not empty; otherwise, returns the before-the-start reverse_iterator.

Definition at line 149 of file Ask_Tell.inlines.hh.

                    {
  return sequence.rbegin();
}
template<typename D >
Ask_Tell< D >::const_reverse_iterator Parma_Polyhedra_Library::Ask_Tell< D >::rbegin ( ) const

Returns a const_reverse_iterator pointing to the last pair, if *this is not empty; otherwise, returns the before-the-start const_reverse_iterator.

Definition at line 155 of file Ask_Tell.inlines.hh.

                          {
  return sequence.rbegin();
}
template<typename D >
bool Parma_Polyhedra_Library::Ask_Tell< D >::reduce ( )
protected

Definition at line 53 of file Ask_Tell.templates.hh.

References PPL_ASSERT_HEAVY.

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::deabsorb(), and Parma_Polyhedra_Library::Ask_Tell< D >::normalize().

                    {
  bool changed = false;
  for (Sequence_iterator x_begin = sequence.begin(),
         x_end = sequence.end(), xi = x_begin; xi != x_end; ++xi)
    for (Sequence_iterator yi = x_begin; yi != x_end; ) {
      if (xi != yi
          && yi->ask().definitely_entails(xi->ask())
          && xi->tell().definitely_entails(yi->tell())) {
        yi = sequence.erase(yi);
        x_begin = sequence.begin();
        x_end = sequence.end();
        changed = true;
      }
      else
        ++yi;
    }
  PPL_ASSERT_HEAVY(OK());
  return changed;
}
template<typename D >
Ask_Tell< D >::reverse_iterator Parma_Polyhedra_Library::Ask_Tell< D >::rend ( )

Returns the before-the-start reverse_iterator.

Definition at line 161 of file Ask_Tell.inlines.hh.

                  {
  return sequence.rend();
}
template<typename D >
Ask_Tell< D >::const_reverse_iterator Parma_Polyhedra_Library::Ask_Tell< D >::rend ( ) const

Returns the before-the-start const_reverse_iterator.

Definition at line 167 of file Ask_Tell.inlines.hh.

                        {
  return sequence.rend();
}
template<typename D >
Ask_Tell< D >::size_type Parma_Polyhedra_Library::Ask_Tell< D >::size ( ) const

Returns the number of pairs.

Definition at line 173 of file Ask_Tell.inlines.hh.

Referenced by Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >::ascii_dump().

                        {
  return sequence.size();
}

Returns a lower bound to the total size in bytes of the memory occupied by *this.

Reimplemented in Parma_Polyhedra_Library::Pointset_Ask_Tell< PSET >.

template<typename D >
void Parma_Polyhedra_Library::Ask_Tell< D >::upper_bound_assign ( const Ask_Tell< D > &  y)

Assigns to *this an upper bound of *this and y.

Definition at line 186 of file Ask_Tell.templates.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::begin(), Parma_Polyhedra_Library::Ask_Tell< D >::deabsorb(), Parma_Polyhedra_Library::Ask_Tell< D >::end(), Parma_Polyhedra_Library::Ask_Tell< D >::pair_insert(), PPL_ASSERT_HEAVY, and Parma_Polyhedra_Library::Ask_Tell< D >::upper_bound_assign().

Referenced by Parma_Polyhedra_Library::Ask_Tell< D >::upper_bound_assign().

                                                 {
  const Ask_Tell& x = *this;
  x.deabsorb();
  y.deabsorb();
  Ask_Tell<D> z;
  for (typename Ask_Tell<D>::const_iterator xi = x.begin(),
         x_end = x.end(); xi != x_end; ++xi)
    for (typename Ask_Tell<D>::const_iterator yi = y.begin(),
           y_end = y.end(); yi != y_end; ++yi) {
      D tell = xi->tell();
      tell.upper_bound_assign(yi->tell());
      D ask = xi->ask();
      ask.meet_assign(yi->ask());
      if (!ask.definitely_entails(tell))
        z.pair_insert(ask, tell);
    }
  *this = z;
  PPL_ASSERT_HEAVY(OK());
}

Friends And Related Function Documentation

template<typename D >
bool operator!= ( const Ask_Tell< D > &  x,
const Ask_Tell< D > &  y 
)
related

Returns true if and only if x and y are not equivalent.

template<typename D >
bool operator!= ( const Ask_Tell< D > &  x,
const Ask_Tell< D > &  y 
)
related

Definition at line 255 of file Ask_Tell.inlines.hh.

                                                            {
  return !(x == y);
}
template<typename D >
std::ostream & operator<< ( std::ostream &  ,
const Ask_Tell< D > &   
)
related

Output operator.

Definition at line 240 of file Ask_Tell.templates.hh.

                                                {
  if (x.is_top())
    s << "true";
  else if (x.is_bottom())
    s << "false";
  else
    for (typename Ask_Tell<D>::const_iterator xi = x.begin(),
           x_end = x.end(); xi != x_end; ++xi)
      s << "(" << xi->ask() << " -> " << xi->tell() << ")";
  return s;
}
template<typename D >
bool operator== ( const Ask_Tell< D > &  x,
const Ask_Tell< D > &  y 
)
related

Returns true if and only if x and y are equivalent.

template<typename D >
bool operator== ( const Ask_Tell< D > &  x,
const Ask_Tell< D > &  y 
)
related

Definition at line 248 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::definitely_entails().

                                                            {
  return x.definitely_entails(y) && y.definitely_entails(x);
}
template<typename D >
void swap ( Ask_Tell< D > &  x,
Ask_Tell< D > &  y 
)
related

Swaps x with y.

template<typename D >
void swap ( Ask_Tell< D > &  x,
Ask_Tell< D > &  y 
)
related

Definition at line 320 of file Ask_Tell.inlines.hh.

References Parma_Polyhedra_Library::Ask_Tell< D >::m_swap().

                                     {
  x.m_swap(y);
}

Member Data Documentation


The documentation for this class was generated from the following files: