|
PPL
0.12.1
|
A conjunctive assertion about a Octagonal_Shape<T> object. More...
Public Member Functions | |
| Status () | |
| By default Status is the zero-dim universe assertion. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of the internal representation of *this. | |
| bool | ascii_load (std::istream &s) |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. | |
Test, remove or add an individual assertion from the conjunction. | |
| bool | test_zero_dim_univ () const |
| void | reset_zero_dim_univ () |
| void | set_zero_dim_univ () |
| bool | test_empty () const |
| void | reset_empty () |
| void | set_empty () |
| bool | test_strongly_closed () const |
| void | reset_strongly_closed () |
| void | set_strongly_closed () |
Private Types | |
| typedef unsigned int | flags_t |
| Status is implemented by means of a finite bitset. | |
Private Member Functions | |
| Status (flags_t mask) | |
| Construct from a bitmask. | |
| bool | test_all (flags_t mask) const |
Check whether all bits in mask are set. | |
| bool | test_any (flags_t mask) const |
Check whether at least one bit in mask is set. | |
| void | set (flags_t mask) |
Set the bits in mask. | |
| void | reset (flags_t mask) |
Reset the bits in mask. | |
Private Attributes | |
| flags_t | flags |
| This holds the current bitset. | |
Static Private Attributes | |
Bitmasks for the individual assertions. | |
| static const flags_t | ZERO_DIM_UNIV = 0U |
| static const flags_t | EMPTY = 1U << 0 |
| static const flags_t | STRONGLY_CLOSED = 1U << 1 |
Related Functions | |
(Note that these are not member functions.) | |
| bool | get_field (std::istream &s, const std::string &keyword, bool &positive) |
A conjunctive assertion about a Octagonal_Shape<T> object.
The assertions supported are:
;Not all the conjunctions of these elementary assertions constitute a legal Status. In fact:
Definition at line 46 of file Octagonal_Shape.defs.hh.
|
private |
Status is implemented by means of a finite bitset.
Definition at line 84 of file Octagonal_Shape.defs.hh.
|
inline |
By default Status is the zero-dim universe assertion.
Definition at line 37 of file Og_Status.inlines.hh.
: flags(ZERO_DIM_UNIV) { }
|
inlineprivate |
|
inline |
Writes to s an ASCII representation of the internal representation of *this.
Definition at line 184 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::empty, Parma_Polyhedra_Library::Implementation::BD_Shapes::no, Parma_Polyhedra_Library::Implementation::BD_Shapes::separator, Parma_Polyhedra_Library::Implementation::Octagonal_Shapes::strong_closed, Parma_Polyhedra_Library::Implementation::BD_Shapes::yes, and Parma_Polyhedra_Library::Implementation::BD_Shapes::zero_dim_univ.
{
using namespace Implementation::Octagonal_Shapes;
s << (test_zero_dim_univ() ? yes : no) << zero_dim_univ
<< separator
<< (test_empty() ? yes : no) << empty
<< separator
<< separator
<< (test_strongly_closed() ? yes : no) << strong_closed
<< separator;
}
|
inline |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.
Definition at line 197 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::empty, Parma_Polyhedra_Library::Octagonal_Shape< T >::OK(), PPL_ASSERT, PPL_UNINITIALIZED, Parma_Polyhedra_Library::Octagonal_Shape< T >::reset_strongly_closed(), Parma_Polyhedra_Library::Octagonal_Shape< T >::set_empty(), Parma_Polyhedra_Library::Octagonal_Shape< T >::set_strongly_closed(), Parma_Polyhedra_Library::Octagonal_Shape< T >::set_zero_dim_univ(), Parma_Polyhedra_Library::Implementation::Octagonal_Shapes::strong_closed, and Parma_Polyhedra_Library::Implementation::BD_Shapes::zero_dim_univ.
{
using namespace Implementation::Octagonal_Shapes;
PPL_UNINITIALIZED(bool, positive);
if (!get_field(s, zero_dim_univ, positive))
return false;
if (positive)
set_zero_dim_univ();
if (!get_field(s, empty, positive))
return false;
if (positive)
set_empty();
if (!get_field(s, strong_closed, positive))
return false;
if (positive)
set_strongly_closed();
else
reset_strongly_closed();
// Check invariants.
PPL_ASSERT(OK());
return true;
}
|
inline |
Checks if all the invariants are satisfied.
Definition at line 125 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::Octagonal_Shape< T >::Status::reset_empty(), and Parma_Polyhedra_Library::Octagonal_Shape< T >::Status::test_zero_dim_univ().
{
if (test_zero_dim_univ())
// Zero-dim universe is OK.
return true;
if (test_empty()) {
Status copy = *this;
copy.reset_empty();
if (copy.test_zero_dim_univ())
return true;
else {
#ifndef NDEBUG
std::cerr << "The empty flag is incompatible with any other one."
<< std::endl;
#endif
return false;
}
}
// Any other case is OK.
return true;
}
|
inlineprivate |
|
inline |
Definition at line 95 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::Status::OK().
|
inline |
Definition at line 113 of file Og_Status.inlines.hh.
{
reset(STRONGLY_CLOSED);
}
|
inline |
Definition at line 73 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
{
// This is a no-op if the current status is not zero-dim.
if (flags == ZERO_DIM_UNIV)
// In the zero-dim space, if it is not the universe it is empty.
flags = EMPTY;
}
|
inlineprivate |
|
inline |
Definition at line 101 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
|
inline |
Definition at line 119 of file Og_Status.inlines.hh.
{
set(STRONGLY_CLOSED);
}
|
inline |
Definition at line 82 of file Og_Status.inlines.hh.
{
// Zero-dim universe is incompatible with anything else.
flags = ZERO_DIM_UNIV;
}
|
inlineprivate |
Check whether all bits in mask are set.
Definition at line 43 of file Og_Status.inlines.hh.
{
return (flags & mask) == mask;
}
|
inlineprivate |
Check whether at least one bit in mask is set.
Definition at line 49 of file Og_Status.inlines.hh.
{
return (flags & mask) != 0;
}
|
inline |
Definition at line 89 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
|
inline |
Definition at line 107 of file Og_Status.inlines.hh.
{
return test_any(STRONGLY_CLOSED);
}
|
inline |
Definition at line 67 of file Og_Status.inlines.hh.
Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::Status::OK().
{
return flags == ZERO_DIM_UNIV;
}
|
related |
Reads a keyword and its associated on/off flag from s. Returns true if the operation is successful, returns false otherwise. When successful, positive is set to true if the flag is on; it is set to false otherwise.
Definition at line 168 of file Og_Status.inlines.hh.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::no, and Parma_Polyhedra_Library::Implementation::BD_Shapes::yes.
|
staticprivate |
Definition at line 89 of file Octagonal_Shape.defs.hh.
|
private |
This holds the current bitset.
Definition at line 94 of file Octagonal_Shape.defs.hh.
|
staticprivate |
Definition at line 90 of file Octagonal_Shape.defs.hh.
|
staticprivate |
Definition at line 88 of file Octagonal_Shape.defs.hh.