Browse Source

Assert that there are no duplicate PortWidgets added to a ModuleWidget.

tags/v1.1.2
Andrew Belt 5 years ago
parent
commit
02f0ff2201
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/app/ModuleWidget.cpp

+ 12
- 0
src/app/ModuleWidget.cpp View File

@@ -447,13 +447,25 @@ void ModuleWidget::addParam(ParamWidget *param) {
}

void ModuleWidget::addOutput(PortWidget *output) {
// Check that the port is an output
assert(output->type == PortWidget::OUTPUT);
// Check that the port doesn't have a duplicate ID
for (PortWidget *output2 : outputs) {
assert(output->portId != output2->portId);
}
// Add port
outputs.push_back(output);
addChild(output);
}

void ModuleWidget::addInput(PortWidget *input) {
// Check that the port is an input
assert(input->type == PortWidget::INPUT);
// Check that the port doesn't have a duplicate ID
for (PortWidget *input2 : inputs) {
assert(input->portId != input2->portId);
}
// Add port
inputs.push_back(input);
addChild(input);
}


Loading…
Cancel
Save