Parma_Polyhedra_Library::Linear_Row::Flags Class Reference
[C++ Language Interface]

The type of the object to which the coefficients refer to, encoding both topology and kind. More...

#include <Linear_Row.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Linear_Row::Flags:
Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::Linear_Row::Flags:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

The type of the object to which the coefficients refer to, encoding both topology and kind.

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 144 of file Linear_Row.defs.hh.


Constructor & Destructor Documentation

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 34 of file Linear_Row.inlines.hh.

00035   : Row::Flags() {
00036   // Note that the constructed type has its validity bit unset.
00037 }

Parma_Polyhedra_Library::Linear_Row::Flags::Flags ( Topology  t  )  [inline, explicit]

Builds an object corresponding to the topology t.

Definition at line 40 of file Linear_Row.inlines.hh.

References nnc_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().

00041   : Row::Flags(t << nnc_bit) {
00042 #ifndef NDEBUG
00043   set_bits(1 << nnc_validity_bit);
00044 #endif
00045 }

Parma_Polyhedra_Library::Linear_Row::Flags::Flags ( Topology  t,
Kind  k 
) [inline]

Builds an object corresponding to the topology t and kind k.

Definition at line 48 of file Linear_Row.inlines.hh.

References nnc_validity_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::set_bits().

00049   : Row::Flags((k << rpi_bit) | (t << nnc_bit)) {
00050 #ifndef NDEBUG
00051   set_bits((1 << rpi_validity_bit)
00052            | (1 << nnc_validity_bit));
00053 #endif
00054 }

Parma_Polyhedra_Library::Linear_Row::Flags::Flags ( base_type  mask  )  [explicit, private]

Builds the type from a bit-mask.

Reimplemented from Parma_Polyhedra_Library::Row::Flags.


Member Function Documentation

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 155 of file Linear_Row.cc.

References nnc_bit, nnc_validity_bit, rpi_bit, rpi_validity_bit, and Parma_Polyhedra_Library::Row::Flags::test_bits().

00155                                                   {
00156   s << (test_bits(1 << Flags::rpi_validity_bit) ? '+' : '-')
00157     << rpi_valid << ' '
00158     << (test_bits(1 << Flags::rpi_bit) ? '+' : '-')
00159     << is_rpi << ' '
00160     << ' '
00161     << (test_bits(1 << Flags::nnc_validity_bit) ? '+' : '-')
00162     << nnc_valid << ' '
00163     << (test_bits(1 << Flags::nnc_bit) ? '+' : '-')
00164     << is_nnc;
00165 }

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().

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 170 of file Linear_Row.cc.

References Parma_Polyhedra_Library::Row::Flags::first_free_bit, Parma_Polyhedra_Library::Interval_NS::reset_bits(), and Parma_Polyhedra_Library::Interval_NS::set_bits().

00170                                             {
00171   std::string str;
00172   // Assume that the bits are used in sequence.
00173   reset_bits(std::numeric_limits<base_type>::max());
00174   for (unsigned int bit = 0;
00175        bit < (sizeof(bit_names) / sizeof(char*));
00176        ++bit) {
00177     if (!(s >> str))
00178       return false;
00179     if (str[0] == '+')
00180       set_bits(1 << (Row::Flags::first_free_bit + bit));
00181     else if (str[0] != '-')
00182       return false;
00183     if (str.compare(1, strlen(bit_names[bit]), bit_names[bit]) != 0)
00184       return false;
00185   }
00186   return true;
00187 }

bool Parma_Polyhedra_Library::Linear_Row::Flags::is_line_or_equality (  )  const [inline]
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_necessarily_closed (  )  const [inline]
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_not_necessarily_closed (  )  const [inline]
bool Parma_Polyhedra_Library::Linear_Row::Flags::is_ray_or_point_or_inequality (  )  const [inline]
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 124 of file Linear_Row.inlines.hh.

References operator==().

00124                                                 {
00125   return !operator==(y);
00126 }

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 118 of file Linear_Row.inlines.hh.

References first_free_bit, and Parma_Polyhedra_Library::Row::Flags::get_bits().

Referenced by operator!=().

00118                                                 {
00119   base_type mask = low_bits_mask<base_type>(first_free_bit);
00120   return (get_bits() & mask) == (y.get_bits() & mask);
00121 }

void Parma_Polyhedra_Library::Linear_Row::Flags::print (  )  const

Prints *this to std::cerr using operator<<.

Reimplemented from Parma_Polyhedra_Library::Row::Flags.

void Parma_Polyhedra_Library::Linear_Row::Flags::set_is_line_or_equality (  )  [inline]
void Parma_Polyhedra_Library::Linear_Row::Flags::set_is_ray_or_point_or_inequality (  )  [inline]
void Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed (  )  [inline]
void Parma_Polyhedra_Library::Linear_Row::Flags::set_not_necessarily_closed (  )  [inline]
Topology Parma_Polyhedra_Library::Linear_Row::Flags::topology (  )  const [inline]

Friends And Related Function Documentation

friend class Parma_Polyhedra_Library::Linear_Row [friend]

Definition at line 209 of file Linear_Row.defs.hh.


Member Data Documentation

Index of the first bit derived classes can use.

Reimplemented from Parma_Polyhedra_Library::Row::Flags.

Definition at line 207 of file Linear_Row.defs.hh.

Referenced by operator==().


The documentation for this class was generated from the following files:
Generated on Sun Feb 27 16:20:23 2011 for PPL by  doxygen 1.6.3