1 #include "FunctionalBlock.h"
\r
2 #include "ReferenceBlock.h"
\r
3 #include "GroupBlock.h"
\r
4 #include "AbstractInterface.h"
\r
5 #include "FunctionalInterface.h"
\r
6 #include "ReferenceInterface.h"
\r
7 #include "BlockParameter.h"
\r
10 FunctionalBlock::FunctionalBlock(GroupBlock *_parent, ReferenceBlock *_reference) throw(Exception) : AbstractBlock() {
\r
11 //if (! _reference->isReferenceBlock()) throw(Exception(BLOCK_INVALID_TYPE));
\r
12 //if (! _group->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE));
\r
13 reference = _reference;
\r
15 name = reference->getName();
\r
19 void FunctionalBlock::parametersValidation(QList<AbstractBlock*>* checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {
\r
21 checkedBlocks->append(this);
\r
23 foreach(BlockParameter* param, params){
\r
24 if(param->isUserParameter() && !param->isValueSet()){
\r
25 if(!blocksToConfigure->contains(param->getOwner())){
\r
26 blocksToConfigure->append(param->getOwner());
\r
30 foreach(AbstractInterface *inter, outputs){
\r
31 foreach(AbstractInterface *connectedInter, inter->getConnectedTo()){
\r
32 if(!checkedBlocks->contains(connectedInter->getOwner())){
\r
33 connectedInter->getOwner()->parametersValidation(checkedBlocks, blocksToConfigure);
\r
40 bool FunctionalBlock::isFunctionalBlock() {
\r
44 void FunctionalBlock::populate() {
\r
47 AbstractInterface* inter;
\r
49 QList<BlockParameter*> lstParam = reference->getParameters();
\r
50 for(i=0;i<lstParam.size();i++) {
\r
51 p = lstParam.at(i)->clone();
\r
55 QList<AbstractInterface *> lstInter = reference->getInterfaces();
\r
56 for(i=0;i<lstInter.size();i++) {
\r
58 inter = new FunctionalInterface(this, (ReferenceInterface*)lstInter.at(i));
\r
60 catch(Exception e) {
\r
61 cerr << "Abnormal case: " << qPrintable(e.getDefaultMessage()) << endl << "Aborting execution." << endl;
\r
65 addInterface(inter);
\r
71 QString FunctionalBlock::getReferenceXmlFile() {
\r
72 return ((ReferenceBlock *)reference)->getXmlFile();
\r
75 QString FunctionalBlock::getReferenceHashMd5()
\r
77 return ((ReferenceBlock *)reference)->getHashMd5();
\r