degate  0.1.2
Public Member Functions | Private Attributes
degate::Point Class Reference

#include <Point.h>

List of all members.

Public Member Functions

 Point ()
 Point (int x, int y)
bool operator== (const Point &other) const
bool operator!= (const Point &other) const
int get_x () const
int get_y () const
void set_x (int x)
void set_y (int y)
void shift_x (int delta_x)
void shift_y (int delta_y)
unsigned int get_distance (Point const &p) const
 Calculate the distance to another point.
std::string to_string () const

Private Attributes

int x
int y

Detailed Description

Definition at line 29 of file Point.h.


Constructor & Destructor Documentation

Definition at line 29 of file Point.cc.

References x, and y.

             {
  x = y = 0;
}
Point::Point ( int  x,
int  y 
)

Definition at line 33 of file Point.cc.

References x, and y.

                         {
  this->x = x;
  this->y = y;
}

Member Function Documentation

unsigned int Point::get_distance ( Point const &  p) const

Calculate the distance to another point.

Definition at line 72 of file Point.cc.

References get_x(), get_y(), x, and y.

Referenced by degate::LineSegmentMap::find_adjacent(), and degate::LineSegment::merge().

                                                     {
  return ((labs(x - p.get_x()) << 1) + (labs(y - p.get_y()) << 1)) >> 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Point::get_x ( ) const

Definition at line 46 of file Point.cc.

References x.

Referenced by degate::GateLibraryExporter::add_ports(), degate::LineSegmentMap::find_adjacent(), get_distance(), degate::GateTemplatePort::get_x(), degate::Line::set_p1(), and degate::Line::set_p2().

                       {
  return x;
}

Here is the caller graph for this function:

int Point::get_y ( ) const

Definition at line 50 of file Point.cc.

References y.

Referenced by degate::GateLibraryExporter::add_ports(), degate::LineSegmentMap::find_adjacent(), get_distance(), degate::GateTemplatePort::get_y(), degate::Line::set_p1(), and degate::Line::set_p2().

                       {
  return y;
}

Here is the caller graph for this function:

bool Point::operator!= ( const Point other) const

Definition at line 42 of file Point.cc.

                                               {
    return !(*this == other);
}
bool Point::operator== ( const Point other) const

Definition at line 38 of file Point.cc.

References x, and y.

                                               {
    return (x == other.x && y == other.y);
}
void Point::set_x ( int  x)

Definition at line 54 of file Point.cc.

References x.

                       {
  this->x = x;
}
void Point::set_y ( int  y)

Definition at line 58 of file Point.cc.

References y.

                       {
  this->y = y;
}
void Point::shift_x ( int  delta_x)

Definition at line 67 of file Point.cc.

References x.

                               {
  x += delta_x;
}
void Point::shift_y ( int  delta_y)

Definition at line 63 of file Point.cc.

References y.

                               {
  y += delta_y;
}
std::string Point::to_string ( ) const

Definition at line 76 of file Point.cc.

References x, and y.

                                 {
  boost::format f("point(%1%, %2%)");
  f % x % y;
  return f.str();
}

Member Data Documentation

int degate::Point::x [private]

Definition at line 32 of file Point.h.

Referenced by get_distance(), get_x(), operator==(), Point(), set_x(), shift_x(), and to_string().

int degate::Point::y [private]

Definition at line 32 of file Point.h.

Referenced by get_distance(), get_y(), operator==(), Point(), set_y(), shift_y(), and to_string().


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