Parma_Polyhedra_Library::Determinate< PSET > Class Template Reference
[C++ Language Interface]

A wrapper for PPL pointsets, providing them with a determinate constraint system interface, as defined in [Bag98]. More...

#include <Determinate.defs.hh>

Collaboration diagram for Parma_Polyhedra_Library::Determinate< PSET >:
Collaboration graph
[legend]

List of all members.

Classes

class  Binary_Operator_Assign_Lifter
 A function adapter for the Determinate class. More...
class  Rep
 The possibly shared representation of a Determinate object. More...

Public Member Functions

Constructors and Destructor

 Determinate (const PSET &p)
 Constructs a COW-wrapped object corresponding to the pointset p.
 Determinate (const Constraint_System &cs)
 Constructs a COW-wrapped object corresponding to the pointset defined by cs.
 Determinate (const Congruence_System &cgs)
 Constructs a COW-wrapped object corresponding to the pointset defined by cgs.
 Determinate (const Determinate &y)
 Copy constructor.
 ~Determinate ()
 Destructor.
Member Functions that May Modify the Domain Element

void upper_bound_assign (const Determinate &y)
 Assigns to *this the upper bound of *this and y.
void meet_assign (const Determinate &y)
 Assigns to *this the meet of *this and y.
void weakening_assign (const Determinate &y)
 Assigns to *this the result of weakening *this with y.
void concatenate_assign (const Determinate &y)
 Assigns to *this the concatenation of *this and y, taken in this order.
PSET & pointset ()
 Returns a reference to the embedded element.
void mutate ()
 On return from this method, the representation of *this is not shared by different Determinate objects.
Determinateoperator= (const Determinate &y)
 Assignment operator.
void swap (Determinate &y)
 Swaps *this with y.

Static Public Member Functions

template<typename Binary_Operator_Assign >
static
Binary_Operator_Assign_Lifter
< Binary_Operator_Assign > 
lift_op_assign (Binary_Operator_Assign op_assign)
 Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of template arguments.

Private Attributes

Repprep
 A pointer to the possibly shared representation of the base-level domain element.

Friends

bool operator== (const Determinate< PSET > &x, const Determinate< PSET > &y)
 Returns true if and only if x and y are the same COW-wrapped pointset.
bool operator!= (const Determinate< PSET > &x, const Determinate< PSET > &y)
 Returns true if and only if x and y are different COW-wrapped pointsets.

Related Functions

(Note that these are not member functions.)



template<typename PSET >
std::ostream & operator<< (std::ostream &, const Determinate< PSET > &)
 Output operator.
template<typename PSET >
void swap (Parma_Polyhedra_Library::Determinate< PSET > &x, Parma_Polyhedra_Library::Determinate< PSET > &y)
 Specializes std::swap.

Member Functions that Do Not Modify the Domain Element



const PSET & pointset () const
 Returns a const reference to the embedded pointset.
bool is_top () const
 Returns true if and only if *this embeds the universe element PSET.
bool is_bottom () const
 Returns true if and only if *this embeds the empty element of PSET.
bool definitely_entails (const Determinate &y) const
 Returns true if and only if *this entails y.
bool is_definitely_equivalent_to (const Determinate &y) const
 Returns true if and only if *this and y are definitely equivalent.
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.
bool OK () const
 Checks if all the invariants are satisfied.
static bool has_nontrivial_weakening ()

Detailed Description

template<typename PSET>
class Parma_Polyhedra_Library::Determinate< PSET >

A wrapper for PPL pointsets, providing them with a determinate constraint system interface, as defined in [Bag98].

The implementation uses a copy-on-write optimization, making the class suitable for constructions, like the finite powerset and ask-and-tell of [Bag98], that are likely to perform many copies.

Definition at line 80 of file Determinate.defs.hh.


Constructor & Destructor Documentation

template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const PSET &  p  )  [inline]

Constructs a COW-wrapped object corresponding to the pointset p.

Definition at line 94 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::new_reference(), and Parma_Polyhedra_Library::Determinate< PSET >::prep.

00095   : prep(new Rep(pset)) {
00096   prep->new_reference();
00097 }

template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const Constraint_System cs  )  [inline]

Constructs a COW-wrapped object corresponding to the pointset defined by cs.

