1 #ifndef __BLOCKIMPLEMENTATION_H__
\r
2 #define __BLOCKIMPLEMENTATION_H__
\r
10 class ReferenceBlock;
\r
11 class FunctionalBlock;
\r
12 class AbstractInterface;
\r
14 #include "ArithmeticEvaluator.h"
\r
15 class ArithmeticEvaluator;
\r
17 #include "Exception.h"
\r
20 using namespace std;
\r
23 class BlockImplementation {
\r
27 BlockImplementation(const QString& _xmlFile);
\r
28 BlockImplementation(const QString& _xmlFile, const QString& _referenceXml, const QString& _referenceMd5);
\r
31 inline QString getXmlFile() { return xmlFile; }
\r
32 inline QString getReferenceXml() { return referenceXml; }
\r
33 inline QString getReferenceMd5() { return referenceMd5; }
\r
34 inline QString getDelta() { return delta; }
\r
35 inline QHash<QString,QString> getConsumptionPattern() { return consumptionPattern; }
\r
36 inline QHash<QString,QString> getProductionPattern() { return productionPattern; }
\r
37 inline QString getProductionCounter() { return productionCounter; }
\r
40 inline void setDelta(QString _delta) { delta = _delta; }
\r
41 inline void setConsumptionPattern(QHash<QString,QString> pattern) { consumptionPattern = pattern; }
\r
42 inline void setProductionPattern(QHash<QString,QString> pattern) { productionPattern = pattern; }
\r
43 inline void setProductionCounter(QString pattern) { productionCounter = pattern; }
\r
47 inline bool hasNoPatterns() { return noPatterns; }
\r
49 QString eval(QString line, QTextStream& out);
\r
50 QString evalComplex(QString line, int num);
\r
51 QString evalString(QString s);
\r
52 QList<AbstractInterface*>* evalStringComplex(QString s);
\r
53 QString evalValue(QString s);
\r
54 QString calculateWidth(QString s);
\r
56 inline void setReference(ReferenceBlock* _reference) { reference = _reference; }
\r
58 void loadPatterns(QDomElement &root) throw(Exception);
\r
59 bool checkPatterns();
\r
61 inline void addSource(QString file) { sources.append(file); }
\r
64 QString referenceXml;
\r
65 QString referenceMd5;
\r
67 QList<QString> sources;
\r
69 QMap<QString, int> paramMap;
\r
70 ArithmeticEvaluator* evaluator;
\r
71 ReferenceBlock* reference;
\r
72 FunctionalBlock* block; // the current functional block for which this implementation is used.
\r
75 QHash<QString,QString> consumptionPattern; // key = reference interface name, value = pattern expression
\r
76 QHash<QString,QString> productionPattern; // key = reference interface name, value = pattern expression
\r
77 QString productionCounter;
\r
79 QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface
\r
81 friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);
\r
82 friend QDataStream &operator>>(QDataStream &in, BlockImplementation &impl);
\r
85 #endif // __BLOCKIMPLEMENTATION_H__
\r