#include <Linear_Row.defs.hh>
Public Member Functions | |
Flags () | |
Default constructor: builds an object where all flags are invalid. | |
Flags (Topology t) | |
Builds an object corresponding to the topology t . | |
Flags (Topology t, Kind k) | |
Builds an object corresponding to the topology t and kind k . | |
bool | operator== (const Flags &y) const |
Returns true if and only if *this and y are equal. | |
bool | operator!= (const Flags &y) const |
Returns true if and only if *this and y are different. | |
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. | |
Testing and setting the type | |
Topology | topology () const |
bool | is_necessarily_closed () const |
bool | is_not_necessarily_closed () const |
bool | is_line_or_equality () const |
bool | is_ray_or_point_or_inequality () const |
void | set_necessarily_closed () |
void | set_not_necessarily_closed () |
void | set_is_line_or_equality () |
void | set_is_ray_or_point_or_inequality () |
Static Protected Attributes | |
static const unsigned | first_free_bit = Row::Flags::first_free_bit + 4 |
Index of the first bit derived classes can use. | |
Private Member Functions | |
Flags (base_type mask) | |
Builds the type from a bit-mask. | |
Static Private Attributes | |
The bits that are currently in use | |
static const unsigned | rpi_validity_bit = Row::Flags::first_free_bit + 0 |
static const unsigned | rpi_bit = Row::Flags::first_free_bit + 1 |
static const unsigned | nnc_validity_bit = Row::Flags::first_free_bit + 2 |
static const unsigned | nnc_bit = Row::Flags::first_free_bit + 3 |
Friends | |
class | Parma_Polyhedra_Library::Linear_Row |
This combines the information about the topology (necessarily closed or not) and the kind (line/equality or ray/point/inequality) of a Linear_Row object.
Definition at line 143 of file Linear_Row.defs.hh.
Parma_Polyhedra_Library::Linear_Row::Flags::Flags | ( | ) | [inline] |
Default constructor: builds an object where all flags are invalid.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 33 of file Linear_Row.inlines.hh.
Parma_Polyhedra_Library::Linear_Row::Flags::Flags | ( | Topology | t | ) | [inline, explicit] |
Builds an object corresponding to the topology t
.
Definition at line 39 of file Linear_Row.inlines.hh.
References nnc_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().
00040 : Row::Flags(t << nnc_bit) { 00041 #ifndef NDEBUG 00042 set_bits(1 << nnc_validity_bit); 00043 #endif 00044 }
Builds an object corresponding to the topology t
and kind k
.
Definition at line 47 of file Linear_Row.inlines.hh.
References nnc_validity_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().
00048 : Row::Flags((k << rpi_bit) | (t << nnc_bit)) { 00049 #ifndef NDEBUG 00050 set_bits((1 << rpi_validity_bit) 00051 | (1 << nnc_validity_bit)); 00052 #endif 00053 }
Parma_Polyhedra_Library::Linear_Row::Flags::Flags | ( | base_type | mask | ) | [explicit, private] |
Builds the type from a bit-mask.
Topology Parma_Polyhedra_Library::Linear_Row::Flags::topology | ( | ) | const [inline] |
Definition at line 112 of file Linear_Row.inlines.hh.
References is_necessarily_closed(), Parma_Polyhedra_Library::NECESSARILY_CLOSED, and Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
Referenced by Parma_Polyhedra_Library::Linear_Row::topology().
00112 { 00113 return is_necessarily_closed() ? NECESSARILY_CLOSED : NOT_NECESSARILY_CLOSED; 00114 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_necessarily_closed | ( | ) | const [inline] |
Definition at line 90 of file Linear_Row.inlines.hh.
References is_not_necessarily_closed(), nnc_validity_bit, and Parma_Polyhedra_Library::Row::Flags::test_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::is_necessarily_closed(), and topology().
00090 { 00091 assert(test_bits(1 << nnc_validity_bit)); 00092 return !is_not_necessarily_closed(); 00093 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_not_necessarily_closed | ( | ) | const [inline] |
Definition at line 84 of file Linear_Row.inlines.hh.
References nnc_bit, nnc_validity_bit, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, and Parma_Polyhedra_Library::Row::Flags::test_bits().
Referenced by is_necessarily_closed().
00084 { 00085 assert(test_bits(1 << nnc_validity_bit)); 00086 return test_bits(NOT_NECESSARILY_CLOSED << nnc_bit); 00087 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_line_or_equality | ( | ) | const [inline] |
Definition at line 70 of file Linear_Row.inlines.hh.
References is_ray_or_point_or_inequality(), rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::test_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::is_line_or_equality().
00070 { 00071 assert(test_bits(1 << rpi_validity_bit)); 00072 return !is_ray_or_point_or_inequality(); 00073 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_ray_or_point_or_inequality | ( | ) | const [inline] |
Definition at line 56 of file Linear_Row.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::RAY_OR_POINT_OR_INEQUALITY, rpi_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::test_bits().
Referenced by is_line_or_equality(), and Parma_Polyhedra_Library::Linear_Row::is_ray_or_point_or_inequality().
00056 { 00057 assert(test_bits(1 << rpi_validity_bit)); 00058 return test_bits(RAY_OR_POINT_OR_INEQUALITY << rpi_bit); 00059 }
void Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed | ( | ) | [inline] |
Definition at line 104 of file Linear_Row.inlines.hh.
References nnc_bit, nnc_validity_bit, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, Parma_Polyhedra_Library::Row::Flags::reset_bits(), and Parma_Polyhedra_Library::Row::Flags::set_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::set_necessarily_closed().
00104 { 00105 #ifndef NDEBUG 00106 set_bits(1 << nnc_validity_bit); 00107 #endif 00108 reset_bits(NOT_NECESSARILY_CLOSED << nnc_bit); 00109 }
void Parma_Polyhedra_Library::Linear_Row::Flags::set_not_necessarily_closed | ( | ) | [inline] |
Definition at line 96 of file Linear_Row.inlines.hh.
References nnc_bit, nnc_validity_bit, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, and Parma_Polyhedra_Library::Row::Flags::set_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::set_not_necessarily_closed().
00096 { 00097 #ifndef NDEBUG 00098 set_bits(1 << nnc_validity_bit); 00099 #endif 00100 set_bits(NOT_NECESSARILY_CLOSED << nnc_bit); 00101 }
void Parma_Polyhedra_Library::Linear_Row::Flags::set_is_line_or_equality | ( | ) | [inline] |
Definition at line 76 of file Linear_Row.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::RAY_OR_POINT_OR_INEQUALITY, Parma_Polyhedra_Library::Row::Flags::reset_bits(), rpi_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::set_is_line_or_equality().
00076 { 00077 #ifndef NDEBUG 00078 set_bits(1 << rpi_validity_bit); 00079 #endif 00080 reset_bits(RAY_OR_POINT_OR_INEQUALITY << rpi_bit); 00081 }
void Parma_Polyhedra_Library::Linear_Row::Flags::set_is_ray_or_point_or_inequality | ( | ) | [inline] |
Definition at line 62 of file Linear_Row.inlines.hh.
References Parma_Polyhedra_Library::Linear_Row::RAY_OR_POINT_OR_INEQUALITY, rpi_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::set_is_ray_or_point_or_inequality().
00062 { 00063 #ifndef NDEBUG 00064 set_bits(1 << rpi_validity_bit); 00065 #endif 00066 set_bits(RAY_OR_POINT_OR_INEQUALITY << rpi_bit); 00067 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::operator== | ( | const Flags & | y | ) | const [inline] |
Returns true
if and only if *this
and y
are equal.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 117 of file Linear_Row.inlines.hh.
References first_free_bit, and Parma_Polyhedra_Library::Row::Flags::get_bits().
Referenced by operator!=().
00117 { 00118 base_type mask = low_bits_mask<base_type>(first_free_bit); 00119 return (get_bits() & mask) == (y.get_bits() & mask); 00120 }
bool Parma_Polyhedra_Library::Linear_Row::Flags::operator!= | ( | const Flags & | y | ) | const [inline] |
Returns true
if and only if *this
and y
are different.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 123 of file Linear_Row.inlines.hh.
References operator==().
00123 { 00124 return !operator==(y); 00125 }
void Parma_Polyhedra_Library::Linear_Row::Flags::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Referenced by Parma_Polyhedra_Library::Linear_Row::ascii_dump().
void Parma_Polyhedra_Library::Linear_Row::Flags::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 145 of file Linear_Row.cc.
References is_nnc, is_rpi, nnc_bit, nnc_valid, nnc_validity_bit, rpi_bit, rpi_valid, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::test_bits().
00145 { 00146 s << (test_bits(1 << Flags::rpi_validity_bit) ? '+' : '-') 00147 << rpi_valid << ' ' 00148 << (test_bits(1 << Flags::rpi_bit) ? '+' : '-') 00149 << is_rpi << ' ' 00150 << ' ' 00151 << (test_bits(1 << Flags::nnc_validity_bit) ? '+' : '-') 00152 << nnc_valid << ' ' 00153 << (test_bits(1 << Flags::nnc_bit) ? '+' : '-') 00154 << is_nnc; 00155 }
void Parma_Polyhedra_Library::Linear_Row::Flags::print | ( | ) | const |
bool Parma_Polyhedra_Library::Linear_Row::Flags::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.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 160 of file Linear_Row.cc.
References bit_names, Parma_Polyhedra_Library::Row::Flags::first_free_bit, Parma_Polyhedra_Library::Row::Flags::reset_bits(), and Parma_Polyhedra_Library::Row::Flags::set_bits().
Referenced by Parma_Polyhedra_Library::Linear_Row::ascii_load().
00160 { 00161 std::string str; 00162 // Assume that the bits are used in sequence. 00163 reset_bits(std::numeric_limits<base_type>::max()); 00164 for (unsigned int bit = 0; 00165 bit < (sizeof(bit_names) / sizeof(char*)); 00166 ++bit) { 00167 if (!(s >> str)) 00168 return false; 00169 if (str[0] == '+') 00170 set_bits(1 << (Row::Flags::first_free_bit + bit)); 00171 else if (str[0] != '-') 00172 return false; 00173 if (str.compare(1, strlen(bit_names[bit]), bit_names[bit]) != 0) 00174 return false; 00175 } 00176 return true; 00177 }
friend class Parma_Polyhedra_Library::Linear_Row [friend] |
Definition at line 208 of file Linear_Row.defs.hh.
const unsigned Parma_Polyhedra_Library::Linear_Row::Flags::rpi_validity_bit = Row::Flags::first_free_bit + 0 [static, private] |
Definition at line 194 of file Linear_Row.defs.hh.
Referenced by ascii_dump(), Flags(), is_line_or_equality(), is_ray_or_point_or_inequality(), set_is_line_or_equality(), and set_is_ray_or_point_or_inequality().
const unsigned Parma_Polyhedra_Library::Linear_Row::Flags::rpi_bit = Row::Flags::first_free_bit + 1 [static, private] |
Definition at line 196 of file Linear_Row.defs.hh.
Referenced by ascii_dump(), is_ray_or_point_or_inequality(), set_is_line_or_equality(), and set_is_ray_or_point_or_inequality().
const unsigned Parma_Polyhedra_Library::Linear_Row::Flags::nnc_validity_bit = Row::Flags::first_free_bit + 2 [static, private] |
Definition at line 198 of file Linear_Row.defs.hh.
Referenced by ascii_dump(), Flags(), is_necessarily_closed(), is_not_necessarily_closed(), set_necessarily_closed(), and set_not_necessarily_closed().
const unsigned Parma_Polyhedra_Library::Linear_Row::Flags::nnc_bit = Row::Flags::first_free_bit + 3 [static, private] |
Definition at line 200 of file Linear_Row.defs.hh.
Referenced by ascii_dump(), is_not_necessarily_closed(), set_necessarily_closed(), and set_not_necessarily_closed().
const unsigned Parma_Polyhedra_Library::Linear_Row::Flags::first_free_bit = Row::Flags::first_free_bit + 4 [static, protected] |
Index of the first bit derived classes can use.
Reimplemented from Parma_Polyhedra_Library::Row::Flags.
Definition at line 206 of file Linear_Row.defs.hh.
Referenced by operator==().