degate  0.1.2
Public Member Functions | Protected Member Functions
degate::Wire Class Reference

Represents a wire. More...

#include <Wire.h>

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

List of all members.

Public Member Functions

 Wire (int _from_x, int _from_y, int _to_x, int _to_y, diameter_t _diameter)
 The constructor for a wire object.
virtual ~Wire ()
 Destructor for a wire object.
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=std::cout, int n_tabs=0) const
 Print wire.
void shift_x (int delta_x)
 Shift the shape vertically.
void shift_y (int delta_y)
 Shift the shape horizontally.
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.

Protected Member Functions

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

Detailed Description

Represents a wire.

Definition at line 39 of file Wire.h.


Constructor & Destructor Documentation

Wire::Wire ( int  _from_x,
int  _from_y,
int  _to_x,
int  _to_y,
diameter_t  _diameter 
)

The constructor for a wire object.

Definition at line 36 of file Wire.cc.

                                                                                 :
  Line(_from_x, _from_y, _to_x, _to_y, _diameter) {
}
virtual degate::Wire::~Wire ( ) [inline, virtual]

Destructor for a wire object.

Definition at line 51 of file Wire.h.

{}

Member Function Documentation

void Wire::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::ConnectedLogicModelObject.

Definition at line 44 of file Wire.cc.

                                                                        {
  auto clone = std::dynamic_pointer_cast<Wire>(dest);
  Line::cloneDeepInto(dest, oldnew);
  RemoteObject::cloneDeepInto(dest, oldnew);
}

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 40 of file Wire.cc.

References degate::Line::get_diameter(), degate::Line::get_from_x(), degate::Line::get_from_y(), degate::Line::get_to_x(), and degate::Line::get_to_y().

                                            {
  return std::make_shared<Wire>(get_from_x(), get_from_y(), get_to_x(), get_to_y(), get_diameter());
}

Here is the call graph for this function:

virtual BoundingBox const& degate::Wire::get_bounding_box ( ) const [inline, virtual]

Get the bounding box.

Reimplemented from degate::Line.

Definition at line 97 of file Wire.h.

                                                        {
      return Line::get_bounding_box();
    }
const std::string Wire::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 50 of file Wire.cc.

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

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

Here is the call graph for this function:

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

Get a human readable string that names the object type.

Here it is "Wire".

Reimplemented from degate::LogicModelObjectBase.

Definition at line 63 of file Wire.cc.

                                                 {
  return std::string("Wire");
}
virtual bool degate::Wire::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::Line.

Definition at line 93 of file Wire.h.

                                                                {
      return in_bounding_box(bbox);
    }
virtual bool degate::Wire::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::Line.

Definition at line 101 of file Wire.h.

                                                                    {
      return Line::in_shape(x, y, max_distance);
    }
void Wire::print ( std::ostream &  os = std::cout,
int  n_tabs = 0 
) const [virtual]

Print wire.

Implements degate::PlacedLogicModelObject.

Definition at line 67 of file Wire.cc.

                                                  {
}
object_id_t Wire::push_object_to_server ( std::string const &  server_url) [protected, virtual]

Implements degate::RemoteObject.

Definition at line 70 of file Wire.cc.

References degate::Line::get_diameter(), degate::Line::get_from_x(), degate::Line::get_from_y(), degate::PlacedLogicModelObject::get_layer(), degate::Line::get_to_x(), degate::Line::get_to_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("wire"));

    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_from_x()));
    params.add(xmlrpc_c::value_int(get_from_y()));
    params.add(xmlrpc_c::value_int(get_to_x()));
    params.add(xmlrpc_c::value_int(get_to_y()));
    params.add(xmlrpc_c::value_int(get_diameter()));

    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 wire 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 degate::Wire::shift_x ( int  delta_x) [inline, 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::Line.

Definition at line 83 of file Wire.h.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:

void degate::Wire::shift_y ( int  delta_y) [inline, 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::Line.

Definition at line 88 of file Wire.h.

References degate::PlacedLogicModelObject::notify_shape_change().

Here is the call graph for this function:


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