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)
 Uses the ASCII Flags representation from s to recreate *this.
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 143 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 33 of file Linear_Row.inlines.hh.

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

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 }

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


Member Function Documentation

Topology Parma_Polyhedra_Library::Linear_Row::Flags::topology (  )  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_line_or_equality (  )  const [inline]

bool Parma_Polyhedra_Library::Linear_Row::Flags::is_ray_or_point_or_inequality (  )  const [inline]

void Parma_Polyhedra_Library::Linear_Row::Flags::set_necessarily_closed (  )  [inline]

void Parma_Polyhedra_Library::Linear_Row::Flags::set_not_necessarily_closed (  )  [inline]

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]

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

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

Reimplemented from Parma_Polyhedra_Library::Row::Flags.

bool Parma_Polyhedra_Library::Linear_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 ascii_dump.

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 }


Friends And Related Function Documentation

friend class Parma_Polyhedra_Library::Linear_Row [friend]

Definition at line 208 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 206 of file Linear_Row.defs.hh.

Referenced by operator==().


The documentation for this class was generated from the following files:

Generated on Wed Jul 16 22:55:45 2008 for PPL by  doxygen 1.5.6