Definition at line 101 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::new_reference(), and Parma_Polyhedra_Library::Determinate< PSET >::prep.

00102   : prep(new Rep(cs)) {
00103   prep->new_reference();
00104 }

template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const Congruence_System cgs  )  [inline]

Constructs a COW-wrapped object corresponding to the pointset defined by cgs.

Definition at line 108 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::new_reference(), and Parma_Polyhedra_Library::Determinate< PSET >::prep.

00109   : prep(new Rep(cgs)) {
00110   prep->new_reference();
00111 }

template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const Determinate< PSET > &  y  )  [inline]
template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::~Determinate (  )  [inline]

Destructor.

Definition at line 122 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::del_reference(), and Parma_Polyhedra_Library::Determinate< PSET >::prep.

00122                                 {
00123   if (prep->del_reference())
00124     delete prep;
00125 }


Member Function Documentation

template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::concatenate_assign ( const Determinate< PSET > &  y  )  [inline]

Assigns to *this the concatenation of *this and y, taken in this order.

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

References Parma_Polyhedra_Library::Determinate< PSET >::pointset().

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign().

00199                                                           {
00200   pointset().concatenate_assign(y.pointset());
00201 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::definitely_entails ( const Determinate< PSET > &  y  )  const [inline]

Returns true if and only if *this entails y.

Definition at line 205 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

00205                                                                 {
00206   return prep == y.prep || y.prep->pset.contains(prep->pset);
00207 }

template<typename PSET >
memory_size_type Parma_Polyhedra_Library::Determinate< PSET >::external_memory_in_bytes (  )  const [inline]

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

Definition at line 229 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::total_memory_in_bytes().

Referenced by Parma_Polyhedra_Library::Determinate< PSET >::total_memory_in_bytes().

00229                                                   {
00230   return prep->total_memory_in_bytes();
00231 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::has_nontrivial_weakening (  )  [inline, static]

Returns true if and only if this domain has a nontrivial weakening operator.

Definition at line 181 of file Determinate.inlines.hh.

00181                                             {
00182   // FIXME: the following should be turned into a query to PSET.  This
00183   // can be postponed until the time the ask-and-tell construction is
00184   // revived.
00185   return false;
00186 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::is_bottom (  )  const [inline]

Returns true if and only if *this embeds the empty element of PSET.

Definition at line 223 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::concatenate_assign().

00223                                    {
00224   return prep->pset.is_empty();
00225 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::is_definitely_equivalent_to ( const Determinate< PSET > &  y  )  const [inline]

Returns true if and only if *this and y are definitely equivalent.

Definition at line 211 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

00211                                                                          {
00212   return prep == y.prep || prep->pset == y.prep->pset;
00213 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::is_top (  )  const [inline]

Returns true if and only if *this embeds the universe element PSET.

Definition at line 217 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

00217                                 {
00218   return prep->pset.is_universe();
00219 }

template<typename PSET >
template<typename Binary_Operator_Assign >
Determinate< PSET >::Binary_Operator_Assign_Lifter< Binary_Operator_Assign > Parma_Polyhedra_Library::Determinate< PSET >::lift_op_assign ( Binary_Operator_Assign  op_assign  )  [inline, static]

Helper function returning a Binary_Operator_Assign_Lifter object, also allowing for the deduction of template arguments.

Definition at line 291 of file Determinate.inlines.hh.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::intersection_assign(), and Parma_Polyhedra_Library::Pointset_Powerset< PSET >::time_elapse_assign().

00291                                                                   {
00292   return Binary_Operator_Assign_Lifter<Binary_Operator_Assign>(op_assign);
00293 }

template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::meet_assign ( const Determinate< PSET > &  y  )  [inline]

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

Definition at line 175 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::pointset().

00175                                                    {
00176   pointset().intersection_assign(y.pointset());
00177 }

template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::mutate (  )  [inline]

On return from this method, the representation of *this is not shared by different Determinate objects.

Definition at line 145 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::del_reference(), Parma_Polyhedra_Library::Determinate< PSET >::Rep::is_shared(), Parma_Polyhedra_Library::Determinate< PSET >::Rep::new_reference(), Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

Referenced by Parma_Polyhedra_Library::Determinate< PSET >::pointset().

00145                           {
00146   if (prep->is_shared()) {
00147     Rep* new_prep = new Rep(prep->pset);
00148     (void) prep->del_reference();
00149     new_prep->new_reference();
00150     prep = new_prep;
00151   }
00152 }

template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::OK (  )  const [inline]

Checks if all the invariants are satisfied.

Definition at line 241 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

00241                             {
00242   return prep->pset.OK();
00243 }

template<typename PSET >
Determinate< PSET > & Parma_Polyhedra_Library::Determinate< PSET >::operator= ( const Determinate< PSET > &  y  )  [inline]

Assignment operator.

Definition at line 129 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::Rep::del_reference(), Parma_Polyhedra_Library::Determinate< PSET >::Rep::new_reference(), and Parma_Polyhedra_Library::Determinate< PSET >::prep.

00129                                                  {
00130   y.prep->new_reference();
00131   if (prep->del_reference())
00132     delete prep;
00133   prep = y.prep;
00134   return *this;
00135 }

template<typename PSET >
PSET & Parma_Polyhedra_Library::Determinate< PSET >::pointset (  )  [inline]

Returns a reference to the embedded element.

Definition at line 162 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::mutate(), Parma_Polyhedra_Library::Determinate< PSET >::prep, and Parma_Polyhedra_Library::Determinate< PSET >::Rep::pset.

00162                             {
00163   mutate();
00164   return prep->pset;
00165 }

template<typename PSET >
const PSET & Parma_Polyhedra_Library::Determinate< PSET >::pointset (  )  const [inline]
template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::swap ( Determinate< PSET > &  y  )  [inline]

Swaps *this with y.

Definition at line 139 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::prep.

Referenced by Parma_Polyhedra_Library::Determinate< PSET >::swap().

00139                                       {
00140   std::swap(prep, y.prep);
00141 }

template<typename PSET >
memory_size_type Parma_Polyhedra_Library::Determinate< PSET >::total_memory_in_bytes (  )  const [inline]

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

Definition at line 235 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::external_memory_in_bytes().

00235                                                {
00236   return sizeof(*this) + external_memory_in_bytes();
00237 }

template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::upper_bound_assign ( const Determinate< PSET > &  y  )  [inline]

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

Definition at line 169 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::pointset().

00169                                                           {
00170   pointset().upper_bound_assign(y.pointset());
00171 }

template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::weakening_assign ( const Determinate< PSET > &  y  )  [inline]

Assigns to *this the result of weakening *this with y.

Definition at line 190 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::pointset().

00190                                                         {
00191   // FIXME: the following should be turned into a proper
00192   // implementation.  This can be postponed until the time the
00193   // ask-and-tell construction is revived.
00194   pointset().difference_assign(y.pointset());
00195 }


Friends And Related Function Documentation

template<typename PSET>
bool operator!= ( const Determinate< PSET > &  x,
const Determinate< PSET > &  y 
) [friend]

Returns true if and only if x and y are different COW-wrapped pointsets.

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

00267                                                                    {
00268   return x.prep != y.prep && x.prep->pset != y.prep->pset;
00269 }

template<typename PSET >
std::ostream & operator<< ( std::ostream &  s,
const Determinate< PSET > &  x 
) [related]

Output operator.

Definition at line 250 of file Determinate.inlines.hh.

00250                                                       {
00251   s << x.pointset();
00252   return s;
00253 }

template<typename PSET>
bool operator== ( const Determinate< PSET > &  x,
const Determinate< PSET > &  y 
) [friend]

Returns true if and only if x and y are the same COW-wrapped pointset.

Definition at line 260 of file Determinate.inlines.hh.

00260                                                                    {
00261   return x.prep == y.prep || x.prep->pset == y.prep->pset;
00262 }

template<typename PSET >
void swap ( Parma_Polyhedra_Library::Determinate< PSET > &  x,
Parma_Polyhedra_Library::Determinate< PSET > &  y 
) [related]

Specializes std::swap.

Definition at line 303 of file Determinate.inlines.hh.

References Parma_Polyhedra_Library::Determinate< PSET >::swap().

00304                                                   {
00305   x.swap(y);
00306 }


Member Data Documentation

template<typename PSET>
Rep* Parma_Polyhedra_Library::Determinate< PSET >::prep [private]

The documentation for this class was generated from the following files:
Generated on Sun Feb 27 16:20:28 2011 for PPL by  doxygen 1.6.3