PPL  1.2
Parma_Polyhedra_Library::Determinate< PSET > Class Template Reference

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 >:

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 &pset)
 Constructs a COW-wrapped object corresponding to the pointset pset. More...
 
 Determinate (const Constraint_System &cs)
 Constructs a COW-wrapped object corresponding to the pointset defined by cs. More...
 
 Determinate (const Congruence_System &cgs)
 Constructs a COW-wrapped object corresponding to the pointset defined by cgs. More...
 
 Determinate (const Determinate &y)
 Copy constructor. More...
 
 ~Determinate ()
 Destructor. More...
 
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. More...
 
void meet_assign (const Determinate &y)
 Assigns to *this the meet of *this and y. More...
 
void weakening_assign (const Determinate &y)
 Assigns to *this the result of weakening *this with y. More...
 
void concatenate_assign (const Determinate &y)
 Assigns to *this the concatenation of *this and y, taken in this order. More...
 
PSET & pointset ()
 Returns a reference to the embedded element. More...
 
void mutate ()
 On return from this method, the representation of *this is not shared by different Determinate objects. More...
 
Determinateoperator= (const Determinate &y)
 Assignment operator. More...
 
void m_swap (Determinate &y)
 Swaps *this with y. More...
 

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. More...
 

Private Attributes

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

Friends

bool operator== (const Determinate< PSET > &x, const Determinate< PSET > &y)
 
bool operator!= (const Determinate< PSET > &x, const Determinate< PSET > &y)
 

Related Functions

(Note that these are not member functions.)

template<typename PSET >
void swap (Determinate< PSET > &x, Determinate< PSET > &y)
 Swaps x with y. More...
 
template<typename PSET >
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. More...
 
template<typename PSET >
bool operator!= (const Determinate< PSET > &x, const Determinate< PSET > &y)
 Returns true if and only if x and y are different COW-wrapped pointsets. More...
 
template<typename PSET >
std::ostream & operator<< (std::ostream &, const Determinate< PSET > &)
 Output operator. More...
 
template<typename PSET >
std::ostream & operator<< (std::ostream &s, const Determinate< PSET > &x)
 
template<typename PSET >
bool operator== (const Determinate< PSET > &x, const Determinate< PSET > &y)
 
template<typename PSET >
bool operator!= (const Determinate< PSET > &x, const Determinate< PSET > &y)
 
template<typename PSET >
void swap (Determinate< PSET > &x, Determinate< PSET > &y)
 

Member Functions that Do Not Modify the Domain Element

const PSET & pointset () const
 Returns a const reference to the embedded pointset. More...
 
bool is_top () const
 Returns true if and only if *this embeds the universe element PSET. More...
 
bool is_bottom () const
 Returns true if and only if *this embeds the empty element of PSET. More...
 
bool definitely_entails (const Determinate &y) const
 Returns true if and only if *this entails y. More...
 
bool is_definitely_equivalent_to (const Determinate &y) const
 Returns true if and only if *this and y are definitely equivalent. More...
 
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this. More...
 
bool OK () const
 Checks if all the invariants are satisfied. More...
 
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 84 of file Determinate_defs.hh.

Constructor & Destructor Documentation

template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const PSET &  pset)
inline

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

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.

95  : prep(new Rep(pset)) {
97 }
void new_reference() const
Registers a new reference.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
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.

102  : prep(new Rep(cs)) {
103  prep->new_reference();
104 }
void new_reference() const
Registers a new reference.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
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.

109  : prep(new Rep(cgs)) {
110  prep->new_reference();
111 }
void new_reference() const
Registers a new reference.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::Determinate ( const Determinate< PSET > &  y)
inline

Copy constructor.

Definition at line 115 of file Determinate_inlines.hh.

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

116  : prep(y.prep) {
117  prep->new_reference();
118 }
void new_reference() const
Registers a new reference.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
template<typename PSET >
Parma_Polyhedra_Library::Determinate< PSET >::~Determinate ( )
inline

Destructor.

Definition at line 122 of file Determinate_inlines.hh.

