|
PPL
0.12.1
|
A conjunctive assertion about a BD_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 () const |
Writes to std::cerr an ASCII representation of *this. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of *this. | |
| void | print () const |
Prints *this to std::cerr using operator<<. | |
| 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_shortest_path_closed () const |
| void | reset_shortest_path_closed () |
| void | set_shortest_path_closed () |
| bool | test_shortest_path_reduced () const |
| void | reset_shortest_path_reduced () |
| void | set_shortest_path_reduced () |
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 bit-mask. | |
| 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 | |
Bit-masks for the individual assertions. | |
| static const flags_t | ZERO_DIM_UNIV = 0U |
| static const flags_t | EMPTY = 1U << 0 |
| static const flags_t | SHORTEST_PATH_CLOSED = 1U << 1 |
| static const flags_t | SHORTEST_PATH_REDUCED = 1U << 2 |
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 BD_Shape<T> object.
The assertions supported are:
;Not all the conjunctions of these elementary assertions constitute a legal Status. In fact:
Definition at line 51 of file BD_Shape.defs.hh.
|
private |
Status is implemented by means of a finite bitset.
Definition at line 89 of file BD_Shape.defs.hh.
|
inline |
By default Status is the zero-dim universe assertion.
Definition at line 37 of file BDS_Status.inlines.hh.
: flags(ZERO_DIM_UNIV) { }
|
inlineprivate |
| void Parma_Polyhedra_Library::BD_Shape< T >::Status::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
| void Parma_Polyhedra_Library::BD_Shape< T >::Status::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s an ASCII representation of *this.
Definition at line 220 of file BDS_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::BD_Shapes::sp_closed, Parma_Polyhedra_Library::Implementation::BD_Shapes::sp_reduced, Parma_Polyhedra_Library::Implementation::BD_Shapes::yes, and Parma_Polyhedra_Library::Implementation::BD_Shapes::zero_dim_univ.
{
using namespace Implementation::BD_Shapes;
s << (test_zero_dim_univ() ? yes : no) << zero_dim_univ << separator
<< (test_empty() ? yes : no) << empty << separator
<< separator
<< (test_shortest_path_closed() ? yes : no) << sp_closed << separator
<< (test_shortest_path_reduced() ? yes : no) << sp_reduced << separator;
}
| bool Parma_Polyhedra_Library::BD_Shape< T >::Status::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.
Definition at line 233 of file BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::empty, Parma_Polyhedra_Library::BD_Shape< T >::OK(), PPL_ASSERT, PPL_UNINITIALIZED, Parma_Polyhedra_Library::BD_Shape< T >::reset_shortest_path_closed(), Parma_Polyhedra_Library::BD_Shape< T >::reset_shortest_path_reduced(), Parma_Polyhedra_Library::BD_Shape< T >::set_empty(), Parma_Polyhedra_Library::BD_Shape< T >::set_shortest_path_closed(), Parma_Polyhedra_Library::BD_Shape< T >::set_shortest_path_reduced(), Parma_Polyhedra_Library::BD_Shape< T >::set_zero_dim_univ(), Parma_Polyhedra_Library::Implementation::BD_Shapes::sp_closed, Parma_Polyhedra_Library::Implementation::BD_Shapes::sp_reduced, and Parma_Polyhedra_Library::Implementation::BD_Shapes::zero_dim_univ.
{
using namespace Implementation::BD_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, sp_closed, positive))
return false;
if (positive)
set_shortest_path_closed();
else
reset_shortest_path_closed();
if (!get_field(s, sp_reduced, positive))
return false;
if (positive)
set_shortest_path_reduced();
else
reset_shortest_path_reduced();
// Check invariants.
PPL_ASSERT(OK());
return true;
}
| bool Parma_Polyhedra_Library::BD_Shape< T >::Status::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 145 of file BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::BD_Shape< T >::Status::reset_empty(), and Parma_Polyhedra_Library::BD_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;
}
}
// Shortest-path reduction implies shortest-path closure.
if (test_shortest_path_reduced()) {
if (test_shortest_path_closed())
return true;
else {
#ifndef NDEBUG
std::cerr << "The shortest-path reduction flag should also imply "
<< "the closure flag."
<< std::endl;
#endif
return false;
}
}
// Any other case is OK.
return true;
}
| void Parma_Polyhedra_Library::BD_Shape< T >::Status::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
|
inlineprivate |
|
inline |
Definition at line 95 of file BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
Referenced by Parma_Polyhedra_Library::BD_Shape< T >::Status::OK().
|
inline |
Definition at line 113 of file BDS_Status.inlines.hh.
{
// A system is reduced only if it is also closed.
reset(SHORTEST_PATH_CLOSED | SHORTEST_PATH_REDUCED);
}
|
inline |
Definition at line 132 of file BDS_Status.inlines.hh.
{
reset(SHORTEST_PATH_REDUCED);
}
|
inline |
Definition at line 73 of file BDS_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 BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
|
inline |
Definition at line 120 of file BDS_Status.inlines.hh.
{
set(SHORTEST_PATH_CLOSED);
}
|
inline |
Definition at line 138 of file BDS_Status.inlines.hh.
References PPL_ASSERT.
{
PPL_ASSERT(test_shortest_path_closed());
set(SHORTEST_PATH_REDUCED);
}
|
inline |
Definition at line 82 of file BDS_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 BDS_Status.inlines.hh.
{
return (flags & mask) == mask;
}
|
inlineprivate |
Check whether at least one bit in mask is set.
Definition at line 49 of file BDS_Status.inlines.hh.
{
return (flags & mask) != 0;
}
|
inline |
Definition at line 89 of file BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::EMPTY.
|
inline |
Definition at line 107 of file BDS_Status.inlines.hh.
{
return test_any(SHORTEST_PATH_CLOSED);
}
|
inline |
Definition at line 126 of file BDS_Status.inlines.hh.
{
return test_any(SHORTEST_PATH_REDUCED);
}
|
inline |
Definition at line 67 of file BDS_Status.inlines.hh.
Referenced by Parma_Polyhedra_Library::BD_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 204 of file BDS_Status.inlines.hh.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::no, and Parma_Polyhedra_Library::Implementation::BD_Shapes::yes.
Referenced by Parma_Polyhedra_Library::Grid::Status::ascii_load(), and Parma_Polyhedra_Library::Polyhedron::Status::ascii_load().
|
staticprivate |
Definition at line 94 of file BD_Shape.defs.hh.
|
private |
This holds the current bitset.
Definition at line 100 of file BD_Shape.defs.hh.
|
staticprivate |
Definition at line 95 of file BD_Shape.defs.hh.
|
staticprivate |
Definition at line 96 of file BD_Shape.defs.hh.
|
staticprivate |
Definition at line 93 of file BD_Shape.defs.hh.