#include <Row.defs.hh>
Public Member Functions | |
Flags () | |
Constructs an object with all the flags unset. | |
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) |
Uses the ASCII Flags representation from s to recreate *this. | |
Protected Types | |
typedef unsigned int | base_type |
A native integral type holding the bits that encode the flags. | |
Protected Member Functions | |
Flags (base_type n) | |
Constructs an object with flags set as in n . | |
base_type | get_bits () const |
Returns the integer encoding *this . | |
void | set_bits (base_type mask) |
Sets the bits in mask . | |
void | reset_bits (base_type mask) |
Resets the bits in mask . | |
bool | test_bits (base_type mask) const |
Returns true if and only if all the bits in mask are set. | |
Static Protected Attributes | |
static const unsigned | first_free_bit = 0 |
Index of the first bit derived classes can use. | |
static const unsigned | num_bits = std::numeric_limits<base_type>::digits |
Total number of bits that can be stored. | |
Private Attributes | |
base_type | bits |
The integer encoding *this . | |
Friends | |
class | Row |
Definition at line 97 of file Row.defs.hh.
typedef unsigned int Parma_Polyhedra_Library::Row::Flags::base_type [protected] |
A native integral type holding the bits that encode the flags.
Definition at line 123 of file Row.defs.hh.
Parma_Polyhedra_Library::Row::Flags::Flags | ( | ) | [inline] |
Constructs an object with all the flags unset.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 33 of file Row.inlines.hh.
00034 : bits(0) { 00035 }
Parma_Polyhedra_Library::Row::Flags::Flags | ( | base_type | n | ) | [inline, explicit, protected] |
Constructs an object with flags set as in n
.
Definition at line 38 of file Row.inlines.hh.
00039 : bits(n) { 00040 }
bool Parma_Polyhedra_Library::Row::Flags::operator== | ( | const Flags & | y | ) | const [inline] |
Returns true
if and only if *this
and y
are equal.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 63 of file Row.inlines.hh.
References first_free_bit, and get_bits().
Referenced by operator!=().
00063 { 00064 base_type mask = low_bits_mask<base_type>(first_free_bit); 00065 return (get_bits() & mask) == (y.get_bits() & mask); 00066 }
bool Parma_Polyhedra_Library::Row::Flags::operator!= | ( | const Flags & | y | ) | const [inline] |
Returns true
if and only if *this
and y
are different.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 69 of file Row.inlines.hh.
References operator==().
00069 { 00070 return !operator==(y); 00071 }
void Parma_Polyhedra_Library::Row::Flags::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Referenced by Parma_Polyhedra_Library::Row::ascii_dump().
void Parma_Polyhedra_Library::Row::Flags::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 135 of file Row.cc.
References bits.
00135 { 00136 s << "0x"; 00137 std::istream::fmtflags f = s.setf(std::istream::hex); 00138 std::streamsize sz = s.width(2*sizeof(Flags::base_type)); 00139 std::ostream::char_type ch = s.fill('0'); 00140 s << bits; 00141 s.fill(ch); 00142 s.width(sz); 00143 s.flags(f); 00144 }
void Parma_Polyhedra_Library::Row::Flags::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
bool Parma_Polyhedra_Library::Row::Flags::ascii_load | ( | std::istream & | s | ) |
Uses the ASCII Flags representation from s
to recreate *this.
Returns true
if successful, false
otherwise. The ASCII representation is as output by Parma_Polyhedra_Library::Row::Flags::ascii_dump.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 149 of file Row.cc.
References bits.
Referenced by Parma_Polyhedra_Library::Row::ascii_load().
00149 { 00150 std::string str; 00151 std::streamsize sz = s.width(2); 00152 if (!(s >> str) || (str.compare("0x") != 0)) 00153 return false; 00154 s.width(sz); 00155 std::istream::fmtflags f = s.setf(std::istream::hex); 00156 bool r = s >> bits; 00157 s.flags(f); 00158 return r; 00159 }
Row::Flags::base_type Parma_Polyhedra_Library::Row::Flags::get_bits | ( | ) | const [inline, protected] |
Returns the integer encoding *this
.
Definition at line 43 of file Row.inlines.hh.
References bits.
Referenced by operator==(), and Parma_Polyhedra_Library::Linear_Row::Flags::operator==().
00043 { 00044 return bits; 00045 }
void Parma_Polyhedra_Library::Row::Flags::set_bits | ( | base_type | mask | ) | [inline, protected] |
Sets the bits in mask
.
Definition at line 48 of file Row.inlines.hh.
References bits.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::ascii_load(), Parma_Polyhedra_Library::Linear_Row::Flags::Flags(), Parma_Polyhedra_Library::Linear_Row::Flags::set_is_line_or_equality(), Parma_Polyhedra_Library::Linear_Row::Flags::set_is_ray_or_point_or_inequality(), Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed(), and Parma_Polyhedra_Library::Linear_Row::Flags::set_not_necessarily_closed().
00048 { 00049 bits |= mask; 00050 }
void Parma_Polyhedra_Library::Row::Flags::reset_bits | ( | base_type | mask | ) | [inline, protected] |
Resets the bits in mask
.
Definition at line 53 of file Row.inlines.hh.
References bits.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::ascii_load(), Parma_Polyhedra_Library::Linear_Row::Flags::set_is_line_or_equality(), and Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed().
00053 { 00054 bits &= ~mask; 00055 }
bool Parma_Polyhedra_Library::Row::Flags::test_bits | ( | base_type | mask | ) | const [inline, protected] |
Returns true
if and only if all the bits in mask
are set.
Definition at line 58 of file Row.inlines.hh.
References bits.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::ascii_dump(), Parma_Polyhedra_Library::Linear_Row::Flags::is_line_or_equality(), Parma_Polyhedra_Library::Linear_Row::Flags::is_necessarily_closed(), Parma_Polyhedra_Library::Linear_Row::Flags::is_not_necessarily_closed(), and Parma_Polyhedra_Library::Linear_Row::Flags::is_ray_or_point_or_inequality().
00058 { 00059 return (bits & mask) == mask; 00060 }
friend class Row [friend] |
Definition at line 153 of file Row.defs.hh.
const unsigned Parma_Polyhedra_Library::Row::Flags::first_free_bit = 0 [static, protected] |
Index of the first bit derived classes can use.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 126 of file Row.defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::ascii_load(), and operator==().
const unsigned Parma_Polyhedra_Library::Row::Flags::num_bits = std::numeric_limits<base_type>::digits [static, protected] |
The integer encoding *this
.
Definition at line 151 of file Row.defs.hh.
Referenced by ascii_dump(), ascii_load(), get_bits(), reset_bits(), set_bits(), and test_bits().