1 #include "GroupBlock.h"
2 #include "BlockParameterGeneric.h"
3 #include "AbstractInterface.h"
7 int GroupBlock::counter = 1;
9 GroupBlock::GroupBlock(GroupBlock *_parent) throw(Exception) : AbstractBlock() {
11 // force topGroup to false if this group has a parent
12 if (_parent != NULL) {
14 name = QString("sub_group")+"_"+QString::number(counter++);
18 name = QString("top_group");
22 // adding this to the child blocks of parent
23 AB_TO_GRP(parent)->addBlock(this);
27 GroupBlock::~GroupBlock() {
28 foreach(AbstractBlock* block, blocks) {
33 bool GroupBlock::isGroupBlock() {
37 void GroupBlock::setParent(AbstractBlock *_parent) {
44 void GroupBlock::removeBlock(AbstractBlock* block) {
45 blocks.removeAll(block);
48 void GroupBlock::parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {
51 checkedBlocks->append(this);
53 foreach(BlockParameter* param, params){
54 if(param->isUserParameter() && !param->isValueSet()){
55 if(!blocksToConfigure->contains(param->getOwner())){
56 blocksToConfigure->append(param->getOwner());
60 foreach(AbstractInterface *inter, outputs){
61 foreach(AbstractInterface *connectedInter, inter->getConnectedTo()){
62 if(!checkedBlocks->contains(connectedInter->getOwner())){
63 connectedInter->getOwner()->parametersValidation(checkedBlocks, blocksToConfigure);
70 void GroupBlock::addGenericParameter(QString name, QString type, QString value) {
71 BlockParameter* param = new BlockParameterGeneric(this, name, type, value);
75 void GroupBlock::removeGenericParameter(QString name) {
76 BlockParameter* p = getParameterFromName(name);
77 if (p != NULL) params.removeAll(p);