1 #ifndef __ABSTRACTBLOCK_H__
\r
2 #define __ABSTRACTBLOCK_H__
\r
8 class AbstractInterface;
\r
9 class BlockParameter;
\r
11 #define AB_TO_REF(ptr) ((ReferenceBlock*)ptr)
\r
12 #define AB_TO_FUN(ptr) ((FunctionalBlock*)ptr)
\r
13 #define AB_TO_GRP(ptr) ((GroupBlock*)ptr)
\r
15 using namespace std;
\r
18 class AbstractBlock {
\r
23 AbstractBlock(const QString& _name);
\r
24 virtual ~AbstractBlock();
\r
27 inline QString getName() { return name; }
\r
28 inline int nbParameters() { return params.size(); }
\r
29 inline QList<BlockParameter *> getParameters() { return params; }
\r
30 inline QList<AbstractInterface*> getInputs() { return inputs; }
\r
31 inline QList<AbstractInterface*> getOutputs() { return outputs; }
\r
32 inline QList<AbstractInterface*> getBidirs() { return bidirs; }
\r
33 QList<BlockParameter *> getUserParameters();
\r
34 QList<BlockParameter *> getGenericParameters();
\r
35 QList<BlockParameter *> getPortParameters();
\r
36 QList<BlockParameter *> getWishboneParameters();
\r
37 inline AbstractBlock* getParent() { return parent; }
\r
39 void setName(const QString& str);
\r
40 virtual void setParent(AbstractBlock* _parent);
\r
43 virtual bool isReferenceBlock();
\r
44 virtual bool isFunctionalBlock();
\r
45 virtual bool isGroupBlock();
\r
46 bool isWBConfigurable();
\r
49 virtual void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure) = 0; // ugly but usefull
\r
51 void addParameter(BlockParameter *param);
\r
52 void addInterface(AbstractInterface *inter);
\r
53 void removeInterface(AbstractInterface *inter);
\r
54 void removeAllInterfaces();
\r
55 void defineBlockParam(BlockParameter *param);
\r
57 QList<AbstractInterface *> getInterfaces();
\r
58 AbstractInterface* getIfaceFromName(QString name);
\r
59 BlockParameter* getParameterFromName(QString name);
\r
67 QList<BlockParameter *> params;
\r
70 QList<AbstractInterface*> inputs;
\r
71 QList<AbstractInterface*> outputs;
\r
72 QList<AbstractInterface*> bidirs;
\r
76 // NB: only GroupBlock and FunctionalBlock have a real parent
\r
77 AbstractBlock* parent;
\r
80 #endif // __ABSTRACTBLOCK_H__
\r