\r
#include <QtCore>\r
\r
+#include "AbstractInterface.h"\r
class AbstractInterface;\r
class BlockParameter;\r
\r
class AbstractBlock {\r
\r
public: \r
-\r
+ \r
AbstractBlock();\r
AbstractBlock(const QString& _name);\r
virtual ~AbstractBlock();\r
\r
// getters\r
inline QString getName() { return name; }\r
+ inline int nbParameters() { return params.size(); }\r
inline QList<BlockParameter *> getParameters() { return params; }\r
inline QList<AbstractInterface*> getInputs() { return inputs; }\r
inline QList<AbstractInterface*> getOutputs() { return outputs; }\r
QList<BlockParameter *> getPortParameters();\r
QList<BlockParameter *> getWishboneParameters();\r
inline AbstractBlock* getParent() { return parent; }\r
+ inline bool getPatternComputed() { return patternComputed; }\r
+ \r
// setters\r
void setName(const QString& str);\r
virtual void setParent(AbstractBlock* _parent);\r
+ inline void setPatternComputed(bool state) { patternComputed = state; }\r
\r
// testers\r
virtual bool isReferenceBlock();\r
virtual bool isFunctionalBlock();\r
virtual bool isGroupBlock();\r
+ virtual bool isSourceBlock(); //! a source block is outside the top group and simulates a peripheral (NB: this is also a generator)\r
+ virtual bool isTopGroupBlock();\r
+ bool isGeneratorBlock(); //! a generator block has no data inputs and thus executes infinitely\r
bool isWBConfigurable();\r
\r
// others\r
void addParameter(BlockParameter *param);\r
void addInterface(AbstractInterface *inter);\r
void removeInterface(AbstractInterface *inter);\r
+ void removeAllInterfaces();\r
void defineBlockParam(BlockParameter *param);\r
\r
- QList<AbstractInterface *> getInterfaces();\r
+ QList<AbstractInterface *> getInterfaces(int direction = AbstractInterface::AnyDirection, int purpose = AbstractInterface::AnyPurpose);\r
+ QList<AbstractInterface *> getDataInputs(); //! return all inputs of type data\r
+ QList<AbstractInterface *> getDataOutputs(); //! return all inputs of type data\r
+ QList<AbstractInterface *> getControlInputs(); //! return all inputs of type control\r
+ QList<AbstractInterface *> getControlOutputs(); //! return all outputs of type control\r
AbstractInterface* getIfaceFromName(QString name);\r
BlockParameter* getParameterFromName(QString name);\r
\r
+ // patterns\r
+ virtual bool computeOutputPattern(int nbExec = -1) = 0;\r
+ \r
protected:\r
\r
\r
QList<AbstractInterface*> inputs;\r
QList<AbstractInterface*> outputs;\r
QList<AbstractInterface*> bidirs;\r
-\r
+ \r
// others\r
-\r
- // NB: only GroupBlock and FunctionalBlock have a real parent\r
+ \r
+ // patterns \r
+ bool patternComputed;\r
+ \r
+ // NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents\r
AbstractBlock* parent;\r
};\r
\r