122  {
123  if (prep->del_reference()) {
124  delete prep;
125  }
126 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
bool del_reference() const
Unregisters one reference; returns true if and only if the representation has become unreferenced...

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 202 of file Determinate_inlines.hh.

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

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

202  {
203  pointset().concatenate_assign(y.pointset());
204 }
const PSET & pointset() const
Returns a const reference to the embedded pointset.
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 208 of file Determinate_inlines.hh.

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

208  {
209  return prep == y.prep || y.prep->pset.contains(prep->pset);
210 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
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 232 of file Determinate_inlines.hh.

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

232  {
233  return prep->total_memory_in_bytes();
234 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
memory_size_type total_memory_in_bytes() const
Returns a lower bound to the total size in bytes of the memory occupied by *this. ...
template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::has_nontrivial_weakening ( )
inlinestatic

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

Definition at line 184 of file Determinate_inlines.hh.

184  {
185  // FIXME: the following should be turned into a query to PSET. This
186  // can be postponed until the time the ask-and-tell construction is
187  // revived.
188  return false;
189 }
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 226 of file Determinate_inlines.hh.

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

226  {
227  return prep->pset.is_empty();
228 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
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 214 of file Determinate_inlines.hh.

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

214  {
215  return prep == y.prep || prep->pset == y.prep->pset;
216 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
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 220 of file Determinate_inlines.hh.

220  {
221  return prep->pset.is_universe();
222 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
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)
inlinestatic

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

Definition at line 294 of file Determinate_inlines.hh.

294  {
295  return Binary_Operator_Assign_Lifter<Binary_Operator_Assign>(op_assign);
296 }
template<typename PSET >
void Parma_Polyhedra_Library::Determinate< PSET >::m_swap ( Determinate< PSET > &  y)
inline

Swaps *this with y.

Definition at line 141 of file Determinate_inlines.hh.

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

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

141  {
142  using std::swap;
143  swap(prep, y.prep);
144 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Determinate< PSET > &x, Determinate< PSET > &y)
Swaps x with y.
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
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 178 of file Determinate_inlines.hh.

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

178  {
179  pointset().intersection_assign(y.pointset());
180 }
const PSET & pointset() const
Returns a const reference to the embedded pointset.
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 148 of file Determinate_inlines.hh.

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

148  {
149  if (prep->is_shared()) {
150  Rep* const new_prep = new Rep(prep->pset);
151  (void) prep->del_reference();
152  new_prep->new_reference();
153  prep = new_prep;
154  }
155 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
bool del_reference() const
Unregisters one reference; returns true if and only if the representation has become unreferenced...
bool is_shared() const
True if and only if this representation is currently shared.
template<typename PSET >
bool Parma_Polyhedra_Library::Determinate< PSET >::OK ( ) const
inline

Checks if all the invariants are satisfied.

Definition at line 244 of file Determinate_inlines.hh.

244  {
245  return prep->pset.OK();
246 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
template<typename PSET >
Determinate< PSET > & Parma_Polyhedra_Library::Determinate< PSET >::operator= ( const Determinate< PSET > &  y)
inline

Assignment operator.

Definition at line 130 of file Determinate_inlines.hh.

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

130  {
131  y.prep->new_reference();
132  if (prep->del_reference()) {
133  delete prep;
134  }
135  prep = y.prep;
136  return *this;
137 }
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
bool del_reference() const
Unregisters one reference; returns true if and only if the representation has become unreferenced...
template<typename PSET >
const PSET & Parma_Polyhedra_Library::Determinate< PSET >::pointset ( ) const
inline
template<typename PSET >
PSET & Parma_Polyhedra_Library::Determinate< PSET >::pointset ( )
inline

Returns a reference to the embedded element.

Definition at line 165 of file Determinate_inlines.hh.

165  {
166  mutate();
167  return prep->pset;
168 }
void mutate()
On return from this method, the representation of *this is not shared by different Determinate object...
Rep * prep
A pointer to the possibly shared representation of the base-level domain element. ...
PSET pset
The possibly shared, embedded pointset.
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 238 of file Determinate_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

238  {
239  return sizeof(*this) + external_memory_in_bytes();
240 }
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
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 172 of file Determinate_inlines.hh.

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

172  {
173  pointset().upper_bound_assign(y.pointset());
174 }
const PSET & pointset() const
Returns a const reference to the embedded pointset.
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 193 of file Determinate_inlines.hh.

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

193  {
194  // FIXME: the following should be turned into a proper
195  // implementation. This can be postponed until the time the
196  // ask-and-tell construction is revived.
197  pointset().difference_assign(y.pointset());
198 }
const PSET & pointset() const
Returns a const reference to the embedded pointset.

Friends And Related Function Documentation

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

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

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

Definition at line 270 of file Determinate_inlines.hh.

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

270  {
271  return x.prep != y.prep && x.prep->pset != y.prep->pset;
272 }
template<typename PSET>
bool operator!= ( const Determinate< PSET > &  x,
const Determinate< PSET > &  y 
)
friend
template<typename PSET >
std::ostream & operator<< ( std::ostream &  ,
const Determinate< PSET > &   
)
related

Output operator.

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

Definition at line 253 of file Determinate_inlines.hh.

253  {
254  s << x.pointset();
255  return s;
256 }
template<typename PSET >
bool operator== ( const Determinate< PSET > &  x,
const Determinate< PSET > &  y 
)
related

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

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

Definition at line 263 of file Determinate_inlines.hh.

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

263  {
264  return x.prep == y.prep || x.prep->pset == y.prep->pset;
265 }
template<typename PSET>
bool operator== ( const Determinate< PSET > &  x,
const Determinate< PSET > &  y 
)
friend
template<typename PSET >
void swap ( Determinate< PSET > &  x,
Determinate< PSET > &  y 
)
related

Swaps x with y.

template<typename PSET >
void swap ( Determinate< PSET > &  x,
Determinate< PSET > &  y 
)
related

Definition at line 301 of file Determinate_inlines.hh.

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

301  {
302  x.m_swap(y);
303 }

Member Data Documentation


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