///High level test: simple node connections test TEST_F(BaseTest,SimpleNodeConnections) { ///create the generator NodePtr generator = createNode(_dotGeneratorPluginID); ///create the writer and set its output filename NodePtr writer = createNode(_writeOIIOPluginID); ASSERT_TRUE(writer && generator); connectNodes(generator, writer, 0, true); connectNodes(generator, writer, 0, false); //< expect it to fail disconnectNodes(generator, writer, true); disconnectNodes(generator, writer, false); connectNodes(generator, writer, 0, true); }
void GraphViewer::paint(Graphics& g) { g.fillAll(Colours::darkgrey); g.setFont(labelFont); g.setFont(50); g.setColour(Colours::grey); JUCEApplication* app = JUCEApplication::getInstance(); String text = "GUI version "; text += app->getApplicationVersion(); g.drawFittedText("open ephys", 40, 40, getWidth()-50, getHeight()-60, Justification::bottomRight, 100); g.setFont(Font("Small Text", 14, Font::plain)); g.drawFittedText(text, 40, 40, getWidth()-50, getHeight()-45, Justification::bottomRight, 100); // draw connections for (int i = 0; i < availableNodes.size(); i++) { if (!availableNodes[i]->isSplitter()) { if (availableNodes[i]->getDest() != nullptr) { int indexOfDest = indexOfEditor(availableNodes[i]->getDest()); if (indexOfDest > -1) connectNodes(i, indexOfDest, g); } } else { Array<GenericEditor*> editors = availableNodes[i]->getConnectedEditors(); for (int path = 0; path < 2; path++) { int indexOfDest = indexOfEditor(editors[path]); if (indexOfDest > -1) connectNodes(i, indexOfDest, g); } } } }
MStatus polyModifierCmd::doModifyPoly() { MStatus status = MS::kFailure; if( isCommandDataValid() ) { // Get the state of the polyMesh // collectNodeState(); if( !fHasHistory && !fHasRecordHistory ) { MObject meshNode = fDagPath.node(); // Pre-process the mesh - Cache old mesh (including tweaks, if applicable) // cacheMeshData(); cacheMeshTweaks(); // Call the directModifier // status = directModifier( meshNode ); } else { MObject modifierNode; createModifierNode( modifierNode ); initModifierNode( modifierNode ); status = connectNodes( modifierNode ); } } return status; }
void GameConsole::unloadLibretro() { qCDebug( phxControl ) << Q_FUNC_INFO; for( QMetaObject::Connection connection : sessionConnections ) { disconnect( connection ); } sessionConnections.clear(); // Restore global pipeline connections severed by the Libretro pipeline connectNodes( phoenixWindow, microTimer ); connectNodes( remapper, sdlUnloader ); if( quitFlag ) { gameThread->quit(); } }
void GraphViewer::paint (Graphics& g) { g.fillAll (Colours::darkgrey); g.setFont (FONT_LABEL); g.setColour (Colours::grey); g.drawFittedText ("open ephys", 40, 40, getWidth()-50, getHeight()-60, Justification::bottomRight, 100); g.setFont (FONT_VERSION); g.drawFittedText (currentVersionText, 40, 40, getWidth()-50, getHeight()-45, Justification::bottomRight, 100); // Draw connections const int numAvailableNodes = availableNodes.size(); for (int i = 0; i < numAvailableNodes; ++i) { if (! availableNodes[i]->isSplitter()) { if (availableNodes[i]->getDest() != nullptr) { int indexOfDest = getIndexOfEditor (availableNodes[i]->getDest()); if (indexOfDest > -1) connectNodes (i, indexOfDest, g); } } else { Array<GenericEditor*> editors = availableNodes[i]->getConnectedEditors(); for (int path = 0; path < 2; ++path) { int indexOfDest = getIndexOfEditor (editors[path]); if (indexOfDest > -1) connectNodes (i, indexOfDest, g); } } } }
void Monitor::NodeGenerator::draw(QGraphicsScene *nodeScene) { nMap_.clear(); generate(root_, nodeScene, 0, 0); connectNodes(nodeScene); // reset scene size. this doesn't happen automatically nodeScene->setSceneRect(nodeScene->itemsBoundingRect()); }
void GraphTranslator::makeBigBang() { for (size_type i = 0; i < mNodeNumber; ++i){ std::string name = (boost::format("%1%-%2%") % mPrefix % i).str(); createNewNode(name, mClass[i]); } for (size_type i = 0; i < mNodeNumber; ++i) { for (size_type j = 0; j < mNodeNumber; ++j) { if (mGraph[j][i]) { connectNodes(j, i); } } } }
void GameConsole::loadLibretro() { // Ensure that the properties were set in QML Q_ASSERT_X( controlOutput, "libretro load", "controlOutput was not set!" ); Q_ASSERT_X( videoOutput, "libretro load", "videoOutput was not set!" ); Q_ASSERT_X( variableModel, "libretro load", "variableModel was not set!" ); // Disconnect PhoenixWindow from MicroTimer, insert libretroLoader in between disconnectNodes( phoenixWindow, microTimer ); sessionConnections << connectNodes( phoenixWindow, libretroLoader ); sessionConnections << connectNodes( libretroLoader, microTimer ); // Disconnect SDLRunner from Remapper, it'll get inserted after LibretroRunner disconnectNodes( remapper, sdlUnloader ); // Connect LibretroVariableForwarder to the global pipeline sessionConnections << connectNodes( remapper, libretroVariableForwarder ); sessionConnections << connectNodes( libretroVariableForwarder, libretroRunner ); // Connect LibretroRunner to its children sessionConnections << connectNodes( libretroRunner, audioOutput ); sessionConnections << connectNodes( libretroRunner, sdlUnloader ); // It's very important that ControlOutput is always connected via a queued connection as things that handle // state changes (things that listen to ControlOutput) should not be at the top of a stack that contains // the function calls that changed the state in the first place. This only really applies when we're single-threaded. sessionConnections << connectNodes( libretroRunner, controlOutput, Qt::QueuedConnection ); sessionConnections << connectNodes( libretroRunner, videoOutput ); // Hook LibretroCore so we know when commands have reached it // We can't hook ControlOutput as it lives on the main thread and if it's time to quit the main thread's event loop is dead // We care about this happening as LibretroCore needs to save its running game before quitting sessionConnections << connect( libretroRunner, &Node::commandOut, libretroRunner, [ & ]( Command command, QVariant, qint64 ) { switch( command ) { case Command::Stop: { unloadLibretro(); break; } default: { break; } } } ); }
///High level test: render 1 frame of dot generator TEST_F(BaseTest, GenerateDot) { ///create the generator NodePtr generator = createNode(_generatorPluginID); ///create the writer and set its output filename NodePtr writer = createNode(_writeOIIOPluginID); ASSERT_TRUE(generator && writer); KnobIPtr frameRange = generator->getApp()->getProject()->getKnobByName("frameRange"); ASSERT_TRUE(frameRange); KnobIntPtr knob = toKnobInt(frameRange); ASSERT_TRUE(knob); knob->setValue(1, ViewSpec::all(), 0); knob->setValue(1, ViewSpec::all(), 1); Format f(0, 0, 200, 200, "toto", 1.); generator->getApp()->getProject()->setOrAddProjectFormat(f); const QString& binPath = appPTR->getApplicationBinaryPath(); QString filePath = binPath + QString::fromUtf8("/test_dot_generator.jpg"); writer->setOutputFilesForWriter( filePath.toStdString() ); ///attempt to connect the 2 nodes together connectNodes(generator, writer, 0, true); ///and start rendering. This call is blocking. std::list<AppInstance::RenderWork> works; AppInstance::RenderWork w; w.writer = toOutputEffectInstance( writer->getEffectInstance() ); assert(w.writer); w.firstFrame = INT_MIN; w.lastFrame = INT_MAX; w.frameStep = INT_MIN; w.useRenderStats = false; works.push_back(w); getApp()->startWritersRendering(false, works); EXPECT_TRUE( QFile::exists(filePath) ); QFile::remove(filePath); }
void causalgraph::computeLinks(std::vector<recyclegate*> operationOrder) { for(std::list<recyclegate*>::iterator it = tmpCircuit.begin(); it != tmpCircuit.end(); it++) { (*it)->willPush.clear(); (*it)->pushedBy.clear(); } std::map<wireelement*, recyclegate*> lastSeen; // int lines = getRoots().size(); std::vector<recyclegate*> roots = getRoots(); for(size_t i = 0; i < roots.size(); i++) { lastSeen[roots[i]->wirePointers[0]] = NULL; //the ids of the inputs } for(std::vector<recyclegate*>::iterator itOperation = operationOrder.begin(); itOperation != operationOrder.end(); itOperation++) { //ce cauta nrWire aici? int nrWire = 0; for(std::vector<wireelement*>::iterator itWire = (*itOperation)->wiresToUseForLinks.begin(); itWire != (*itOperation)->wiresToUseForLinks.end(); itWire++) { //if(*itWire < lines) // { if(lastSeen[*itWire] != NULL) { //the same wire for both gates // connectNodes(*itWire, *itWire, lastSeen[*itWire], *itOperationId); connectNodes(-1, nrWire, lastSeen[*itWire], *itOperation); } lastSeen[*itWire] = *itOperation; nrWire++; // } } } }
void PathGraph::readObject(IffStream* iffStream) { iffStream->openForm('PGRF'); iffStream->openForm('0001'); iffStream->openChunk('META'); unkownMetaInt = iffStream->getInt(); iffStream->closeChunk('META'); iffStream->openChunk('PNOD'); int nodesSize = iffStream->getInt(); for (int i = 0; i < nodesSize; ++i) { PathNode* pathNode = new PathNode(this); pathNode->readObject(iffStream); pathNodes.add(pathNode); } iffStream->closeChunk('PNOD'); iffStream->openChunk('PEDG'); //Vector<PathEdge> pathEdges; int pathEdgeSize = iffStream->getInt(); for (int i = 0; i < pathEdgeSize; ++i) { PathEdge* pathEdge = new PathEdge(); pathEdge->readObject(iffStream); pathEdges.add(pathEdge); } iffStream->closeChunk('PEDG'); iffStream->openChunk('ECNT'); int ecntSize = iffStream->getInt(); for (int i = 0; i < ecntSize; ++i) { ecnt.add(iffStream->getInt()); } iffStream->closeChunk('ECNT'); iffStream->openChunk('ESTR'); int estrSize = iffStream->getInt(); for (int i = 0; i < estrSize; ++i) { estr.add(iffStream->getInt()); } iffStream->closeChunk('ESTR'); iffStream->closeForm('0001'); iffStream->closeForm('PGRF'); connectNodes(); }
void PathGraph::readObject(IffStream* iffStream) { iffStream->openForm('PGRF'); iffStream->openForm('0001'); iffStream->openChunk('META'); type = static_cast<PathGraphType>(iffStream->getInt()); iffStream->closeChunk('META'); iffStream->openChunk('PNOD'); int nodesSize = iffStream->getInt(); for (int i = 0; i < nodesSize; ++i) { PathNode* pathNode = new PathNode(this); pathNode->readObject(iffStream); pathNodes.add(pathNode); } iffStream->closeChunk('PNOD'); iffStream->openChunk('PEDG'); Vector<PathEdge> pathEdges; int pathEdgeSize = iffStream->getInt(); for (int i = 0; i < pathEdgeSize; ++i) { PathEdge pathEdge; pathEdge.readObject(iffStream); pathEdges.add(pathEdge); } iffStream->closeChunk('PEDG'); iffStream->openChunk('ECNT'); int ecntSize = iffStream->getInt(); for (int i = 0; i < ecntSize; ++i) { edgeCounts.add(iffStream->getInt()); } iffStream->closeChunk('ECNT'); iffStream->openChunk('ESTR'); int estrSize = iffStream->getInt(); for (int i = 0; i < estrSize; ++i) { edgeStarts.add(iffStream->getInt()); } iffStream->closeChunk('ESTR'); iffStream->closeForm('0001'); iffStream->closeForm('PGRF'); connectNodes(pathEdges); }
void InputLayerItem::connectLayerTo( const LayerItem *layer ) { foreach( MIMONeuronItem *neuron, layer->neurons() ) connectNodes( m_nodes, neuron->nodes() ); }
GameConsole::GameConsole( Node *parent ) : Node( parent ), gameThread( new QThread ), // Global pipeline microTimer( new MicroTimer ), remapper( new Remapper ), sdlManager( new SDLManager ), sdlUnloader( new SDLUnloader ), // Dynamic pipeline audioOutput( new AudioOutput ), libretroLoader( new LibretroLoader ), libretroRunner( new LibretroRunner ), libretroVariableForwarder( new LibretroVariableForwarder ) { // Move all our stuff to the game thread audioOutput->moveToThread( gameThread ); libretroLoader->moveToThread( gameThread ); libretroRunner->moveToThread( gameThread ); libretroVariableForwarder->moveToThread( gameThread ); microTimer->moveToThread( gameThread ); remapper->moveToThread( gameThread ); sdlManager->moveToThread( gameThread ); sdlUnloader->moveToThread( gameThread ); gameThread->setObjectName( "Game thread" ); gameThread->start(); // Connect global pipeline (at least the parts that can be connected at this point) connectNodes( microTimer, sdlManager ); connectNodes( sdlManager, remapper ); connectNodes( remapper, sdlUnloader ); connect( this, &GameConsole::remapperModelChanged, this, [ & ] { if( remapperModel ) { qCDebug( phxControl ) << "RemapperModel" << Q_FUNC_INFO << globalPipelineReady(); remapperModel->setRemapper( remapper ); checkIfGlobalPipelineReady(); } } ); // Connect VariableModel (which lives in QML) to LibretroVariableForwarder as soon as it's set connect( this, &GameConsole::variableModelChanged, this, [ & ] { if( variableModel ) { qCDebug( phxControl ) << "VariableModel" << Q_FUNC_INFO << globalPipelineReady(); variableModel->setForwarder( libretroVariableForwarder ); checkIfGlobalPipelineReady(); } } ); // Connect GlobalGamepad (which lives in QML) to the global pipeline as soon as it's set connect( this, &GameConsole::globalGamepadChanged, this, [ & ]() { if( globalGamepad ) { qCDebug( phxControl ) << "GlobalGamepad" << Q_FUNC_INFO << globalPipelineReady(); connectNodes( remapper, globalGamepad ); checkIfGlobalPipelineReady(); } } ); // Connect PhoenixWindow (which lives in QML) to the global pipeline as soon as it's set connect( this, &GameConsole::phoenixWindowChanged, this, [ & ]() { if( phoenixWindow ) { qCDebug( phxControl ) << "PhoenixWindow" << Q_FUNC_INFO << globalPipelineReady(); connectNodes( this, phoenixWindow ); connectNodes( phoenixWindow, microTimer ); checkIfGlobalPipelineReady(); } } ); // Handle app quitting connect( QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [ = ]() { qDebug() << ""; qCInfo( phxControl ) << ">>>>>>>> User requested app to close, shutting down (waiting up to 30 seconds)..."; qDebug() << ""; // Tell the pipeline to stop if loaded if( dynamicPipelineReady() ) { quitFlag = true; emit commandOut( Command::Stop, QVariant(), nodeCurrentTime() ); } else { qCInfo( phxControl ) << "No core loaded"; gameThread->quit(); } // Wait up to 30 seconds to let the pipeline finish its events if( gameThread != QThread::currentThread() ) { gameThread->wait( 30 * 1000 ); gameThread->deleteLater(); } // Destroy our global pipeline objects *from the bottom up* (depending on core type) if( source[ "type" ] == QStringLiteral( "libretro" ) || pendingPropertyChanges[ "source" ].toMap()[ "type" ] == QStringLiteral( "libretro" ) ) { deleteLibretro(); } // Send a second set of delete calls for all other objects (redundant calls will be ignored) deleteMembers(); qDebug() << ""; qCInfo( phxControl ) << ">>>>>>>> Fully unloaded!"; qDebug() << ""; } ); connect( this, &GameConsole::userDataLocationChanged, this, [ & ] { emit commandOut( Command::SetUserDataPath, userDataLocation, nodeCurrentTime() ); } ); }
void MIMONeuronItem::connectNeuronTo( const MIMONeuronItem *neuron ) { connectNodes( m_nodes, neuron->nodes() ); }
void MIMONeuronItem::connectNeuronFrom( const MIMONeuronItem *neuron ) { connectNodes( neuron->nodes(), m_nodes ); }
PeepHoleOpt::Changed PeepHoleOpt::handleInst_Convert_F2I_D2I(Inst* inst) { // // Inline 'int_value = (int)(float_value or double_value)' // Opnd* dst = inst->getOpnd(0); Opnd* src = inst->getOpnd(2); Type* srcType = src->getType(); assert(srcType->isSingle() || srcType->isDouble()); assert(dst->getType()->isInt4()); const bool is_dbl = srcType->isDouble(); // Here, we might have to deal with 3 cases with src (_value): // 1. Unassigned operand - act as if were operating with XMM // 2. Assigned to FPU - convert to FPU operations, to // avoid long FPU->mem->XMM chain // 3. Assigned to XMM - see #1 const bool xmm_way = !(src->hasAssignedPhysicalLocation() && src->isPlacedIn(OpndKind_FPReg)); if (!xmm_way) { //TODO: will add FPU later if measurements show it worths trying return Changed_Nothing; } // // /* movss xmm0, val // presuming the corner cases (NaN, overflow) // normally happen rare, do conversion first, // and check for falls later -- convertNode cvttss2si eax, xmm0 -- ovfTestNode // did overflow happen ? cmp eax, 0x80000000 jne _done // no - go return result -- testAgainstZeroNode // test SRC against zero comiss xmm0, [fp_zero] // isNaN ? jp _nan // yes - go load 0 -- testIfBelowNode // xmm < 0 ? jb _done // yes - go load MIN_INT. EAX already has it - simply return. -- loadMaxIntNode // ok. at this point, XMM is positive and > MAX_INT // must load MAX_INT which is 0x7fffffff. // As EAX has 0x80000000, then simply substract 1 sub eax, 1 jmp _done -- loadZeroNode _nan: xor eax, eax -- nodeNode _done: mov result, eax } */ Opnd* fpZeroOpnd = getZeroConst(srcType); Type* int32type = irManager->getTypeManager().getInt32Type(); Opnd* oneOpnd = irManager->newImmOpnd(int32type, 1); Opnd* intZeroOpnd = getIntZeroConst(); // 0x8..0 here is not the INT_MIN, but comes from the COMISS // opcode description instead. Opnd* minIntOpnd = irManager->newImmOpnd(int32type, 0x80000000); newSubGFG(); Node* entryNode = getSubCfgEntryNode(); Node* convertNode = newBB(); Node* ovfTestNode = newBB(); Node* testAgainstZeroNode = newBB(); Node* testIfBelowNode = newBB(); Node* loadMaxIntNode = newBB(); Node* loadZeroNode = newBB(); Node* doneNode = newBB(); // // presuming the corner cases (NaN, overflow) // normally happen rare, do conversion first, // and check for falls later // connectNodes(entryNode, convertNode); // // convert // setCurrentNode(convertNode) ; Mnemonic mn_cvt = is_dbl ? Mnemonic_CVTTSD2SI : Mnemonic_CVTTSS2SI; /*cvttss2si r32, xmm*/ newInst(mn_cvt, 1, dst, src); connectNodeTo(ovfTestNode); setCurrentNode(NULL); // // check whether overflow happened // setCurrentNode(ovfTestNode); /*cmp r32, MIN_INT*/ newInst(Mnemonic_CMP, dst, minIntOpnd); /*jne _done */ newBranch(Mnemonic_JNE, doneNode, testAgainstZeroNode, 0.9, 0.1); // setCurrentNode(NULL); // test SRC against zero // setCurrentNode(testAgainstZeroNode); Mnemonic mn_cmp = is_dbl ? Mnemonic_UCOMISD : Mnemonic_UCOMISS; /*comiss src, 0. */ newInst(mn_cmp, src, fpZeroOpnd); /*jp _nan:result=0*/ newBranch(Mnemonic_JP, loadZeroNode, testIfBelowNode); setCurrentNode(NULL); // // // setCurrentNode(loadZeroNode); /*mov r32, 0*/ newInst(Mnemonic_MOV, dst, intZeroOpnd); /*jmp _done*/ connectNodeTo(doneNode); setCurrentNode(NULL); // // test if we have a huge negative in SRC // setCurrentNode(testIfBelowNode); /*jb _done:*/ newBranch(Mnemonic_JB, doneNode, loadMaxIntNode); setCurrentNode(NULL); // // // setCurrentNode(loadMaxIntNode); /* sub dst, 1*/ newInst(Mnemonic_SUB, dst, oneOpnd); connectNodeTo(doneNode); setCurrentNode(NULL); // connectNodes(doneNode, getSubCfgReturnNode()); // propagateSubCFG(inst); return Changed_Node; }
// -------------------------------------------------------------------------------------------- MStatus polyModifierCmd::doModifyPoly() // -------------------------------------------------------------------------------------------- { MStatus status = MS::kFailure; if( isCommandDataValid() ) { // Get the state of the polyMesh // collectNodeState(); if( !fHasHistory && !fHasRecordHistory ) { MObject meshNode = fDagPath.node(); // Pre-process the mesh - Cache old mesh (including tweaks, if applicable) // cacheMeshData(); cacheMeshTweaks(); // Call the directModifier // status = directModifier( meshNode ); } else { MObject modifierNode; createModifierNode( modifierNode ); initModifierNode( modifierNode ); status = connectNodes( modifierNode ); MFnDependencyNode depNodeFn(modifierNode); MString newName; getModifierUINodeName(newName); depNodeFn.setName(newName); //jetzt noch die customAttributes nonKeyable machen //koennte zu fehlern führen bei undo und redo ->tuts aber nicht :) if(createAnimCurves) {//diese Attribute koennen nur gesetzt werden, wenn eine BPTNode erstellt wird depNodeFn.findPlug("customSlFalloff").setKeyable(false); } // Selection vorher frei machen, weil unter umstnden noch eine parameter gewhlt war, welcher // dann verhindert, dass die Channelbox den neuen anzeigt // MGlobal::clearSelectionList(); //jetzt die Node auf die SelectionList setzen/hinzufügen MGlobal::select(modifierNode); } } return status; }
void SubCfgBuilderUtils::connectNodeTo(Node* to) { connectNodes(m_currNode, to); }