コード例 #1
0
ファイル: ProcessorGraph.cpp プロジェクト: aacuevas/GUI
void* ProcessorGraph::createNewProcessor(String& description)//,
// GenericProcessor* source,
// GenericProcessor* dest)
{

    GenericProcessor* processor = createProcessorFromDescription(description);

    int id = currentNodeId++;

    if (processor != 0)
    {

        processor->setNodeId(id); // identifier within processor graph
        std::cout << "  Adding node to graph with ID number " << id << std::endl;

        processor->setUIComponent(getUIComponent()); // give access to important pointers

        addNode(processor,id); // have to add it so it can be deleted by the graph

        return processor->createEditor();

    }
    else
    {

        sendActionMessage("Not a valid processor type.");

        return 0;
    }

}
コード例 #2
0
ファイル: ProcessorGraph.cpp プロジェクト: ArmandNM/GUI
void* ProcessorGraph::createNewProcessor(String& description, int id)//,

{

    GenericProcessor* processor = 0;
    try // Try/catch block added by Michael Borisov
    {
        processor = createProcessorFromDescription(description);
    }
    catch (std::exception& e)
    {
        NativeMessageBox::showMessageBoxAsync(AlertWindow::WarningIcon, "OpenEphys", e.what());
    }

    // int id = currentNodeId++;

    if (processor != 0)
    {

        processor->setNodeId(id); // identifier within processor graph
        std::cout << "  Adding node to graph with ID number " << id << std::endl;
        std::cout << std::endl;
        std::cout << std::endl;

        addNode(processor,id); // have to add it so it can be deleted by the graph

		if (processor->isSource())
		{
			// by default, all source nodes record automatically
			processor->setAllChannelsToRecord();
			if (processor->generatesTimestamps())
			{
				getMessageCenter()->addSourceProcessor(processor);
				if (getMessageCenter()->getSourceNodeId() == 0)
				{
					getMessageCenter()->setSourceNodeId(processor->getNodeId());
				}
			}
		}

        return processor->createEditor();

    }
    else
    {

        CoreServices::sendStatusMessage("Not a valid processor type.");

        return 0;
    }

}
コード例 #3
0
void* ProcessorGraph::createNewProcessor(Array<var>& description, int id)//,
{
	GenericProcessor* processor = 0;
	try {// Try/catch block added by Michael Borisov
		processor = createProcessorFromDescription(description);
	}
	catch (std::exception& e) {
		NativeMessageBox::showMessageBoxAsync(AlertWindow::WarningIcon, "OpenEphys", e.what());
	}

	// int id = currentNodeId++;

	if (processor != 0)
	{
		processor->setNodeId(id); // identifier within processor graph
		std::cout << "  Adding node to graph with ID number " << id << std::endl;
		std::cout << std::endl;
		std::cout << std::endl;
		addNode(processor,id); // have to add it so it can be deleted by the graph

		if (processor->isSource())
		{
			// by default, all source nodes record automatically
			processor->setAllChannelsToRecord();
			if (processor->isGeneratesTimestamps())
			{ //If there are no source processors and we add one, set it as default for global timestamps and samplerates
				m_validTimestampSources.add(processor);
				if (m_timestampSource == nullptr)
				{
					m_timestampSource = processor;
					m_timestampSourceSubIdx = 0;
				}
				if (m_timestampWindow)
					m_timestampWindow->updateProcessorList();
			}
		}
		return processor->createEditor();
	}
	else
	{
		CoreServices::sendStatusMessage("Not a valid processor type.");
		return 0;
	}
}