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 QList<BlockParameter *> getParameters() { return params; }
\r
29 inline QList<AbstractInterface*> getInputs() { return inputs; }
\r
30 inline QList<AbstractInterface*> getOutputs() { return outputs; }
\r
31 inline QList<AbstractInterface*> getBidirs() { return bidirs; }
\r
32 QList<BlockParameter *> getUserParameters();
\r
33 QList<BlockParameter *> getGenericParameters();
\r
34 QList<BlockParameter *> getPortParameters();
\r
35 QList<BlockParameter *> getWishboneParameters();
\r
36 inline AbstractBlock* getParent() { return parent; }
\r
38 void setName(const QString& str);
\r
39 virtual void setParent(AbstractBlock* _parent);
\r
42 virtual bool isReferenceBlock();
\r
43 virtual bool isFunctionalBlock();
\r
44 virtual bool isGroupBlock();
\r
45 bool isWBConfigurable();
\r
48 virtual void parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock*>* blocksToConfigure) = 0; // ugly but usefull
\r
50 void addParameter(BlockParameter *param);
\r
51 void addInterface(AbstractInterface *inter);
\r
52 void removeInterface(AbstractInterface *inter);
\r
53 void defineBlockParam(BlockParameter *param);
\r
55 QList<AbstractInterface *> getInterfaces();
\r
56 AbstractInterface* getIfaceFromName(QString name);
\r
57 BlockParameter* getParameterFromName(QString name);
\r
65 QList<BlockParameter *> params;
\r
68 QList<AbstractInterface*> inputs;
\r
69 QList<AbstractInterface*> outputs;
\r
70 QList<AbstractInterface*> bidirs;
\r
74 // NB: only GroupBlock and FunctionalBlock have a real parent
\r
75 AbstractBlock* parent;
\r
78 #endif // __ABSTRACTBLOCK_H__
\r