Salome HOME
Copyright update 2022
[modules/shaper.git] / src / XAO / XAO_Field.cxx
index 3fa7c8c1990d57bb2a9cdf12abf3bc9fdf87f785..accbf9048f840d27760ad8540f787e7e1bd44693 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -33,24 +33,22 @@ using namespace XAO;
 
 // -------------------------------------------------------
 
-Field::Field(const XAO::Dimension& dimension,
-        const int& nbElements, const int& nbComponents, const std::string& name)
-    : m_name(name), m_dimension(dimension), m_nbElements(nbElements), m_nbComponents(nbComponents)
+Field::Field(XAO::Dimension dimension,
+             int nbElements, int nbComponents, const std::string& name)
+  : m_name(name), m_dimension(dimension),
+    m_nbComponents(nbComponents), m_components(nbComponents, ""),
+    m_nbElements(nbElements)
 {
-    m_components.reserve(nbComponents);
-    for (int i = 0; i < nbComponents; ++i)
-        m_components.push_back("");
 }
 
 Field::~Field()
 {
-    for (unsigned int i = 0; i < m_steps.size(); ++i)
-        delete m_steps[i];
+  for (unsigned int i = 0; i < m_steps.size(); ++i)
+    delete m_steps[i];
 }
 
-Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension,
-        const int& nbElements, const int& nbComponents, const std::string& name)
-throw (XAO_Exception)
+Field* Field::createField(XAO::Type type, XAO::Dimension dimension,
+        int nbElements, int nbComponents, const std::string& name)
 {
     if (type == XAO::BOOLEAN)
         return new BooleanField(dimension, nbElements, nbComponents, name);
@@ -64,26 +62,23 @@ throw (XAO_Exception)
     throw XAO_Exception(MsgBuilder() << "Bad Type: " << type);
 }
 
-const std::string Field::getComponentName(const int& index)
-throw (XAO_Exception)
+const std::string Field::getComponentName(int index)
 {
     checkComponent(index);
     return m_components[index];
 }
 
-void Field::setComponentName(const int& index, const std::string& name)
-throw (XAO_Exception)
+void Field::setComponentName(int index, const std::string& name)
 {
     checkComponent(index);
     m_components[index] = name;
 }
 
 void Field::setComponentsNames(const std::vector<std::string>& names)
-throw (XAO_Exception)
 {
     for (unsigned int  i = 0; i < names.size(); ++i)
     {
-        if (i < m_nbComponents)
+      if ((int)i < m_nbComponents)
             m_components[i] = names[i];
     }
 }
@@ -104,7 +99,7 @@ bool Field::removeStep(Step* step)
     return false;
 }
 
-bool Field::hasStep(const int& step)
+bool Field::hasStep(int step)
 {
     std::vector<Step*>::iterator it = m_steps.begin();
     for (; it != m_steps.end(); ++it)
@@ -117,8 +112,7 @@ bool Field::hasStep(const int& step)
     return false;
 }
 
-void Field::checkComponent(const int& component)
-throw (XAO_Exception)
+void Field::checkComponent(int component)
 {
     if (component < m_nbComponents && component >= 0)
         return;
@@ -127,10 +121,9 @@ throw (XAO_Exception)
                                      << m_nbComponents-1 << "]: " << component);
 }
 
-void Field::checkStepIndex(const int& step)
-throw (XAO_Exception)
+void Field::checkStepIndex(int step)
 {
-    if (step < m_steps.size() && step >= 0)
+  if (step < (int)m_steps.size() && step >= 0)
         return;
 
     throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, "