Esempio n. 1
0
bool CNode::connect(QString output_name, const CNode &target, QString input_name)
{
    auto src_gate = findOutputGate(output_name);
    if(src_gate.isNull()) {
        qWarning() << "Could not find gate"
                   << output_name << "in output Node" << m_config.getName() << ".";
        return false;
    }

    auto dest_gate = target.findInputGate(input_name);
    if(dest_gate.isNull()) {
        qWarning() << "Could not find gate"
                   << input_name << "in input Node"
                   << target.m_config.getName() << ".";
        return false;
    }

    // Link the output of the src gate with the dest gate of another node.
    if(!src_gate->link(dest_gate)) {
        qWarning() << "Could not connect nodes."
                   << "(" << m_config.getName() << ") -> ("
                   << target.m_config.getName() << ").";
        return false;
    }
    return true;
}