void Controller::Peripheral::checkMove(gdl::Input& input) { if (_joy == NULL && _save == NULL) checkKeys(input); else { SDL_JoystickUpdate(); checkButtons(); if (checkAxes() == false) checkHat(); } }
/** * @brief CompareWorkspaces::doComparison */ void CompareWorkspaces::doComparison() { Workspace_sptr w1 = getProperty("Workspace1"); Workspace_sptr w2 = getProperty("Workspace2"); // ============================================================================== // Peaks workspaces // ============================================================================== // Check that both workspaces are the same type IPeaksWorkspace_sptr pws1 = boost::dynamic_pointer_cast<IPeaksWorkspace>(w1); IPeaksWorkspace_sptr pws2 = boost::dynamic_pointer_cast<IPeaksWorkspace>(w2); if ((pws1 && !pws2) || (!pws1 && pws2)) { recordMismatch("One workspace is a PeaksWorkspace and the other is not."); return; } // Check some peak-based stuff if (pws1 && pws2) { doPeaksComparison(pws1, pws2); return; } // ============================================================================== // Table workspaces // ============================================================================== // Check that both workspaces are the same type auto tws1 = boost::dynamic_pointer_cast<const ITableWorkspace>(w1); auto tws2 = boost::dynamic_pointer_cast<const ITableWorkspace>(w2); if ((tws1 && !tws2) || (!tws1 && tws2)) { recordMismatch("One workspace is a TableWorkspace and the other is not."); return; } if (tws1 && tws2) { doTableComparison(tws1, tws2); return; } // ============================================================================== // MD workspaces // ============================================================================== // Check things for IMDEventWorkspaces IMDEventWorkspace_const_sptr mdews1 = boost::dynamic_pointer_cast<const IMDEventWorkspace>(w1); IMDEventWorkspace_const_sptr mdews2 = boost::dynamic_pointer_cast<const IMDEventWorkspace>(w2); if ((mdews1 && !mdews2) || (!mdews1 && mdews2)) { recordMismatch( "One workspace is an IMDEventWorkspace and the other is not."); return; } // Check things for IMDHistoWorkspaces IMDHistoWorkspace_const_sptr mdhws1 = boost::dynamic_pointer_cast<const IMDHistoWorkspace>(w1); IMDHistoWorkspace_const_sptr mdhws2 = boost::dynamic_pointer_cast<const IMDHistoWorkspace>(w2); if ((mdhws1 && !mdhws2) || (!mdhws1 && mdhws2)) { recordMismatch( "One workspace is an IMDHistoWorkspace and the other is not."); return; } if (mdhws1 || mdews1) // The '2' workspaces must match because of the checks above { this->doMDComparison(w1, w2); return; } // ============================================================================== // Event workspaces // ============================================================================== // These casts must succeed or there's a logical problem in the code MatrixWorkspace_const_sptr ws1 = boost::dynamic_pointer_cast<const MatrixWorkspace>(w1); MatrixWorkspace_const_sptr ws2 = boost::dynamic_pointer_cast<const MatrixWorkspace>(w2); EventWorkspace_const_sptr ews1 = boost::dynamic_pointer_cast<const EventWorkspace>(ws1); EventWorkspace_const_sptr ews2 = boost::dynamic_pointer_cast<const EventWorkspace>(ws2); if (getProperty("CheckType")) { if ((ews1 && !ews2) || (!ews1 && ews2)) { recordMismatch( "One workspace is an EventWorkspace and the other is not."); return; } } size_t numhist = ws1->getNumberHistograms(); if (ews1 && ews2) { m_Prog = new Progress(this, 0.0, 1.0, numhist * 5); // Compare event lists to see whether 2 event workspaces match each other if (!compareEventWorkspaces(ews1, ews2)) return; } else { // Fewer steps if not events m_Prog = new Progress(this, 0.0, 1.0, numhist * 2); } // ============================================================================== // Matrix workspaces (Event & 2D) // ============================================================================== // First check the data - always do this if (!checkData(ws1, ws2)) return; // Now do the other ones if requested. Bail out as soon as we see a failure. m_Prog->reportIncrement(numhist / 5, "Axes"); if (static_cast<bool>(getProperty("CheckAxes")) && !checkAxes(ws1, ws2)) return; m_Prog->reportIncrement(numhist / 5, "SpectraMap"); if (static_cast<bool>(getProperty("CheckSpectraMap")) && !checkSpectraMap(ws1, ws2)) return; m_Prog->reportIncrement(numhist / 5, "Instrument"); if (static_cast<bool>(getProperty("CheckInstrument")) && !checkInstrument(ws1, ws2)) return; m_Prog->reportIncrement(numhist / 5, "Masking"); if (static_cast<bool>(getProperty("CheckMasking")) && !checkMasking(ws1, ws2)) return; m_Prog->reportIncrement(numhist / 5, "Sample"); if (static_cast<bool>(getProperty("CheckSample"))) { if (!checkSample(ws1->sample(), ws2->sample())) return; if (!checkRunProperties(ws1->run(), ws2->run())) return; } }