当前位置: 首页>>代码示例>>C++>>正文


C++ Port::connect方法代码示例

本文整理汇总了C++中Port::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::connect方法的具体用法?C++ Port::connect怎么用?C++ Port::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Port的用法示例。


在下文中一共展示了Port::connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Module

Host::Host(std::string name, size_t portNumber, NetworkSystem* system) : Module(system), NetworkModule(name, system), NetworkLog(system)
{
	size_t k;
	allPort.clear();
	for(k=0; k<portNumber; k++)
	{
		char nameBuffer[1024];
		snprintf(nameBuffer, sizeof(nameBuffer), "%s's port[%lu]", name.c_str(), k);
		Port* newPort = new Port(std::string(nameBuffer), system);
		newPort->connect(this);
		allPort.push_back(newPort);
	}
	this->pidStart = 0;
	this->syscallIDStart = 0;
	this->defaultInterface = new DefaultSystemCall(this);
	this->running = true;
}
开发者ID:HyeongiKim,项目名称:Introduction_to_Network_KENSv3,代码行数:17,代码来源:E_Host.cpp

示例2: getComponentIntersection

	// Called when in connection mode
	void
	FlowDesigner::handleConnectionClick(QMouseEvent *event) {
		float x = event->x();
		float y = event->y();

		Component *comp = getComponentIntersection(x, y);

		Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
		if (comp != NULL) {
			Port *port = getPortIntersection(comp, x, y);

			if (port && m_connectingPort) {
				// Connect the two
				port->connect(m_connectingPort);
			}
		}

		// Stop the connection
		m_connectingPort = NULL;
		repaint();
	}
开发者ID:pfrommerd,项目名称:vlab,代码行数:22,代码来源:FlowDesigner.cpp

示例3: addPlugin

/// TODO: This code can be simplified.  Make a PortContainer class.
/// Plugin and Patch can inherit from PortContainer.  We can have a
/// pseudo-PortContainer here to represent the input and output ports
/// Then, all adds/removals will be symetric
/// ^^^: Or, just wrap Plugin and BackendPorts with a class that acts this way
void FxLine::addPlugin(const PluginInfoPtr info, int pos)
{
    int idx = pos + 1;
    int pluginCnt = m_entries.length() - 2;

    // Check for proper position value. TODO: Report error, not fatal
    Q_ASSERT(pos <= pluginCnt);

    // Create the plugin. TODO: Report error, not fatal
    Plugin *plugin = info->createPlugin(48000);
    Q_ASSERT(plugin);

    plugin->activate(Engine::bufferProvider());
    m_parent.add(plugin);

    // Verify number of ports. TODO: Report error, not fatal
    Q_ASSERT(plugin->audioInputCount() == 2);
    Q_ASSERT(plugin->audioOutputCount() == 2);

    // Collect ports.
    Entry entry;
    entry.plugin = plugin;
    collectPorts(plugin, &entry.inputPorts, &entry.outputPorts);
    Q_ASSERT(entry.inputPorts.length() == 2);
    Q_ASSERT(entry.outputPorts.length() == 2);

    /*
    if (m_plugins.length() == 0) {
      // If there are no plugins, we disconnect the backend ports from each
      // other. Then, we connect the plugin in-between the backend ports

      // TODO: Bring back once backend ports have patch?
      // m_inPorts[0]->disconnect(m_outPorts[0]);
      // m_inPorts[1]->disconnect(m_outPorts[1]);

      m_inPorts[0]->connect(pluginIn.at(0));
      m_inPorts[1]->connect(pluginIn.at(1));

      m_outPorts[0]->connect(pluginOut.at(0));
      m_outPorts[1]->connect(pluginOut.at(1));
    }
    else if (pos < m_plugins.length()) {
    */
    // At this point, there is at least one plugin already in the line, and we
    // are trying to insert the new plugin before another one.
    Entry producer = m_entries.value(idx-1);
    Entry consumer = m_entries.value(idx);

    qWarning() << "FX LINE ADD producer port count:" << producer.outputPorts.count();
    for (int i=0; i<producer.outputPorts.count(); ++i) {
        Port *producerPort = producer.outputPorts.at(i);
        Port *consumerPort = consumer.inputPorts.at(i);

        // Work around:
        if (producerPort->parentPatch() == NULL && consumerPort->parentPatch() == NULL) {
            qWarning("Probably disconnecting two backend-ports. Ignoring");
        }
        else {
            producerPort->disconnect(consumerPort);
        }
        qWarning() << "FX: Connecting: " << producerPort->name() << " TO " << entry.inputPorts.at(i)->name();
        qWarning() << "FX: and Connecting: " << consumerPort->name() << " TO " << entry.outputPorts.at(i)->name();
        producerPort->connect(entry.inputPorts.at(i));
        consumerPort->connect(entry.outputPorts.at(i));
    }

    m_entries.insert(idx, entry);
}
开发者ID:apathadeus,项目名称:unison,代码行数:73,代码来源:FxLine.cpp


注:本文中的Port::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。