const std::string *WEnvironment::getParameter(const std::string& name) const { const Http::ParameterValues& values = getParameterValues(name); if (!Utils::isEmpty(values)) return &values[0]; else return 0; }
Value Rm::doExecute () { RosSubscribe& entity = static_cast<RosSubscribe&> (owner ()); std::vector<Value> values = getParameterValues (); const std::string& signal = values[0].value (); entity.rm (signal); return Value (); }
QStringList CMDLineRegistryUtils::getParameterValuesByWords( const QString & paramName, int startWith ) { QStringList words; QStringList res = getParameterValues( paramName, startWith ); QStringList::const_iterator it = res.constBegin(); while( it != res.constEnd() ) { words << it->split( QRegExp("\\s"), QString::SkipEmptyParts ); ++it; } return words; }
void initialise(const String& commandLineParameters) { Logger::writeToLog("CTRLR:initialise params \""+commandLineParameters+"\""); SystemStats::setApplicationCrashHandler (&CtrlrApplication::crashHandler); if (!commandLineParameters.isEmpty()) { String stackTrace = "?"; StringArray parameters = getParameters(commandLineParameters); StringArray parameterValues = getParameterValues(commandLineParameters); if (parameters.contains("crashReport")) { File crashReportForExec(parameterValues[parameters.indexOf("crashReport")]); File crashReportFile(crashReportForExec.withFileExtension(crashReportForExec.getFileExtension()+".crash")); AlertWindow crashReport("Ctrlr has crashed", "This is a crash indicator, it means that Ctrlr has crashed for some reason. Some crash information will be written to: "+crashReportFile.getFullPathName(), AlertWindow::WarningIcon); if (parameters.contains("stackTrace")) { if (!parameterValues[parameters.indexOf("stackTrace")].isEmpty()) { MemoryBlock mb; mb.fromBase64Encoding(parameterValues[parameters.indexOf("stackTrace")]); stackTrace = mb.toString(); crashReport.addTextBlock (stackTrace); } } crashReport.addButton ("OK", 1, KeyPress (KeyPress::returnKey)); crashReport.runModalLoop(); crashReportFile.replaceWithText ("Ctrlr crash at: "+Time::getCurrentTime().toString(true, true, true, true) + "\nStack trace:\n"+stackTrace); JUCEApplication::quit(); } } filterWindow = new CtrlrStandaloneWindow (ProjectInfo::projectName + String("/") + ProjectInfo::versionString, Colours::lightgrey); if (File::isAbsolutePath(commandLineParameters.unquoted())) filterWindow->openFileFromCli (File(commandLineParameters.unquoted())); }
Value Add::doExecute () { RosSubscribe& entity = static_cast<RosSubscribe&> (owner ()); std::vector<Value> values = getParameterValues (); const std::string& type = values[0].value (); const std::string& signal = values[1].value (); const std::string& topic = values[2].value (); if (type == "double") entity.add<double> (signal, topic); else if (type == "unsigned") entity.add<unsigned int> (signal, topic); else if (type == "matrix") entity.add<ml::Matrix> (signal, topic); else if (type == "vector") entity.add<ml::Vector> (signal, topic); else if (type == "vector3") entity.add<specific::Vector3> (signal, topic); else if (type == "vector3Stamped") entity.add<std::pair<specific::Vector3, ml::Vector> > (signal, topic); else if (type == "matrixHomo") entity.add<sot::MatrixHomogeneous> (signal, topic); else if (type == "matrixHomoStamped") entity.add<std::pair<sot::MatrixHomogeneous, ml::Vector> > (signal, topic); else if (type == "twist") entity.add<specific::Twist> (signal, topic); else if (type == "twistStamped") entity.add<std::pair<specific::Twist, ml::Vector> > (signal, topic); else throw std::runtime_error("bad type"); return Value (); }
std::string getParameter(std::string const& name) { std::vector<std::string> vec = getParameterValues(name); return vec.empty() ? "" : vec[0]; }