]> AND Private Git Repository - blast.git/blob - ConnectedInterface.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
a8ce4de7861bda09abe777c8e0fc8948975c6b49
[blast.git] / ConnectedInterface.h
1 #ifndef __CONNECTEDINTERFACE_H__
2 #define __CONNECTEDINTERFACE_H__
3
4 #include <iostream>
5
6 #include <QtCore>
7 #include <QtGui>
8
9 #include "AbstractInterface.h"
10 class ReferenceInterface;
11
12 #include "Exception.h"
13
14 using namespace std;
15 using namespace Qt;
16
17
18 class ConnectedInterface : public AbstractInterface {
19
20 public :
21
22   ConnectedInterface(AbstractBlock* _owner);
23   ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose);
24   // getters
25   inline QList<ConnectedInterface*> getConnectedTo() { return connectedTo;}
26   inline ConnectedInterface* getConnectedFrom() { return connectedFrom;}
27
28   // setters
29
30   // testers
31   inline bool isConnectedTo(){return connectedTo.length() != 0;}
32   inline bool isConnectedFrom(){return connectedFrom != NULL;}
33   virtual bool canConnectTo(AbstractInterface* iface) = 0;
34   virtual bool canConnectFrom(AbstractInterface* iface) = 0;
35
36   // others
37   bool connectTo(ConnectedInterface* iface);
38   bool connectFrom(ConnectedInterface* iface);
39   ConnectedInterface* getConnectionToParentGroup();
40   ConnectedInterface* getConnectionFromParentGroup();
41
42   virtual AbstractInterface *clone() = 0;
43
44   void removeConnectedTo(ConnectedInterface *inter);
45
46   virtual void clearConnectedTo();
47   inline void clearConnectedFrom() { connectedFrom = NULL; }
48   virtual void clearConnections();
49   //virtual void connectionsValidation(QStack<AbstractInterface*> *interfacetoValidate, QList<AbstractInterface*> *validatedInterfaces) throw(Exception) = 0;  
50
51 protected:
52   QList<ConnectedInterface*> connectedTo;
53   ConnectedInterface* connectedFrom;
54
55 };
56
57
58 #endif // __CONNECTEDINTERFACE_H__