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 connectTo(ConnectedInterface* iface);
50 void disconnectTo(ConnectedInterface* iface);
51 //bool connectFrom(ConnectedInterface* iface);
52 ConnectedInterface* getConnectionToParentGroup();
53 ConnectedInterface* getConnectionFromParentGroup();
54 void clearInputModifier();
56 virtual AbstractInterface *clone() = 0;
57 //void removeConnectedTo(ConnectedInterface *inter);
59 virtual void clearConnectedTo();
60 inline void clearConnectedFrom() { connectedFrom = NULL; }
61 virtual void clearConnections();
62 //virtual void connectionsValidation(QStack<AbstractInterface*> *interfacetoValidate, QList<AbstractInterface*> *validatedInterfaces) throw(Exception) = 0;
66 * \brief connectedTo lists of connections to interfaces owned by other blocks (functional or group)
67 * Since the graph is oriented, and taking into account it modles a FPGA desing,
68 * this interface may be connected to several interfaces owned by other blocks (functional or group).
69 * connectedTo references such interfaces if they exist.
71 QList<ConnectedInterface*> connectedTo;
73 * \brief connectedFrom connection from an interface owned by another blocks (functional or group)
74 * Since the graph is oriented, and taking into account it modles a FPGA desing,
75 * there may be a single interface owned by another block (functional or group) that is connected to
76 * this interface. connecteFrom references such an interface if it exists.
78 ConnectedInterface* connectedFrom;
79 AbstractInputModifier* inputModifier; // if needed, represent a block taht does not appear on screen but taht will modify the stream.
82 QList<char>* outputPattern; //! only usefull for output interfaces
86 #endif // __CONNECTEDINTERFACE_H__