degate  0.1.2
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
degate::Via Class Reference

Representation of a via that interconnects layers of a chip. More...

#include <Via.h>

Inheritance diagram for degate::Via:
Inheritance graph
[legend]

List of all members.

Public Types

enum  DIRECTION {
  DIRECTION_UNDEFINED = 0,
  DIRECTION_UP = 1,
  DIRECTION_DOWN = 2
}
 An enum to indicate, which layer is connected. More...

Public Member Functions

 Via ()
 Via (int _x, int _y, diameter_t _diameter, DIRECTION _direction=DIRECTION_UNDEFINED)
 Constructor for a via object.
virtual ~Via ()
 Destructor for a via object.
virtual DIRECTION get_direction () const
 Get direction.
virtual void set_direction (DIRECTION dir)
 Set direction.
virtual const std::string get_direction_as_string () const
 Get the direction as a human readable string.
virtual const std::string get_descriptive_identifier () const
 Get a human readable string that describes the whole logic model object.
virtual const std::string get_object_type_name () const
 Get a human readable string that names the object type.
void print (std::ostream &os, int n_tabs) const
 Print the object.
void shift_x (int delta_x)
 Shift the shape vertically.
void shift_y (int delta_y)
 Shift the shape horizontally.
void set_x (int x)
void set_y (int y)
void set_diameter (unsigned int diameter)
virtual bool in_bounding_box (BoundingBox const &bbox) const
 Check if this shape is in the bounding box.
virtual BoundingBox const & get_bounding_box () const
 Get the bounding box.
virtual bool in_shape (int x, int y, int max_distance=0) const
 Check in the Point with coordinates x and y is within the area of the shape.
