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

Public Types | |
| enum | PORT_TYPE { PORT_TYPE_UNDEFINED = 0, PORT_TYPE_IN = 1, PORT_TYPE_OUT = 2, PORT_TYPE_INOUT = 3 } |
| Enum to define type of ports. More... | |
Public Member Functions | |
| GateTemplatePort (int _x, int _y, PORT_TYPE _port_type=PORT_TYPE_UNDEFINED) | |
| Create a template port. | |
| GateTemplatePort (PORT_TYPE _port_type=PORT_TYPE_UNDEFINED) | |
| Create a template port. | |
| virtual | ~GateTemplatePort () |
| virtual bool | is_position_defined () const |
| Check if a position is defined for the port. | |
| virtual void | set_point (Point p) |
| Set the port position within the gate template. | |
| virtual bool | is_inport () const |
| Check if a port is of type input port or an in-out-port. | |
| virtual bool | is_outport () const |
| Check if a port is of type output port or an in-out-port. | |
| virtual bool | is_inoutport () const |
| Check if a port is of type tristate. | |
| virtual bool | has_undefined_port_type () const |
| Check if a port is of type is undefined. | |
| virtual void | set_port_type (PORT_TYPE _port_type) |
| Set the port type. | |
| virtual PORT_TYPE | get_port_type () const |
| Get the port type. | |
| virtual const std::string | get_port_type_as_string () const |
| Get a human readable string, that describes the port type. | |
| virtual Point const & | get_point () const |
| Get the port position within the gate template. | |
| virtual int | get_x () const |
| Get the x position for a port. | |
| virtual int | get_y () const |
| Get the y position for a port. | |
Static Public Member Functions | |
| static PORT_TYPE | get_port_type_from_string (std::string const &port_type_str) |
| Parse a port type type indicating string. | |
Private Attributes | |
| Point | point |
| PORT_TYPE | port_type |
| bool | position_defined |
This class represents a port of a gate template.
Definition at line 34 of file GateTemplatePort.h.
Enum to define type of ports.
Definition at line 41 of file GateTemplatePort.h.
{
PORT_TYPE_UNDEFINED = 0,
PORT_TYPE_IN = 1,
PORT_TYPE_OUT = 2,
PORT_TYPE_INOUT = 3
};
| degate::GateTemplatePort::GateTemplatePort | ( | int | _x, |
| int | _y, | ||
| PORT_TYPE | _port_type = PORT_TYPE_UNDEFINED |
||
| ) | [inline] |
Create a template port.
Definition at line 62 of file GateTemplatePort.h.
:
point(_x, _y), port_type(_port_type), position_defined( true) {
}
| degate::GateTemplatePort::GateTemplatePort | ( | PORT_TYPE | _port_type = PORT_TYPE_UNDEFINED | ) | [inline] |
Create a template port.
Definition at line 70 of file GateTemplatePort.h.
:
point(0, 0), port_type(_port_type), position_defined(false) {
}
| virtual degate::GateTemplatePort::~GateTemplatePort | ( | ) | [inline, virtual] |
Definition at line 75 of file GateTemplatePort.h.
{}
| virtual Point const& degate::GateTemplatePort::get_point | ( | ) | const [inline, virtual] |
Get the port position within the gate template.
Definition at line 153 of file GateTemplatePort.h.
References point.
{ return point; }
| virtual PORT_TYPE degate::GateTemplatePort::get_port_type | ( | ) | const [inline, virtual] |
Get the port type.
Definition at line 129 of file GateTemplatePort.h.
References port_type.
{ return port_type; }
| virtual const std::string degate::GateTemplatePort::get_port_type_as_string | ( | ) | const [inline, virtual] |
Get a human readable string, that describes the port type.
That is "in", "out" or "tristate".
Definition at line 136 of file GateTemplatePort.h.
References port_type, PORT_TYPE_IN, PORT_TYPE_INOUT, PORT_TYPE_OUT, and PORT_TYPE_UNDEFINED.
{
switch(port_type) {
case PORT_TYPE_IN: return std::string("in");
case PORT_TYPE_OUT: return std::string("out");
case PORT_TYPE_INOUT: return std::string("inout");
case PORT_TYPE_UNDEFINED:
default: return std::string("undefined");
}
}
| static PORT_TYPE degate::GateTemplatePort::get_port_type_from_string | ( | std::string const & | port_type_str | ) | [inline, static] |
Parse a port type type indicating string.
| DegateRuntimeException | This exception is thrown if the string cannot be parsed. |
Definition at line 178 of file GateTemplatePort.h.
References PORT_TYPE_IN, PORT_TYPE_INOUT, PORT_TYPE_OUT, and PORT_TYPE_UNDEFINED.
{
if(port_type_str == "undefined") return GateTemplatePort::PORT_TYPE_UNDEFINED;
else if(port_type_str == "in") return GateTemplatePort::PORT_TYPE_IN;
else if(port_type_str == "out") return GateTemplatePort::PORT_TYPE_OUT;
else if(port_type_str == "inout") return GateTemplatePort::PORT_TYPE_INOUT;
else throw DegateRuntimeException("Can't parse port type.");
}
| virtual int degate::GateTemplatePort::get_x | ( | ) | const [inline, virtual] |
Get the x position for a port.
Definition at line 161 of file GateTemplatePort.h.
References degate::Point::get_x(), and point.
{ return point.get_x(); }

