void ConfigFile::processVcam(const xmlpp::Node* node,Vcam &vcam){
	xmlpp::Node::NodeList list = node->get_children();
	for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter){
		xmlpp::Node* child=dynamic_cast<const xmlpp::Node*>(*iter);

		if(child->get_name()=="resw")
			extractIntChar(child,vcam.resw);
		else if(child->get_name()=="resh")
			extractIntChar(child,vcam.resh);
		else if(child->get_name()=="position")
			extractPositionOrColor(child,vcam.position);
		else if(child->get_name()=="relativeTo")
			extractStringChar(child,vcam.linkName);
		else if(child->get_name()=="orientation")
			extractOrientation(child,vcam.orientation);
		else if(child->get_name()=="name")
			extractStringChar(child,vcam.name);
		else if(child->get_name()=="baseline"){
			extractFloatChar(child,vcam.baseLine);
		} else if(child->get_name()=="frameId"){
			extractStringChar(child,vcam.frameId);
		} else if(child->get_name()=="parameters"){
			vcam.parameters.reset(new Parameters());
			processParameters(child,vcam.parameters.get());
		} else if(child->get_name()=="showpath")
			extractFloatChar(child,vcam.showpath);
	}

}
//!
//! Constructor of the VTKGraphLayoutNode class.
//!
//! \param name The name for the new node.
//! \param parameterRoot A copy of the parameter tree specific for the type of the node.
//!
VTKGraphLayoutNode::VTKGraphLayoutNode ( const QString &name, ParameterGroup *parameterRoot ) :
    VTKLayoutNode(name, parameterRoot),
	m_inputVTKGraphName("VTKGraphInput"),
	m_zRangeParameterName("ZRange"),
	m_inGraph(0)
{
	setTypeName("VTKGraphLayoutNode");

    // create the mandatory vtk graph input parameter 
	VTKGraphParameter * inputVTKGraphParameter = new VTKGraphParameter(m_inputVTKGraphName);
	inputVTKGraphParameter->setMultiplicity(1);
    inputVTKGraphParameter->setPinType(Parameter::PT_Input);
    inputVTKGraphParameter->setSelfEvaluating(true);
    parameterRoot->addParameter(inputVTKGraphParameter);
	connect(inputVTKGraphParameter, SIGNAL(dirtied()), SLOT(processParameters()));

    // create the mandatory SetZRange parameter 
	NumberParameter * zRangeParameter = new NumberParameter(m_zRangeParameterName, Parameter::T_Float, QVariant::fromValue<double>(0));
    parameterRoot->addParameter(zRangeParameter);
	connect(zRangeParameter, SIGNAL(dirtied()), SLOT(processParameters()));

	INC_INSTANCE_COUNTER
}
Example #3
0
IrcCommand* IrcCommandParserPrivate::parseCommand(const IrcCommandInfo& command, const QString& input) const
{
    IrcCommand* cmd = 0;
    QStringList params;
    if (processParameters(command, input, &params)) {
        const int count = params.count();
        if (count >= command.min && count <= command.max) {
            cmd = new IrcCommand;
            cmd->setType(command.type);
            if (command.type == IrcCommand::Custom)
                params.prepend(command.command);
            cmd->setParameters(params);
        }
    }
    return cmd;
}
Example #4
0
bool IosBuildStep::init()
{
    BuildConfiguration *bc = buildConfiguration();
    if (!bc)
        bc = target()->activeBuildConfiguration();
    if (!bc)
        emit addTask(Task::buildConfigurationMissingTask());

    ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
    if (!tc)
        emit addTask(Task::compilerMissingTask());

    if (!bc || !tc) {
        emitFaultyConfigurationMessage();
        return false;
    }

    ProcessParameters *pp = processParameters();
    pp->setMacroExpander(bc->macroExpander());
    pp->setWorkingDirectory(bc->buildDirectory().toString());
    Utils::Environment env = bc->environment();
    // Force output to english for the parsers. Do this here and not in the toolchain's
    // addToEnvironment() to not screw up the users run environment.
    env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
    pp->setEnvironment(env);
    pp->setCommand(buildCommand());
    pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
    pp->resolveAll();

    // If we are cleaning, then build can fail with an error code, but that doesn't mean
    // we should stop the clean queue
    // That is mostly so that rebuild works on an already clean project
    setIgnoreReturnValue(m_clean);

    setOutputParser(new GnuMakeParser());
    IOutputParser *parser = target()->kit()->createOutputParser();
    if (parser)
        appendOutputParser(parser);
    outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());

    return AbstractProcessStep::init();
}
Example #5
0
bool IosBuildStep::init()
{
    BuildConfiguration *bc = buildConfiguration();
    if (!bc)
        bc = target()->activeBuildConfiguration();

    ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
    if (!tc) {
        Task t = Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit preferences."),
                      Utils::FileName(), -1,
                      Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
        emit addTask(t);
        emit addOutput(tr("Configuration is faulty. Check the Issues output pane for details."),
                       BuildStep::MessageOutput);
        return false;
    }
    ProcessParameters *pp = processParameters();
    pp->setMacroExpander(bc->macroExpander());
    pp->setWorkingDirectory(bc->buildDirectory().toString());
    Utils::Environment env = bc->environment();
    // Force output to english for the parsers. Do this here and not in the toolchain's
    // addToEnvironment() to not screw up the users run environment.
    env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
    pp->setEnvironment(env);
    pp->setCommand(buildCommand());
    pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
    pp->resolveAll();

    // If we are cleaning, then build can fail with an error code, but that doesn't mean
    // we should stop the clean queue
    // That is mostly so that rebuild works on an already clean project
    setIgnoreReturnValue(m_clean);

    setOutputParser(new GnuMakeParser());
    IOutputParser *parser = target()->kit()->createOutputParser();
    if (parser)
        appendOutputParser(parser);
    outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());

    return AbstractProcessStep::init();
}
void processLine(char *line)
{
	char buffer[256];
	const char delimiter[] = " ";
	char *commandString = NULL;
	char *remainingString = NULL;

	strcpy(buffer, line);
	upperCaseString(buffer);

	// get first token
	commandString = strtok(buffer, delimiter);

	if (NULL != commandString)
	{
		if (strlen(line) - strlen(commandString) > 0)
		{
			remainingString = line + strlen(commandString) + 1;
		}

		processParameters(remainingString);
		processCommand(commandString);
	}
}
Example #7
0
int main(int argc, char* argv[])
{

    srand(time(0));
    int AUDIO_UDP_SEND_PORT = 1500 + (rand() % (int)(1500 - 2000 + 1));
    
    UDPSocket *streamSocket = new UDPSocket(AUDIO_UDP_SEND_PORT);
    
    if (processParameters(argc, argv)) {
        if (sourceAudioFile) {
            loadFile();
        } else {
            std::cout << "[FATAL] Source audio file not specified" << std::endl;
            exit(-1);
        }
        
        for (int i = 0; i < sizeof(positionInUniverse)/sizeof(positionInUniverse[0]); ++i) {
            std::cout << "Position " << positionInUniverse[i] << std::endl;
        }

        float delay;
        int usecDelay;
        while (true) {
            stream();
            
            if (loopAudio) {
                delay = 0;
            } else {
                delay = randFloatInRange(sleepIntervalMin, sleepIntervalMax);
            }
            usecDelay = delay * 1000 * 1000;
            usleep(usecDelay);
        }
    }
    return 0;
}
//!
//! Constructor of the ConeTreeLayouterNode class.
//!
//! \param name The name for the new node.
//! \param parameterRoot A copy of the parameter tree specific for the type of the node.
//!
ConeTreeLayouterNode::ConeTreeLayouterNode ( const QString &name, ParameterGroup *parameterRoot ) :
    VTKTreeLayoutNode(name, parameterRoot),
	m_CompactnessNameParameter("Set Compactness"),
	m_CompressionNameParameter("Set Compression"),
	m_SpacingNameParameter("Set Spacing")

