1 #include "ArithmeticEvaluator.h"
\r
2 #include "ConnectedInterface.h"
\r
3 #include "FunctionalBlock.h"
\r
4 #include "GroupBlock.h"
\r
7 ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterface(_owner) {
\r
8 connectedFrom = NULL;
\r
11 ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) {
\r
12 connectedFrom = NULL;
\r
15 void ConnectedInterface::removeConnectedTo(ConnectedInterface *iface) {
\r
16 connectedTo.removeOne(iface);
\r
19 void ConnectedInterface::clearConnections() {
\r
20 connectedFrom = NULL;
\r
21 connectedTo.clear();
\r
24 void ConnectedInterface::clearConnectedTo() {
\r
25 connectedTo.clear();
\r
28 void ConnectedInterface::connectTo(ConnectedInterface *iface) {
\r
30 connectedTo.append(iface);
\r
31 iface->connectedFrom = this;
\r
32 ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface;
\r
33 ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface);
\r
34 if ((asso1 != NULL) && (asso2 != NULL)) {
\r
35 asso1->connectedTo.append(asso2);
\r
36 asso2->connectedFrom = asso1;
\r
40 void ConnectedInterface::disconnectTo(ConnectedInterface *iface) {
\r
42 connectedTo.removeAll(iface);
\r
43 iface->connectedFrom = NULL;
\r
44 ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface;
\r
45 ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface);
\r
46 if ((asso1 != NULL) && (asso2 != NULL)) {
\r
47 asso1->connectedTo.removeAll(asso2);
\r
48 asso2->connectedFrom = NULL;
\r
54 bool ConnectedInterface::connectFrom(ConnectedInterface *iface) {
\r
55 if (canConnectFrom(iface)) {
\r
56 connectedFrom = iface;
\r
63 /* getConnectionToParentGroup() :
\r
64 if an interface among connectedTo is an interface of the parent group
\r
67 ConnectedInterface* ConnectedInterface::getConnectionToParentGroup() {
\r
68 foreach(ConnectedInterface *iface, connectedTo) {
\r
69 if (owner->getParent() == iface->owner) {
\r
76 /* getConnectionFromParentGroup() :
\r
77 if connectedFrom is an interface of the parent group
\r
80 ConnectedInterface *ConnectedInterface::getConnectionFromParentGroup() {
\r
81 if ((connectedFrom != NULL) && (owner->getParent() == connectedFrom->owner)) {
\r
82 return connectedFrom;
\r