1 #ifndef __CONNECTEDINTERFACE_H__
2 #define __CONNECTEDINTERFACE_H__
9 #include "AbstractInterface.h"
10 class ReferenceInterface;
11 #include "AbstractInputModifier.h"
14 #include "Exception.h"
20 * \brief The ConnectedInterface class represents an interface of block (functional or group) that may be connected from/to other interfaces
21 * A ConnectedInterface is used to establish connection between blocks.
23 class ConnectedInterface : public AbstractInterface {
27 ConnectedInterface(AbstractBlock* _owner);
28 ConnectedInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width);
29 ~ConnectedInterface();
32 inline QList<ConnectedInterface*> getConnectedTo() { return connectedTo;}
33 inline ConnectedInterface* getConnectedFrom() { return connectedFrom;}
34 inline QList<char>* getOutputPattern() { return outputPattern; }
35 inline AbstractInputModifier* getInputModifier() { return inputModifier; }
38 void setOutputPattern(QList<char>* pattern);
39 inline void setInputModifier(AbstractInputModifier* mod) { inputModifier = mod; }
42 inline bool isConnectedTo(){return connectedTo.length() != 0;}
43 inline bool isConnectedToMany(){return connectedTo.length()>=2;}
44 inline bool isConnectedFrom(){return connectedFrom != NULL;}
45 virtual bool canConnectTo(AbstractInterface* iface) = 0;
46 virtual bool canConnectFrom(AbstractInterface* iface) = 0;
49 void resetOutputPattern() { outputPattern = NULL; }
50 void connectTo(ConnectedInterface* iface);
51 void disconnectTo(ConnectedInterface* iface);
52 //bool connectFrom(ConnectedInterface* iface);
53 ConnectedInterface* getConnectionToParentGroup();
54 ConnectedInterface* getConnectionFromParentGroup();
55 void clearInputModifier();
57 virtual AbstractInterface *clone() = 0;
58 //void removeConnectedTo(ConnectedInterface *inter);
60 virtual void clearConnectedTo();
61 inline void clearConnectedFrom() { connectedFrom = NULL; }
62 virtual void clearConnections();
63 //virtual void connectionsValidation(QStack<AbstractInterface*> *interfacetoValidate, QList<AbstractInterface*> *validatedInterfaces) throw(Exception) = 0;
67 * \brief connectedTo lists of connections to interfaces owned by other blocks (functional or group)
68 * Since the graph is oriented, and taking into account it modles a FPGA desing,
69 * this interface may be connected to several interfaces owned by other blocks (functional or group).
70 * connectedTo references such interfaces if they exist.
72 QList<ConnectedInterface*> connectedTo;
74 * \brief connectedFrom connection from an interface owned by another blocks (functional or group)
75 * Since the graph is oriented, and taking into account it modles a FPGA desing,
76 * there may be a single interface owned by another block (functional or group) that is connected to
77 * this interface. connecteFrom references such an interface if it exists.
79 ConnectedInterface* connectedFrom;
80 AbstractInputModifier* inputModifier; // if needed, represent a block taht does not appear on screen but taht will modify the stream.
83 QList<char>* outputPattern; //! only usefull for output interfaces
87 #endif // __CONNECTEDINTERFACE_H__