add setComponentsNames

This commit is contained in:
fps 2013-09-18 09:41:35 +00:00
parent f552e9aa9d
commit 6eb6c1dbb9
3 changed files with 18 additions and 0 deletions

View File

@ -78,6 +78,16 @@ throw (XAO_Exception)
m_components[index] = name;
}
void Field::setComponentsNames(const std::vector<std::string>& names)
throw (XAO_Exception)
{
for (int i = 0; i < names.size(); ++i)
{
if (i < m_nbComponents)
m_components[i] = names[i];
}
}
bool Field::removeStep(Step* step)
{
std::vector<Step*>::iterator it = m_steps.begin();

View File

@ -149,6 +149,12 @@ namespace XAO
*/
void setComponentName(const int& componentIndex, const std::string& name) throw (XAO_Exception);
/**
* Sets the name of the components.
* @param names the names to set.
*/
void setComponentsNames(const std::vector<std::string>& names) throw (XAO_Exception);
/**
* Adds a new step of the same type than the field.
* @param number the numer of the step.

View File

@ -24,6 +24,7 @@ namespace XAO
CPPUNIT_TEST(testIntegerStepValues);
CPPUNIT_TEST(testDoubleStepValues);
CPPUNIT_TEST(testStringStepValues);
CPPUNIT_TEST(testSetComponents);
CPPUNIT_TEST_SUITE_END();
public:
@ -47,6 +48,7 @@ namespace XAO
void testIntegerStepValues();
void testDoubleStepValues();
void testStringStepValues();
void testSetComponents();
};
}