| virtual int degate::GateTemplatePort::get_y | ( | ) | const [inline, virtual] |
Get the y position for a port.
Definition at line 169 of file GateTemplatePort.h.
References degate::Point::get_y(), and point.
{ return point.get_y(); }

| virtual bool degate::GateTemplatePort::has_undefined_port_type | ( | ) | const [inline, virtual] |
Check if a port is of type is undefined.
Definition at line 117 of file GateTemplatePort.h.
References port_type, and PORT_TYPE_UNDEFINED.
{ return port_type == PORT_TYPE_UNDEFINED; }
| virtual bool degate::GateTemplatePort::is_inoutport | ( | ) | const [inline, virtual] |
Check if a port is of type tristate.
Definition at line 111 of file GateTemplatePort.h.
References port_type, and PORT_TYPE_INOUT.
Referenced by is_inport(), and is_outport().
{ return port_type == PORT_TYPE_INOUT; }

| virtual bool degate::GateTemplatePort::is_inport | ( | ) | const [inline, virtual] |
Check if a port is of type input port or an in-out-port.
Definition at line 99 of file GateTemplatePort.h.
References is_inoutport(), port_type, and PORT_TYPE_IN.
{ return port_type == PORT_TYPE_IN || is_inoutport(); }

| virtual bool degate::GateTemplatePort::is_outport | ( | ) | const [inline, virtual] |
Check if a port is of type output port or an in-out-port.
Definition at line 105 of file GateTemplatePort.h.
References is_inoutport(), port_type, and PORT_TYPE_OUT.
{ return port_type == PORT_TYPE_OUT || is_inoutport(); }

| virtual bool degate::GateTemplatePort::is_position_defined | ( | ) | const [inline, virtual] |
Check if a position is defined for the port.
Definition at line 81 of file GateTemplatePort.h.
References position_defined.
{ return position_defined; }
| virtual void degate::GateTemplatePort::set_point | ( | Point | p | ) | [inline, virtual] |
Set the port position within the gate template.
The position is in relative coordinates related to the left upper corner of the gate template.
Definition at line 90 of file GateTemplatePort.h.
References point, and position_defined.
{
position_defined = true;
point = p;
}
| virtual void degate::GateTemplatePort::set_port_type | ( | PORT_TYPE | _port_type | ) | [inline, virtual] |
Set the port type.
Definition at line 123 of file GateTemplatePort.h.
References port_type.
{ port_type = _port_type; }
Point degate::GateTemplatePort::point [private] |
Definition at line 50 of file GateTemplatePort.h.
Referenced by get_point(), get_x(), get_y(), and set_point().
PORT_TYPE degate::GateTemplatePort::port_type [private] |
Definition at line 51 of file GateTemplatePort.h.
Referenced by get_port_type(), get_port_type_as_string(), has_undefined_port_type(), is_inoutport(), is_inport(), is_outport(), and set_port_type().
bool degate::GateTemplatePort::position_defined [private] |
Definition at line 53 of file GateTemplatePort.h.
Referenced by is_position_defined(), and set_point().
1.7.4