本文整理汇总了C++中ParameterSet::setParam方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterSet::setParam方法的具体用法?C++ ParameterSet::setParam怎么用?C++ ParameterSet::setParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterSet
的用法示例。
在下文中一共展示了ParameterSet::setParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: go
/* ----------------------------------------------------------------*/
void paramTaskTestImpl::go(ParameterSet& pset, const TaskServices& taskServices)
{
try
{
// test string param
StringParam testStringVal = pset.getStringParam(STRING_PARAM_NAME);
cout << STRING_PARAM_NAME << " was: " << testStringVal.getValue() << endl;
StringParam strP(STRING_PARAM_NAME, "newstring");
pset.setParam(STRING_PARAM_NAME, strP);
testStringVal = pset.getStringParam(STRING_PARAM_NAME);
cout << STRING_PARAM_NAME << " now: " << testStringVal.getValue() << endl << endl;
// test double param
auto_ptr<string> units;
DoubleParam testDoubleVal = pset.getDoubleParam(DOUBLE_PARAM_NAME);
cout << DOUBLE_PARAM_NAME << " was: " << testDoubleVal.getValue() << endl;
DoubleParam dP(5.5, DOUBLE_PARAM_NAME, units);
pset.setParam(DOUBLE_PARAM_NAME, dP);
testDoubleVal = pset.getDoubleParam(DOUBLE_PARAM_NAME);
cout << DOUBLE_PARAM_NAME << " now: " << testDoubleVal.getValue() << endl << endl;
// test int param
IntParam testIntVal = pset.getIntParam(INT_PARAM_NAME);
cout << INT_PARAM_NAME << " was: " << testIntVal.getValue() << endl;
IntParam iP(11, INT_PARAM_NAME, units);
pset.setParam(INT_PARAM_NAME, iP);
testIntVal = pset.getIntParam(INT_PARAM_NAME);
cout << INT_PARAM_NAME << " now: " << testIntVal.getValue() << endl << endl;
// test bool param
BoolParam testBoolVal = pset.getBoolParam(BOOL_PARAM_NAME);
cout << BOOL_PARAM_NAME << " was: " << testBoolVal.getValue() << endl;
BoolParam bP(false, BOOL_PARAM_NAME);
pset.setParam(BOOL_PARAM_NAME, bP);
testBoolVal = pset.getBoolParam(BOOL_PARAM_NAME);
cout << BOOL_PARAM_NAME << " now: " << testBoolVal.getValue() << endl << endl;
// test stringarray param
StringArrayParam testStringArray = pset.getStringArrayParam(STRING_ARRAY_PARAM_NAME);
cout << STRING_ARRAY_PARAM_NAME << " was: " << endl;
for(unsigned int i = 0; i < testStringArray.getValues().size(); ++i)
{
cout << "string[" << i << "]: " << testStringArray.getValues().begin()[i] << endl;
}
cout << endl;
vector<string> strData;
strData.push_back("newstr1");
strData.push_back("newstr2");
StringArrayParam newStringArrayParam(strData, STRING_ARRAY_PARAM_NAME);
pset.setParam(STRING_ARRAY_PARAM_NAME, newStringArrayParam);
testStringArray = pset.getStringArrayParam(STRING_ARRAY_PARAM_NAME);
cout << STRING_ARRAY_PARAM_NAME << " now: " << endl;
for(unsigned int i = 0; i < testStringArray.getValues().size(); ++i)
{
cout << "string[" << i << "]: " << testStringArray.getValues().begin()[i] << endl;
}
cout << endl;
// test doublearray param
DoubleArrayParam testDoubleArray = pset.getDoubleArrayParam(DOUBLE_ARRAY_PARAM_NAME);
cout << DOUBLE_ARRAY_PARAM_NAME << " was: " << endl;
for(unsigned int i = 0; i < testDoubleArray.getValues().size(); ++i)
{
cout << "double[" << i << "]: " << testDoubleArray.getValues().begin()[i] << endl;
}
cout << endl;
vector<double> dblData;
dblData.push_back(5.5);
dblData.push_back(6.6);
DoubleArrayParam newDoubleArrayParam(dblData, DOUBLE_ARRAY_PARAM_NAME, units);
pset.setParam(DOUBLE_ARRAY_PARAM_NAME, newDoubleArrayParam);
testDoubleArray = pset.getDoubleArrayParam(DOUBLE_ARRAY_PARAM_NAME);
cout << DOUBLE_ARRAY_PARAM_NAME << " now: " << endl;
for(unsigned int i = 0; i < testDoubleArray.getValues().size(); ++i)
{
cout << "double[" << i << "]: " << testDoubleArray.getValues().begin()[i] << endl;
}
cout << endl;
// test intarray param
IntArrayParam testIntArray = pset.getIntArrayParam(INT_ARRAY_PARAM_NAME);
cout << INT_ARRAY_PARAM_NAME << " was: " << endl;
for(unsigned int i = 0; i < testIntArray.getValues().size(); ++i)
{
cout << "int[" << i << "]: " << testIntArray.getValues().begin()[i] << endl;
}
cout << endl;
vector<int> junkData;
junkData.push_back(5);
junkData.push_back(6);
IntArrayParam newIntArrayParam(junkData, INT_ARRAY_PARAM_NAME, units);
pset.setParam(INT_ARRAY_PARAM_NAME, newIntArrayParam);
testIntArray = pset.getIntArrayParam(INT_ARRAY_PARAM_NAME);
cout << INT_ARRAY_PARAM_NAME << " now: " << endl;
for(unsigned int i = 0; i < testIntArray.getValues().size(); ++i)
{
//.........这里部分代码省略.........