DeepCopyable_shptr cloneShallow () const
 Return a copy of this object, but with all references to other DeepCopyables cleared (e.g.
void cloneDeepInto (DeepCopyable_shptr destination, oldnew_t *oldnew) const
 Deep-copy all members to destination.

Static Public Member Functions

static Via::DIRECTION get_via_direction_from_string (std::string const &via_direction_str)
 Parse a via direction string and return it as enum value.

Protected Member Functions

virtual object_id_t push_object_to_server (std::string const &server_url)

Private Attributes

DIRECTION direction

Detailed Description

Representation of a via that interconnects layers of a chip.

Definition at line 44 of file Via.h.


Member Enumeration Documentation

An enum to indicate, which layer is connected.

Vias are placed on a layer. If the via connects an object from the current layer to a layer that is above, then the direction is up.

Enumerator:
DIRECTION_UNDEFINED 
DIRECTION_UP 
DIRECTION_DOWN 

Definition at line 56 of file Via.h.


Constructor & Destructor Documentation

degate::Via::Via ( ) [inline, explicit]

Definition at line 68 of file Via.h.

{};
Via::Via ( int  _x,
int  _y,
diameter_t  _diameter,
Via::DIRECTION  _direction = DIRECTION_UNDEFINED 
)

Constructor for a via object.

Definition at line 29 of file Via.cc.

                                                                      :
  Circle(_x, _y, _diameter),
  direction(_direction) {
}
Via::~Via ( ) [virtual]

Destructor for a via object.

Definition at line 34 of file Via.cc.

{}

Member Function Documentation

void Via::cloneDeepInto ( DeepCopyable_shptr  destination,
oldnew_t oldnew 
) const [virtual]

Deep-copy all members to destination.

Todo:
Find out whether the default assignment operator can be used to simplify implementations of this method.

Reimplemented from degate::Circle.

Definition at line 42 of file Via.cc.

Return a copy of this object, but with all references to other DeepCopyables cleared (e.g.

set to 0-pointer).

Implements degate::DeepCopyable.

Definition at line 36 of file Via.cc.

References direction.

                                           {
  auto clone = std::make_shared<Via>();
  clone->direction = direction;
  return clone;
}
virtual BoundingBox const& degate::Via::get_bounding_box ( ) const [inline, virtual]

Get the bounding box.

Reimplemented from degate::Circle.

Definition at line 145 of file Via.h.

Referenced by print().

                                                        {
      return Circle::get_bounding_box();
    }

Here is the caller graph for this function:

const std::string Via::get_descriptive_identifier ( ) const [virtual]

Get a human readable string that describes the whole logic model object.

The string should be unique in order to let the user identify the concrete object. But that is not a must.

Reimplemented from degate::LogicModelObjectBase.

Definition at line 73 of file Via.cc.

References degate::LogicModelObjectBase::get_name(), degate::LogicModelObjectBase::get_object_id(), and degate::LogicModelObjectBase::has_name().

                                                      {
  if(has_name()) {
    boost::format fmter("via %1% (%2%)");
    fmter % get_name() % get_object_id();
    return fmter.str();
  }
  else {
    boost::format fmter("via (%1%)");
    fmter % get_object_id();
    return fmter.str();
  }
}

Here is the call graph for this function:

Via::DIRECTION Via::get_direction ( ) const [virtual]

Get direction.

Definition at line 48 of file Via.cc.

References direction.

                                      {
  return direction;
}
const std::string Via::get_direction_as_string ( ) const [virtual]

Get the direction as a human readable string.

Definition at line 56 of file Via.cc.

References direction, DIRECTION_DOWN, DIRECTION_UNDEFINED, and DIRECTION_UP.

Referenced by push_object_to_server().

                                                   {
  switch(direction) {
  case DIRECTION_UP: return std::string("up");
  case DIRECTION_DOWN: return std::string("down");
  case DIRECTION_UNDEFINED:
  default: return std::string("undefined");
  }
}

Here is the caller graph for this function:

const std::string Via::get_object_type_name ( ) const [virtual]

Get a human readable string that names the object type.

Here it is "Via".

Reimplemented from degate::LogicModelObjectBase.

Definition at line 86 of file Via.cc.

                                                {
  return std::string("Via");
}
Via::DIRECTION Via::get_via_direction_from_string ( std::string const &  via_direction_str) [static]

Parse a via direction string and return it as enum value.

Definition at line 65 of file Via.cc.

References DIRECTION_DOWN, DIRECTION_UNDEFINED, and DIRECTION_UP.

Referenced by degate::process_changelog_command().

                                                                                  {

  if(via_direction_str == "up") return Via::DIRECTION_UP;
  else if(via_direction_str == "down") return Via::DIRECTION_DOWN;
  else if(via_direction_str == "undefined") return Via::DIRECTION_UNDEFINED;
  else throw DegateRuntimeException("Can't parse via direction type.");
}

Here is the caller graph for this function:

virtual bool degate::Via::in_bounding_box ( BoundingBox const &  bbox) const [inline, virtual]

Check if this shape is in the bounding box.

Note: it is somhow unclear if this 'in' means complete within or if an intersection is sufficient.

Reimplemented from degate::Circle.

Definition at line 141 of file Via.h.

                                                                {
      return Circle::in_bounding_box(bbox);
    }
virtual bool degate::Via::in_shape ( int  x,
int  y,
int  max_distance = 0 
) const [inline, virtual]

Check in the Point with coordinates x and y is within the area of the shape.

Reimplemented from degate::Circle.

Definition at line 149 of file Via.h.

                                                                    {
      return Circle::in_shape(x, y, max_distance);
    }
void Via::print ( std::ostream &  os,
int  n_tabs 
) const [virtual]

Print the object.

Implements degate::PlacedLogicModelObject.

Definition at line 91 of file Via.cc.

References degate::gen_tabs(), get_bounding_box(), degate::LogicModelObjectBase::get_name(), degate::LogicModelObjectBase::get_object_id(), degate::Circle::get_x(), degate::Circle::get_y(), and degate::BoundingBox::to_string().

                                                 {

  os
    << gen_tabs(n_tabs) << "Via name          : " << get_name() << std::endl
    << gen_tabs(n_tabs) << "Object ID         : " << get_object_id() << std::endl
    << gen_tabs(n_tabs) << "Via position      : " << get_x() << " / " << get_y() << std::endl
    << gen_tabs(n_tabs) << "Bounding box      : " << Circle::get_bounding_box().to_string() << std::endl
    << std::endl;
    ;

}

Here is the call graph for this function:

object_id_t Via::push_object_to_server ( std::string const &  server_url) [protected, virtual]

Implements degate::RemoteObject.

Definition at line 133 of file Via.cc.

References degate::Circle::get_diameter(), get_direction_as_string(), degate::PlacedLogicModelObject::get_layer(), degate::Circle::get_x(), degate::Circle::get_y(), degate::PlacedLogicModelObject::layer, degate::remote_method_call(), and degate::RemoteObject::set_remote_object_id().

                                                                  {

  try {

    xmlrpc_c::paramList params;
    params.add(xmlrpc_c::value_string("add"));
    params.add(xmlrpc_c::value_string("via"));

    Layer_shptr layer = get_layer();
    assert(layer != NULL);
    params.add(xmlrpc_c::value_int(layer->get_layer_id()));

    params.add(xmlrpc_c::value_int(get_x()));
    params.add(xmlrpc_c::value_int(get_y()));
    params.add(xmlrpc_c::value_int(get_diameter()));
    params.add(xmlrpc_c::value_string(get_direction_as_string()));

    int const transaction_id =
      xmlrpc_c::value_int(remote_method_call(server_url, "degate.push", params));

    set_remote_object_id(transaction_id);

    std::cout << "Pushed via to server. remote id is: " << transaction_id << std::endl;
    return transaction_id;
  }
  catch(std::exception const& e) {
    std::cerr << "Client threw error: " << e.what() << std::endl;
    throw XMLRPCException(e.what());
  }
  catch(...) {
    std::cerr << "Client threw unexpected error." << std::endl;
    throw XMLRPCException("Client threw unexpected error.");
  }

}

Here is the call graph for this function:

void Via::set_diameter ( unsigned int  diameter) [virtual]

Reimplemented from degate::Circle.

Definition at line 127 of file Via.cc.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:

void Via::set_direction ( Via::DIRECTION  dir) [virtual]

Set direction.

Definition at line 52 of file Via.cc.

References direction.

                                        {
  direction = dir;
}
void Via::set_x ( int  x) [virtual]

Reimplemented from degate::Circle.

Definition at line 117 of file Via.cc.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:

void Via::set_y ( int  y) [virtual]

Reimplemented from degate::Circle.

Definition at line 122 of file Via.cc.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:

void Via::shift_x ( int  delta_x) [virtual]

Shift the shape vertically.

Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.

Reimplemented from degate::Circle.

Definition at line 107 of file Via.cc.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:

void Via::shift_y ( int  delta_y) [virtual]

Shift the shape horizontally.

Note: If you store this shape in a QuadTree, you have to manage the changes in your QuadTree by yourself.

Reimplemented from degate::Circle.

Definition at line 112 of file Via.cc.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:


Member Data Documentation

Definition at line 64 of file Via.h.

Referenced by cloneShallow(), get_direction(), get_direction_as_string(), and set_direction().


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