]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
add setComponentsNames
authorfps <fps@opencascade.com>
Wed, 18 Sep 2013 09:41:35 +0000 (09:41 +0000)
committerfps <fps@opencascade.com>
Wed, 18 Sep 2013 09:41:35 +0000 (09:41 +0000)
src/XAO/XAO_Field.cxx
src/XAO/XAO_Field.hxx
src/XAO/tests/FieldTest.hxx

index a38105b0efd7fe10335fd82565c20ec75b5ec988..51d73616c3150c146432136c9d94cc3becdc8e0a 100644 (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();
index 88e5f66ee9a1549b3c4f089f3b3e83f08f4ad77d..e1931d587bc11ba26018e3a5d3de224c4142d200 100644 (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.
index 9a4a8d82da34158c12ba26ce7c78783118b7e266..35e766576e789e37419e3979c727ec78adb5b0e1 100644 (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();
     };
 }