|
degate 0.1.1
|
This class represents a port of a gate. More...
#include <GatePort.h>

Public Member Functions | |
| GatePort (std::tr1::shared_ptr< Gate > _gate, std::tr1::shared_ptr< GateTemplatePort > _gate_template_port, unsigned int _diameter=5) | |
| Create a gate port and set a "reference" to the the template port. | |
| GatePort (std::tr1::shared_ptr< Gate > _gate, unsigned int _diameter=5) | |
| Create a gate port. | |
| virtual | ~GatePort () |
| The destructor. | |
| virtual void | set_template_port_type_id (object_id_t _template_port_id) |
| Set the ID of the template port. | |
| virtual object_id_t | get_template_port_type_id () const |
| Get the ID of the template port. | |
| virtual GateTemplatePort_shptr | get_template_port () |
| Get the template port. | |
| virtual const GateTemplatePort_shptr | get_template_port () const |
| Get the template port. | |
| virtual void | set_template_port (std::tr1::shared_ptr< GateTemplatePort > _gate_template_port) |
| Set the template port. | |
| virtual bool | has_template_port () const |
| Check if there is a template port defined. | |
| virtual bool | is_assigned_to_a_gate () const |
| Check if a gate port already belongs to a gate. | |
| std::tr1::shared_ptr< Gate > | get_gate () |
| Get the gate, this gate port belongs to. | |
| 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 gate port. | |
| void | set_x (int x) |
| Set the absolute position of a port. | |
| void | set_y (int y) |
| Set the absolute position of a port. | |
| void | shift_x (int delta_x) |
| Shift the shape vertically. | |
| void | shift_y (int delta_y) |
| Shift the shape horizontally. | |
| 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. | |
Private Attributes | |
| std::tr1::shared_ptr< Gate > | gate |
| std::tr1::shared_ptr < GateTemplatePort > | gate_template_port |
| object_id_t | template_port_id |
This class represents a port of a gate.
Definition at line 43 of file GatePort.h.
| GatePort::GatePort | ( | std::tr1::shared_ptr< Gate > | _gate, |
| std::tr1::shared_ptr< GateTemplatePort > | _gate_template_port, | ||
| unsigned int | _diameter = 5 |
||
| ) |
Create a gate port and set a "reference" to the the template port.
| _gate | A shared pointer to the gate, the port is created for. |
| _gate_template_port | A shared pointer to a template port. |
| _diameter | The diameter of the port. |
Definition at line 38 of file GatePort.cc.
: Circle(_gate->get_min_x() + _gate->get_relative_x_position_within_gate(_gate_template_port->get_x()), _gate->get_min_y() + _gate->get_relative_y_position_within_gate(_gate_template_port->get_y()), _diameter), gate(_gate), gate_template_port(_gate_template_port), template_port_id(_gate_template_port->get_object_id()) { }
| GatePort::GatePort | ( | std::tr1::shared_ptr< Gate > | _gate, |
| unsigned int | _diameter = 5 |
||
| ) |
Create a gate port.
| _gate | A shared pointer to the gate, the port is created for. |
| diameter | The diameter of the port. |
Definition at line 53 of file GatePort.cc.
: Circle(0, 0, _diameter), gate(_gate), template_port_id(0) { //set_x(gate->get_min_x()); //set_y(gate->get_min_y()); }
| virtual degate::GatePort::~GatePort | ( | ) | [inline, virtual] |
| virtual BoundingBox const& degate::GatePort::get_bounding_box | ( | ) | const [inline, virtual] |
Get the bounding box.
Reimplemented from degate::Circle.
Definition at line 185 of file GatePort.h.
Referenced by print().
{
return Circle::get_bounding_box();
}

| const std::string GatePort::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 107 of file GatePort.cc.
References gate, gate_template_port, degate::LogicModelObjectBase::get_object_id(), has_template_port(), and is_assigned_to_a_gate().
{
if(has_template_port() && is_assigned_to_a_gate() &&
gate->has_template()) {
if(gate->has_name()) {
boost::format fmter("%1%: %2% (%3%)");
fmter
% gate->get_name()
% gate_template_port->get_name()
% gate->get_gate_template()->get_name();
return fmter.str();
}
else {
boost::format fmter("%1% (%2%, gate=%3%)");
fmter
% gate_template_port->get_name()
% gate->get_gate_template()->get_name()
% gate->get_object_id();
return fmter.str();
}
}
else {
boost::format fmter("Gate port %1%");
fmter % get_object_id();
return fmter.str();
}
}

| std::tr1::shared_ptr< Gate > GatePort::get_gate | ( | ) |
Get the gate, this gate port belongs to.
Definition at line 103 of file GatePort.cc.
References gate.
{
return gate;
}
| const std::string GatePort::get_object_type_name | ( | ) | const [virtual] |
Get a human readable string that names the object type.
Here it is "Gate port".
Reimplemented from degate::LogicModelObjectBase.
Definition at line 138 of file GatePort.cc.
{
return std::string("Gate port");
}
| GateTemplatePort_shptr GatePort::get_template_port | ( | ) | [virtual] |
Get the template port.
Definition at line 71 of file GatePort.cc.
References gate_template_port.
Referenced by print().
{
return gate_template_port;
}

| const GateTemplatePort_shptr GatePort::get_template_port | ( | ) | const [virtual] |
Get the template port.
Definition at line 75 of file GatePort.cc.
References gate_template_port.
{
return gate_template_port;
}
| object_id_t GatePort::get_template_port_type_id | ( | ) | const [virtual] |
Get the ID of the template port.
Definition at line 67 of file GatePort.cc.
References template_port_id.
{
return template_port_id;
}
| bool GatePort::has_template_port | ( | ) | const [virtual] |
Check if there is a template port defined.
Definition at line 94 of file GatePort.cc.
References gate_template_port.
Referenced by get_descriptive_identifier(), and print().
{
return gate_template_port != NULL;
}

| virtual bool degate::GatePort::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 181 of file GatePort.h.
{
return Circle::in_bounding_box(bbox);
}
| virtual bool degate::GatePort::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 189 of file GatePort.h.
{
return Circle::in_shape(x, y, max_distance);
}
| bool GatePort::is_assigned_to_a_gate | ( | ) | const [virtual] |
Check if a gate port already belongs to a gate.
Normally a gate port belongs to a gate.
Definition at line 98 of file GatePort.cc.
References gate.
Referenced by get_descriptive_identifier().
{
return gate != NULL;
}

| void GatePort::print | ( | std::ostream & | os = std::cout, |
| int | n_tabs = 0 |
||
| ) | const [virtual] |
Print gate port.
Implements degate::PlacedLogicModelObject.
Definition at line 143 of file GatePort.cc.
References degate::gen_tabs(), get_bounding_box(), degate::Circle::get_diameter(), degate::LogicModelObjectBase::get_name(), degate::LogicModelObjectBase::get_object_id(), get_template_port(), degate::Circle::get_x(), degate::Circle::get_y(), has_template_port(), and degate::BoundingBox::to_string().
{
const GateTemplatePort_shptr tmpl_port = get_template_port();
os
<< gen_tabs(n_tabs) << "Gate port name : " << get_name() << std::endl
<< gen_tabs(n_tabs) << "Object ID : " << get_object_id() << std::endl
<< gen_tabs(n_tabs) << "Template Port ID : " <<
(has_template_port() ? tmpl_port->get_object_id() : 0) << std::endl
<< gen_tabs(n_tabs) << "Diameter : " << get_diameter() << std::endl
<< gen_tabs(n_tabs) << "Port position : " << get_x() << " / " << get_y() << std::endl
<< gen_tabs(n_tabs) << "Bounding box : " << get_bounding_box().to_string() << std::endl
<< std::endl;
;
}

| void GatePort::set_diameter | ( | unsigned int | diameter | ) | [virtual] |
Reimplemented from degate::Circle.
Definition at line 183 of file GatePort.cc.
References degate::PlacedLogicModelObject::notify_shape_change().

| void GatePort::set_template_port | ( | std::tr1::shared_ptr< GateTemplatePort > | _gate_template_port | ) | [virtual] |
Set the template port.
Definition at line 79 of file GatePort.cc.
References gate, gate_template_port, set_x(), and set_y().
{
gate_template_port = _gate_template_port;
/* If the gate port is added to a gate afterwards, this caluclation will
be ignored. But if the port already belongs to a gate and a a template is
set afterwards, this calculation is used.
*/
assert(gate != NULL);
set_x(gate->get_min_x() +
gate->get_relative_x_position_within_gate(gate_template_port->get_x()));
set_y(gate->get_min_y() +
gate->get_relative_y_position_within_gate(gate_template_port->get_y()));
}

| void GatePort::set_template_port_type_id | ( | object_id_t | _template_port_id | ) | [virtual] |
Set the ID of the template port.
Definition at line 62 of file GatePort.cc.
References template_port_id.
{
template_port_id = _template_port_id;
}
| void GatePort::set_x | ( | int | x | ) | [virtual] |
Set the absolute position of a port.
Reimplemented from degate::Circle.
Definition at line 162 of file GatePort.cc.
References degate::PlacedLogicModelObject::notify_shape_change().
Referenced by set_template_port().
{
Circle::set_x(x);
notify_shape_change();
}


| void GatePort::set_y | ( | int | y | ) | [virtual] |
Set the absolute position of a port.
Reimplemented from degate::Circle.
Definition at line 168 of file GatePort.cc.
References degate::PlacedLogicModelObject::notify_shape_change().
Referenced by set_template_port().
{
Circle::set_y(y);
notify_shape_change();
}


| void GatePort::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 173 of file GatePort.cc.
References degate::PlacedLogicModelObject::notify_shape_change().
{
Circle::shift_x(delta_x);
notify_shape_change();
}

| void GatePort::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 178 of file GatePort.cc.
References degate::PlacedLogicModelObject::notify_shape_change().
{
Circle::shift_y(delta_y);
notify_shape_change();
}

std::tr1::shared_ptr<Gate> degate::GatePort::gate [private] |
Definition at line 47 of file GatePort.h.
Referenced by get_descriptive_identifier(), get_gate(), is_assigned_to_a_gate(), and set_template_port().
std::tr1::shared_ptr<GateTemplatePort> degate::GatePort::gate_template_port [private] |
Definition at line 48 of file GatePort.h.
Referenced by get_descriptive_identifier(), get_template_port(), has_template_port(), and set_template_port().
Definition at line 49 of file GatePort.h.
Referenced by get_template_port_type_id(), and set_template_port_type_id().
1.7.4