|
PPL
0.12.1
|
Wrapper class to represent a set of flags with bits in a native unsigned integral type. More...
#include <Row_Flags.defs.hh>

Public Member Functions | |
| Row_Flags () | |
| Constructs an object with all the flags unset. | |
| bool | operator== (const Row_Flags &y) const |
Returns true if and only if *this and y are equal. | |
| bool | operator!= (const Row_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 | |
| Row_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. | |
Private Attributes | |
| base_type | bits |
The integer encoding *this. | |
Wrapper class to represent a set of flags with bits in a native unsigned integral type.
Definition at line 38 of file Row_Flags.defs.hh.
|
protected |
A native integral type holding the bits that encode the flags.
Definition at line 64 of file Row_Flags.defs.hh.
Constructs an object with all the flags unset.
Definition at line 32 of file Row_Flags.inlines.hh.
: bits(0) { }
|
inlineexplicitprotected |
Constructs an object with flags set as in n.
Definition at line 37 of file Row_Flags.inlines.hh.
: bits(n) { }
| 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.
| 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 32 of file Row_Flags.cc.
References bits.
{
s << "0x";
std::ios::fmtflags old_flags = s.setf(std::ios::hex,
std::ios::basefield);
const int new_sz = 2 * static_cast<int>(sizeof(Row_Flags::base_type));
s << std::setw(new_sz) << std::setfill('0') << bits;
s.flags(old_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 44 of file Row_Flags.cc.
{
std::string str;
if (!(s >> std::setw(2) >> str) || str != "0x")
return false;
const std::ios::fmtflags old_flags = s.setf(std::ios::hex,
std::ios::basefield);
s >> bits;
s.flags(old_flags);
return !s.fail();
}
|
inlineprotected |
Returns the integer encoding *this.
Definition at line 42 of file Row_Flags.inlines.hh.
References bits.
Referenced by operator==(), and Parma_Polyhedra_Library::Linear_Row::Flags::operator==().
{
return bits;
}
|
inline |
Returns true if and only if *this and y are different.
Definition at line 68 of file Row_Flags.inlines.hh.
References operator==().
{
return !operator==(y);
}
|
inline |
Returns true if and only if *this and y are equal.
Definition at line 62 of file Row_Flags.inlines.hh.
References first_free_bit, and get_bits().
Referenced by operator!=().
{
base_type mask = low_bits_mask<base_type>(first_free_bit);
return (get_bits() & mask) == (y.get_bits() & mask);
}
| void Parma_Polyhedra_Library::Row_Flags::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
|
inlineprotected |
Resets the bits in mask.
Definition at line 52 of file Row_Flags.inlines.hh.
References bits.
{
bits &= ~mask;
}
|
inlineprotected |
Sets the bits in mask.
Definition at line 47 of file Row_Flags.inlines.hh.
References bits.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::Flags().
{
bits |= mask;
}
|
inlineprotected |
Returns true if and only if all the bits in mask are set.
Definition at line 57 of file Row_Flags.inlines.hh.
References bits.
{
return (bits & mask) == mask;
}
The integer encoding *this.
Definition at line 89 of file Row_Flags.defs.hh.
Referenced by ascii_dump(), get_bits(), reset_bits(), set_bits(), and test_bits().
|
staticprotected |
Index of the first bit derived classes can use.
Reimplemented in Parma_Polyhedra_Library::Linear_Row::Flags.
Definition at line 67 of file Row_Flags.defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_Row::Flags::ascii_load(), and operator==().