{
	setTypeName("ConeTreeLayouterNode");

	m_layoutInstance = vtkConeLayoutStrategy::New();

	setChangeFunction("Set Compactness", SLOT(processParameters()));
    setCommandFunction("Set Compactness", SLOT(processParameters()));

	setChangeFunction("Set Compression", SLOT(processParameters()));
    setCommandFunction("Set Compression", SLOT(processParameters()));

	setChangeFunction("Set Spacing", SLOT(processParameters()));
    setCommandFunction("Set Spacing", SLOT(processParameters()));

	INC_INSTANCE_COUNTER
}
Example #9
0
/*--------------------------------------------------------------------------------------*\
 * UApm : process()                                                                     *
 *        The APM/2 main function, throws a ERROR_* in case of errors                   *
\*--------------------------------------------------------------------------------------*/
UApm                   &UApm::process(void)
{
    char               *pcOption=0;
    COUNTRYCODE         countrycode={ 0 };
    COUNTRYINFO         countryinfo={ 0 };
    ULONG               ulInfoLength=0;
    int                 iTemp=0;
    char               *pcTemp;
    UCountryTranslate   ucountrytranslate[]= { 
                                               {  01L, "Us" },
                                               {  02L, "Fr" },
                                               {  07L, "Ru" },
                                               {  31L, "Nl" },
                                               {  32L, "Be" },
                                               {  33L, "Fr" },
                                               {  34L, "Es" },
                                               {  39L, "It" },
                                               {  41L, "Gr" },
                                               {  44L, "Us" },
                                               {  45L, "Dk" },
                                               {  46L, "Se" },
                                               {  47L, "No" },
                                               {  49L, "Gr" },
                                               {  61L, "Us" },
                                               {  81L, "Jp" },
                                               {  99L, "Us" },
                                               { 358L, "Fi" },
                                             };
    FILESTATUS3         filestatus3;

                                        /* Query country settings, to try to load NLS
                                           message file even if no /Language commandline
                                           option has been specified */
    DosQueryCtryInfo(sizeof(countryinfo), &countrycode, &countryinfo, &ulInfoLength);
    for(iTemp=0; iTemp<(sizeof(ucountrytranslate)/sizeof(ucountrytranslate[0])); iTemp++)
        {
        if(countryinfo.country==ucountrytranslate[iTemp].ulCountry)
            {
            pcTemp=strrchr(acMessageFileNls, '.');
            if(strlen(acMessageFileNls) && (pcTemp!=0))
                {
                pcTemp-=2;              /* Skip "Us" backwards to append "Xx.msg" */
                strcpy(pcTemp, ucountrytranslate[iTemp].acCountry);
                strcat(pcTemp, ".msg");
                }
            break;
            }
        }
                                        /* First, try to find the NLS message file, which
                                           of course can override our assumptions */
    if((pcOption=checkCommandlineOption("Language", TRUE))!=0)
        {
        if(pcOption==(char *)0xFFFFFFFF)
            {
            displayMessage(MSG_LOGO);
            displayMessage(MSG_PARAMETERS_MISSING);
            throw((int)ERROR_PARAMETERS_MISSING);
            }
                                        /* If language was specified, use it */
        iStatusFlag|=FLAG_NLS_MESSAGES_REQUESTED;
        pcTemp=strrchr(acMessageFileNls, '.');
        if(strlen(acMessageFileNls) && (pcTemp!=0))
            {
            pcTemp-=2;                  /* Skip "Us" backwards to append "Xx.msg" */
            strcpy(pcTemp, pcOption);
            strcat(pcTemp, ".msg");
            }
        }
                                        /* Now that we might have a NLS message file that is
                                           not Us, verify that it exists */
    if(strcmp(acMessageFileNls, acMessageFileUs))
        {
        if(DosQueryPathInfo(acMessageFileNls, FIL_STANDARD, &filestatus3, sizeof(filestatus3))!=NO_ERROR)
            {
                                        /* The NLS message file specified does not exists, so use
                                           Us English one, but inform the user if he has requested
                                           it (compared to when we found it in the ucountrytranslate[]
                                           table) */
            if(iStatusFlag & FLAG_NLS_MESSAGES_REQUESTED)
                displayMessage(ERROR_NLSMSG_NOT_EXIST, 1, (int)acMessageFileNls);
            strcpy(acMessageFileNls, acMessageFileUs);
            }
        else
                                        /* The NLS message file does exist, so any problem retrieving
                                           messages is caused by invalid contents of that file, which
                                           we should inform the user for */
            iStatusFlag|=FLAG_NLS_MESSAGES_FOUND;
        }
                                        /* Process further depending on the arguments specified */
    if(iArgc==1)
        {
                                        /* If no argument is specified, display simple help */
        displayMessage(MSG_LOGO);
        displayMessage(MSG_DESCRIPTION);
        displayMessage(MSG_PARAMETERS_MISSING);
        iReturnCode=ERROR_PARAMETERS_MISSING;
        }
    else
        {
                                        /* At least one option was specified */
        displayMessage(MSG_LOGO);
                                        /* If the language was the only (two) arguments, display
                                           simple help */
        if((iArgc==3) && (iStatusFlag & FLAG_NLS_MESSAGES_REQUESTED))
            {
            displayMessage(MSG_DESCRIPTION);
            displayMessage(MSG_PARAMETERS_MISSING);
            iReturnCode=ERROR_PARAMETERS_MISSING;
            throw(iReturnCode);
            }
        if(checkCommandlineOption("?")!=0)
            {
            displayMessage(MSG_PARAMETERS_INVALID);
            displayMessage(MSG_PARAMETERS_TEXT);
            iReturnCode=ERROR_PARAMETERS_INVALID;
            }
        else
            {
                                        /* Now just find all commandline parameters and trow
                                           an error if an invalid combination was found */
            try
                {
                matchParameters();
                }
            catch(int iErrorCode) 
                {
                displayMessage(iErrorCode);
                displayMessage(MSG_PARAMETERS_TEXT);
                iReturnCode=iErrorCode;
                throw(iReturnCode);
                }
                                        /* Now that we have found valid commandline
                                           parameters, process them */
            try
                {
                processParameters();
                }
            catch(int iErrorCode)
                {
                displayMessage(iErrorCode);
                iReturnCode=iErrorCode;
                throw(iReturnCode);
                }
            }
        }

    return(*this);
}
//!
//! Constructor of the ClusteringLayouterNode class.
//!
//! \param name The name for the new node.
//! \param parameterRoot A copy of the parameter tree specific for the type of the node.
//!
ClusteringLayouterNode::ClusteringLayouterNode ( const QString &name, ParameterGroup *parameterRoot ) :
	VTKGraphLayoutNode(name, parameterRoot)
{
	setTypeName("ClusteringLayouterNode");

	m_layoutInstance = vtkClustering2DLayoutStrategy::New();

	setChangeFunction("Set Random Seed", SLOT(processParameters()));
    setCommandFunction("Set Random Seed", SLOT(processParameters()));

	setChangeFunction("Set Max Number Of Iterations", SLOT(processParameters()));
    setCommandFunction("Set Max Number Of Iterations", SLOT(processParameters()));

	setChangeFunction("Set Iterations Per Layout", SLOT(processParameters()));
    setCommandFunction("Set Iterations Per Layout", SLOT(processParameters()));

	setChangeFunction("Set Initial Temperature", SLOT(processParameters()));
    setCommandFunction("Set Initial Temperature", SLOT(processParameters()));

	setChangeFunction("Set Cool Down Rate", SLOT(processParameters()));
    setCommandFunction("Set Cool Down Rate", SLOT(processParameters()));

	setChangeFunction("Set Rest Distance", SLOT(processParameters()));
    setCommandFunction("Set Rest Distance", SLOT(processParameters()));

	INC_INSTANCE_COUNTER
}
Example #11
0
  /** Executes the algorithm
  *
  *  @throw runtime_error Thrown if algorithm cannot execute
  */
  void Fit::exec()
  {
    API::MatrixWorkspace_sptr ws = getProperty("InputWorkspace");
    std::string input = "WorkspaceIndex=" + getPropertyValue("WorkspaceIndex");
    double startX = getProperty("StartX");
    if (startX != EMPTY_DBL())
    {
      input += ",StartX=" + getPropertyValue("StartX");
    }
    double endX = getProperty("EndX");
    if (endX != EMPTY_DBL())
    {
      input += ",EndX=" + getPropertyValue("EndX");
    }

    // Process the Function property and create the function using FunctionFactory
    // fills in m_function_input
    processParameters();

    boost::shared_ptr<GenericFit> fit = boost::dynamic_pointer_cast<GenericFit>(createSubAlgorithm("GenericFit"));
    fit->setChild(false);
    fit->setLogging(false); // No logging of time to run GenericFit
    fit->initialize();
    fit->setProperty("InputWorkspace",boost::dynamic_pointer_cast<API::Workspace>(ws));
    fit->setProperty("Input",input);
    fit->setProperty("Function",m_function_input);
    fit->setProperty("Output",getPropertyValue("Output"));
    fit->setPropertyValue("MaxIterations",getPropertyValue("MaxIterations"));
    fit->setPropertyValue("Minimizer",getPropertyValue("Minimizer"));
    fit->setPropertyValue("CostFunction",getPropertyValue("CostFunction"));
    fit->execute();

    m_function_input = fit->getPropertyValue("Function");
    setProperty("Function",m_function_input);

    // also output summary to properties
    setProperty("OutputStatus", fit->getPropertyValue("OutputStatus"));
    double finalCostFuncVal = fit->getProperty("OutputChi2overDoF");
    setProperty("OutputChi2overDoF", finalCostFuncVal);
    setProperty("Minimizer", fit->getPropertyValue("Minimizer"));

    std::vector<double> errors;
    if (fit->existsProperty("Parameters"))
    {
      // Add Parameters, Errors and ParameterNames properties to output so they can be queried on the algorithm.
      declareProperty(new ArrayProperty<double> ("Parameters",new NullValidator<std::vector<double> >,Direction::Output));
      declareProperty(new ArrayProperty<double> ("Errors",new NullValidator<std::vector<double> >,Direction::Output));
      declareProperty(new ArrayProperty<std::string> ("ParameterNames",new NullValidator<std::vector<std::string> >,Direction::Output));
      std::vector<double> params = fit->getProperty("Parameters");
      errors = fit->getProperty("Errors");
      std::vector<std::string> parNames = fit->getProperty("ParameterNames");

      setProperty("Parameters",params);
      setProperty("Errors",errors);
      setProperty("ParameterNames",parNames);
    }
    
    std::string output = getProperty("Output");
    if (!output.empty())
    {
      // create output parameter table workspace to store final fit parameters 
      // including error estimates if derivative of fitting function defined

      boost::shared_ptr<API::IFunctionMW> funmw = boost::dynamic_pointer_cast<API::IFunctionMW>(fit->getFunction());
      if (funmw)
      {
        declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output),
          "Name of the output Workspace holding resulting simlated spectrum");

        setPropertyValue("OutputWorkspace",output+"_Workspace");

        // Save the fitted and simulated spectra in the output workspace
        int workspaceIndex  = getProperty("WorkspaceIndex");
        if (workspaceIndex < 0) throw std::invalid_argument("WorkspaceIndex must be >= 0");
        funmw->setWorkspace(ws,input);
        API::MatrixWorkspace_sptr outws = funmw->createCalculatedWorkspace(ws,workspaceIndex,errors);

        setProperty("OutputWorkspace",outws);
      }
    }

  }
bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
{
    if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
        emit addOutput(tr("Found old folder \"android\" in source directory. Qt 5.2 does not use that folder by default."), ErrorOutput);

    if (!AndroidBuildApkStep::init(earlierSteps))
        return false;

    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
    if (!version)
        return false;

    QString command = version->qmakeProperty("QT_HOST_BINS");
    if (!command.endsWith(QLatin1Char('/')))
        command += QLatin1Char('/');
    command += QLatin1String("androiddeployqt");
    if (Utils::HostOsInfo::isWindowsHost())
        command += QLatin1String(".exe");

    QString deploymentMethod;
    if (m_deployAction == MinistroDeployment)
        deploymentMethod = QLatin1String("ministro");
    else if (m_deployAction == DebugDeployment)
        deploymentMethod = QLatin1String("debug");
    else if (m_deployAction == BundleLibrariesDeployment)
        deploymentMethod = QLatin1String("bundled");

    ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
    QString outputDir = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();

    const auto *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
    const QmakeProjectManager::QmakeProFileNode *node = pro->rootProjectNode()->findProFileFor(proFilePathForInputFile());
    m_skipBuilding = !node;
    if (m_skipBuilding)
        return true;

    QString inputFile = node->singleVariableValue(QmakeProjectManager::AndroidDeploySettingsFile);
    if (inputFile.isEmpty()) {
        m_skipBuilding = true;
        return true;
    }

    QStringList arguments;
    arguments << QLatin1String("--input")
              << inputFile
              << QLatin1String("--output")
              << outputDir
              << QLatin1String("--deployment")
              << deploymentMethod
              << QLatin1String("--android-platform")
              << AndroidManager::buildTargetSDK(target())
              << QLatin1String("--jdk")
              << AndroidConfigurations::currentConfig().openJDKLocation().toString();

    if (m_verbose)
        arguments << QLatin1String("--verbose");

    if (m_useGradle)
        arguments << QLatin1String("--gradle");
    else
        arguments << QLatin1String("--ant")
                  << AndroidConfigurations::currentConfig().antToolPath().toString();


    QStringList argumentsPasswordConcealed = arguments;

    if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0)) {
        if (bc->buildType() == ProjectExplorer::BuildConfiguration::Debug)
            arguments << QLatin1String("--gdbserver");
        else
            arguments << QLatin1String("--no-gdbserver");
    }

    if (m_signPackage) {
        arguments << QLatin1String("--sign")
                  << m_keystorePath.toString()
                  << m_certificateAlias
                  << QLatin1String("--storepass")
                  << m_keystorePasswd;
        argumentsPasswordConcealed << QLatin1String("--sign") << QLatin1String("******")
                                   << QLatin1String("--storepass") << QLatin1String("******");
        if (!m_certificatePasswd.isEmpty()) {
            arguments << QLatin1String("--keypass")
                      << m_certificatePasswd;
            argumentsPasswordConcealed << QLatin1String("--keypass")
                      << QLatin1String("******");
        }

    }

    ProjectExplorer::ProcessParameters *pp = processParameters();
    setupProcessParameters(pp, bc, arguments, command);

    // Generate arguments with keystore password concealed
    ProjectExplorer::ProcessParameters pp2;
    setupProcessParameters(&pp2, bc, argumentsPasswordConcealed, command);
    m_command = pp2.effectiveCommand();
    m_argumentsPasswordConcealed = pp2.prettyArguments();

    return true;
}