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
39 inline void setDelta(QString _delta) { delta = _delta; }
\r
40 inline void setConsumptionPattern(QHash<QString,QString> pattern) { consumptionPattern = pattern; }
\r
41 inline void setProductionPattern(QHash<QString,QString> pattern) { productionPattern = pattern; }
\r
42 inline void setProductionCounter(QString pattern) { productionCounter = pattern; }
\r
44 QString eval(QString line, QTextStream& out);
\r
45 QString evalComplex(QString line, int num);
\r
46 QString evalString(QString s);
\r
47 QList<AbstractInterface*>* evalStringComplex(QString s);
\r
48 QString evalValue(QString s);
\r
49 QString calculateWidth(QString s);
\r
51 inline void setReference(ReferenceBlock* _reference) { reference = _reference; }
\r
53 void loadPatterns(QDomElement &root) throw(Exception);
\r
54 bool checkPatterns();
\r
56 inline void addSource(QString file) { sources.append(file); }
\r
59 QString referenceXml;
\r
60 QString referenceMd5;
\r
62 QList<QString> sources;
\r
64 QMap<QString, int> paramMap;
\r
65 ArithmeticEvaluator* evaluator;
\r
66 ReferenceBlock* reference;
\r
67 FunctionalBlock* block; // the current functional block for which this implementation is used.
\r
69 QHash<QString,QString> consumptionPattern; // key = reference interface name, value = pattern expression
\r
70 QHash<QString,QString> productionPattern; // key = reference interface name, value = pattern expression
\r
71 QString productionCounter;
\r
73 QString getIfaceUserName(AbstractInterface* refIface); // get the name of an interface given by the user, from the reference interface
\r
75 friend QDataStream &operator<<(QDataStream &out, const BlockImplementation &impl);
\r
76 friend QDataStream &operator>>(QDataStream &in, BlockImplementation &impl);
\r
79 #endif // __BLOCKIMPLEMENTATION_H__
\r