Public Member Functions | Private Attributes | Friends

chomp::homology::diGraph< wType >::posWeight Class Reference

A class for representing a positive number with negative values serving as the infinity (used in the Dijkstra algorithm). More...

List of all members.

Public Member Functions

 posWeight ()
 The default constructor.
 posWeight (const wType &_value)
 An optional constructor.
void setInfinity ()
 Sets the value to the infinity.
bool isInfinity () const
 Returns true iff the value corresponds to the infinity.
const wType & getValue () const
 Returns the value stored in this object.

Private Attributes

wType value
 The actual number.

Friends

bool operator< (const posWeight &x, const posWeight &y)
 The < operator for comparing the numbers.
std::ostream & operator<< (std::ostream &out, const posWeight &x)
 The operator for showing the number to the output stream.

Detailed Description

template<class wType = int>
class chomp::homology::diGraph< wType >::posWeight

A class for representing a positive number with negative values serving as the infinity (used in the Dijkstra algorithm).

Definition at line 498 of file digraph.h.


Constructor & Destructor Documentation

template<class wType = int>
chomp::homology::diGraph< wType >::posWeight::posWeight (  )  [inline]

The default constructor.

Definition at line 502 of file digraph.h.

References chomp::homology::diGraph< wType >::posWeight::value.

                {
                        value = 0;
                        return;
                }

template<class wType = int>
chomp::homology::diGraph< wType >::posWeight::posWeight ( const wType &  _value  )  [inline, explicit]

An optional constructor.

Definition at line 509 of file digraph.h.

References chomp::homology::diGraph< wType >::posWeight::value.

                {
                        if (_value < 0)
                                value = 0;
                        else
                                value = _value;
                        return;
                }


Member Function Documentation

template<class wType = int>
const wType& chomp::homology::diGraph< wType >::posWeight::getValue (  )  const [inline]

Returns the value stored in this object.

Definition at line 532 of file digraph.h.

References chomp::homology::diGraph< wType >::posWeight::value.

                {
                        return value;
                }

template<class wType = int>
bool chomp::homology::diGraph< wType >::posWeight::isInfinity (  )  const [inline]

Returns true iff the value corresponds to the infinity.

Definition at line 526 of file digraph.h.

References chomp::homology::diGraph< wType >::posWeight::value.

                {
                        return (value < 0);
                }

template<class wType = int>
void chomp::homology::diGraph< wType >::posWeight::setInfinity (  )  [inline]

Sets the value to the infinity.

Definition at line 519 of file digraph.h.

References chomp::homology::diGraph< wType >::posWeight::value.

                {
                        value = -1;
                        return;
                }


Friends And Related Function Documentation

template<class wType = int>
bool operator< ( const posWeight x,
const posWeight y 
) [friend]

The < operator for comparing the numbers.

Definition at line 538 of file digraph.h.

                {
                        if (y. isInfinity ())
                                return !(x. isInfinity ());
                        else if (x. isInfinity ())
                                return false;
                        return (x. value < y. value);
                }

template<class wType = int>
std::ostream& operator<< ( std::ostream &  out,
const posWeight x 
) [friend]

The operator for showing the number to the output stream.

Definition at line 549 of file digraph.h.

                {
                        if (x. isInfinity ())
                                out << "+oo";
                        else
                                out << x. getValue ();
                        return out;
                }


Member Data Documentation

template<class wType = int>
wType chomp::homology::diGraph< wType >::posWeight::value [private]

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