mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-15 13:41:21 +05:00
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
// Copyright (C) 2013 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
|
|
// License as published by the Free Software Foundation; either
|
|
// version 2.1 of the License.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
//
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
//
|
|
// Author : Frederic Pons (OpenCascade)
|
|
|
|
#include <sstream>
|
|
#include <Utils_SALOME_Exception.hxx>
|
|
|
|
#include "Xao.hxx"
|
|
#include "Step.hxx"
|
|
#include "BooleanStep.hxx"
|
|
#include "IntegerStep.hxx"
|
|
#include "DoubleStep.hxx"
|
|
#include "StringStep.hxx"
|
|
|
|
|
|
using namespace XAO;
|
|
|
|
Step* Step::createStep(const XAO::Type& type, const int& step, const int& stamp, const int& nbElements, const int& nbComponents)
|
|
{
|
|
if (type == XAO::BOOLEAN)
|
|
return new BooleanStep(step, stamp, nbElements, nbComponents);
|
|
if (type == XAO::INTEGER)
|
|
return new IntegerStep(step, stamp, nbElements, nbComponents);
|
|
if (type == XAO::DOUBLE)
|
|
return new DoubleStep(step, stamp, nbElements, nbComponents);
|
|
if (type == XAO::STRING)
|
|
return new StringStep(step, stamp, nbElements, nbComponents);
|
|
|
|
throw SALOME_Exception("Unknown Type");
|
|
}
|
|
|
|
void Step::checkElement(const int& element)
|
|
{
|
|
if (element >= m_nbElements || element < 0)
|
|
{
|
|
std::ostringstream str;
|
|
str << "Element index is out of range [0, " << m_nbElements-1 << "] : " << element;
|
|
throw SALOME_Exception(str.str().c_str());
|
|
}
|
|
}
|
|
|
|
void Step::checkComponent(const int& component)
|
|
{
|
|
if (component >= m_nbComponents || component < 0)
|
|
{
|
|
std::ostringstream str;
|
|
str << "Component index is out of range [0, " << m_nbComponents-1 << "] : " << component;
|
|
throw SALOME_Exception(str.str().c_str());
|
|
}
|
|
}
|