Esempio n. 1
0
/*======================================================================*/
void addParameter(Parameter theArrayPosition[], Parameter *theParameter)
{
    if (theArrayPosition == NULL) syserr("Adding to null parameter array");

	if (isEndOfArray(&theArrayPosition[0]))
		clearParameter(&theArrayPosition[0], NULL);
	copyParameter(&theArrayPosition[0], theParameter);
    setEndOfArray(&theArrayPosition[1]);
}
Esempio n. 2
0
void AIMessage::setLong(unsigned int index, long value)
{
    GP_ASSERT(index < _parameterCount);

    clearParameter(index);

    _parameters[index].longValue = value;
    _parameters[index].type = AIMessage::LONG;
}
Esempio n. 3
0
void AIMessage::setFloat(unsigned int index, float value)
{
    GP_ASSERT(index < _parameterCount);

    clearParameter(index);

    _parameters[index].floatValue = value;
    _parameters[index].type = AIMessage::FLOAT;
}
Esempio n. 4
0
void AIMessage::setInt(unsigned int index, int value)
{
    GP_ASSERT(index < _parameterCount);

    clearParameter(index);

    _parameters[index].intValue = value;
    _parameters[index].type = AIMessage::INTEGER;
}
Esempio n. 5
0
void AIMessage::setBoolean(unsigned int index, bool value)
{
    GP_ASSERT(index < _parameterCount);

    clearParameter(index);

    _parameters[index].boolValue = value;
    _parameters[index].type = AIMessage::BOOLEAN;
}
Esempio n. 6
0
void AIMessage::setDouble(unsigned int index, double value)
{
    GP_ASSERT(index < _parameterCount);

    clearParameter(index);

    _parameters[index].doubleValue = value;
    _parameters[index].type = AIMessage::DOUBLE;
}
Esempio n. 7
0
void AIMessage::setString(unsigned int index, const char* value)
{
    GP_ASSERT(index < _parameterCount);
    GP_ASSERT(value);

    clearParameter(index);

    // Copy the string into our parameter
    size_t len = strlen(value);
    char* buffer = new char[len + 1];
    strcpy(buffer, value);
    _parameters[index].stringValue = buffer;
    _parameters[index].type = AIMessage::STRING;
}
void
GNEDemandElement::setGenericParametersStr(const std::string& value) {
    // clear parameters
    clearParameter();
    // separate value in a vector of string using | as separator
    std::vector<std::string> parsedValues;
    StringTokenizer stValues(value, "|", true);
    while (stValues.hasNext()) {
        parsedValues.push_back(stValues.next());
    }
    // check that parsed values (A=B)can be parsed in generic parameters
    for (auto i : parsedValues) {
        std::vector<std::string> parsedParameters;
        StringTokenizer stParam(i, "=", true);
        while (stParam.hasNext()) {
            parsedParameters.push_back(stParam.next());
        }
        // Check that parsed parameters are exactly two and contains valid chracters
        if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
            setParameter(parsedParameters.front(), parsedParameters.back());
        }
    }
}
Esempio n. 9
0
/*======================================================================*/
void clearParameterArray(Parameter theArray[]) {
    clearParameter(&theArray[0], theArray[0].candidates);
    setEndOfArray(theArray);
}