mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-15 21:21:22 +05:00
replace SALOME_Exception with XAO_Exception
This commit is contained in:
parent
4055049bd0
commit
3861ed8a46
@ -66,7 +66,6 @@ dist_libXAO_la_SOURCES = \
|
|||||||
XAO_XaoExporter.cxx
|
XAO_XaoExporter.cxx
|
||||||
|
|
||||||
libXAO_la_CPPFLAGS = \
|
libXAO_la_CPPFLAGS = \
|
||||||
$(GEOM_CXXFLAGS) \
|
|
||||||
$(CAS_CPPFLAGS) \
|
$(CAS_CPPFLAGS) \
|
||||||
$(LIBXML_INCLUDES) \
|
$(LIBXML_INCLUDES) \
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
@ -75,7 +74,5 @@ libXAO_la_CPPFLAGS = \
|
|||||||
libXAO_la_LDFLAGS = \
|
libXAO_la_LDFLAGS = \
|
||||||
$(CAS_LDPATH) \
|
$(CAS_LDPATH) \
|
||||||
$(LIBXML_LIBS) \
|
$(LIBXML_LIBS) \
|
||||||
$(KERNEL_LDFLAGS) \
|
-lTKBRep -lTKTopAlgo -lxml2
|
||||||
$(GEOM_LDFLAGS) \
|
|
||||||
-lOpUtil -lTKBRep -lTKTopAlgo -lxml2
|
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_BooleanField.hxx"
|
#include "XAO_BooleanField.hxx"
|
||||||
#include "XAO_BooleanStep.hxx"
|
#include "XAO_BooleanStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
@ -33,19 +31,22 @@ BooleanField::BooleanField(const std::string& name, const XAO::Dimension& dimens
|
|||||||
}
|
}
|
||||||
|
|
||||||
Step* BooleanField::addNewStep(const int& step)
|
Step* BooleanField::addNewStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BooleanStep* BooleanField::addStep(const int& step)
|
BooleanStep* BooleanField::addStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BooleanStep* BooleanField::addStep(const int& step, const int& stamp)
|
BooleanStep* BooleanField::addStep(const int& step, const int& stamp)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (hasStep(step))
|
if (hasStep(step))
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
throw XAO_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
||||||
|
|
||||||
BooleanStep* bstep = new BooleanStep(step, stamp, m_nbElements, m_nbComponents);
|
BooleanStep* bstep = new BooleanStep(step, stamp, m_nbElements, m_nbComponents);
|
||||||
m_steps.push_back(bstep);
|
m_steps.push_back(bstep);
|
||||||
@ -53,6 +54,7 @@ BooleanStep* BooleanField::addStep(const int& step, const int& stamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BooleanStep* BooleanField::getStep(const int& index)
|
BooleanStep* BooleanField::getStep(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkStepIndex(index);
|
checkStepIndex(index);
|
||||||
return (BooleanStep*)m_steps[index];
|
return (BooleanStep*)m_steps[index];
|
||||||
|
@ -47,14 +47,14 @@ namespace XAO
|
|||||||
|
|
||||||
virtual const XAO::Type getType() { return XAO::BOOLEAN; }
|
virtual const XAO::Type getType() { return XAO::BOOLEAN; }
|
||||||
|
|
||||||
virtual Step* addNewStep(const int& step);
|
virtual Step* addNewStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
* @param step the number of the step.
|
* @param step the number of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
BooleanStep* addStep(const int& step);
|
BooleanStep* addStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
@ -62,14 +62,15 @@ namespace XAO
|
|||||||
* @param stamp the stamp of the step.
|
* @param stamp the stamp of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
BooleanStep* addStep(const int& step, const int& stamp);
|
BooleanStep* addStep(const int& step, const int& stamp)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the step of given index.
|
* Gets the step of given index.
|
||||||
* @param index the index.
|
* @param index the index.
|
||||||
* @return the step for the given index.
|
* @return the step for the given index.
|
||||||
*/
|
*/
|
||||||
BooleanStep* getStep(const int& index);
|
BooleanStep* getStep(const int& index) throw (XAO_Exception);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_BooleanStep.hxx"
|
#include "XAO_BooleanStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
|
|
||||||
@ -59,6 +57,7 @@ std::vector<bool> BooleanStep::getValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<bool> BooleanStep::getElement(const int& element)
|
std::vector<bool> BooleanStep::getElement(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ std::vector<bool> BooleanStep::getElement(const int& element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<bool> BooleanStep::getComponent(const int& component)
|
std::vector<bool> BooleanStep::getComponent(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ std::vector<bool> BooleanStep::getComponent(const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool BooleanStep::getValue(const int& element, const int& component)
|
const bool BooleanStep::getValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -92,11 +93,13 @@ const bool BooleanStep::getValue(const int& element, const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string BooleanStep::getStringValue(const int& element, const int& component)
|
const std::string BooleanStep::getStringValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return XaoUtils::booleanToString(getValue(element, component));
|
return XaoUtils::booleanToString(getValue(element, component));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BooleanStep::setValues(const std::vector<bool>& values)
|
void BooleanStep::setValues(const std::vector<bool>& values)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkNbValues((int)values.size());
|
checkNbValues((int)values.size());
|
||||||
|
|
||||||
@ -110,6 +113,7 @@ void BooleanStep::setValues(const std::vector<bool>& values)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BooleanStep::setElements(const int& element, const std::vector<bool>& elements)
|
void BooleanStep::setElements(const int& element, const std::vector<bool>& elements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkNbComponents(elements.size());
|
checkNbComponents(elements.size());
|
||||||
@ -119,6 +123,7 @@ void BooleanStep::setElements(const int& element, const std::vector<bool>& eleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BooleanStep::setComponents(const int& component, const std::vector<bool>& components)
|
void BooleanStep::setComponents(const int& component, const std::vector<bool>& components)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
checkNbElements(components.size());
|
checkNbElements(components.size());
|
||||||
@ -128,6 +133,7 @@ void BooleanStep::setComponents(const int& component, const std::vector<bool>& c
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BooleanStep::setValue(const int& element, const int& component, const bool& value)
|
void BooleanStep::setValue(const int& element, const int& component, const bool& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -136,6 +142,7 @@ void BooleanStep::setValue(const int& element, const int& component, const bool&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BooleanStep::setStringValue(const int& element, const int& component, const std::string& value)
|
void BooleanStep::setStringValue(const int& element, const int& component, const std::string& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setValue(element, component, XaoUtils::stringToBoolean(value));
|
setValue(element, component, XaoUtils::stringToBoolean(value));
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,14 @@ namespace XAO
|
|||||||
* @param element the index of the element to get.
|
* @param element the index of the element to get.
|
||||||
* @return a vector containing all the values for the given element.
|
* @return a vector containing all the values for the given element.
|
||||||
*/
|
*/
|
||||||
std::vector<bool> getElement(const int& element);
|
std::vector<bool> getElement(const int& element) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the values for a component.
|
* Gets all the values for a component.
|
||||||
* @param component the index of the component to get.
|
* @param component the index of the component to get.
|
||||||
* @return a vector containing all the values for the given component.
|
* @return a vector containing all the values for the given component.
|
||||||
*/
|
*/
|
||||||
std::vector<bool> getComponent(const int& component);
|
std::vector<bool> getComponent(const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a value for an element and a component.
|
* Gets a value for an element and a component.
|
||||||
@ -73,27 +73,27 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return the value.
|
* @return the value.
|
||||||
*/
|
*/
|
||||||
const bool getValue(const int& element, const int& component);
|
const bool getValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the values from a list.
|
* Sets all the values from a list.
|
||||||
* @param values the list of values to set.
|
* @param values the list of values to set.
|
||||||
*/
|
*/
|
||||||
void setValues(const std::vector<bool>& values);
|
void setValues(const std::vector<bool>& values) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for an element.
|
* Sets the values for an element.
|
||||||
* @param element the index of the element to set.
|
* @param element the index of the element to set.
|
||||||
* @param elements the values to set.
|
* @param elements the values to set.
|
||||||
*/
|
*/
|
||||||
void setElements(const int& element, const std::vector<bool>& elements);
|
void setElements(const int& element, const std::vector<bool>& elements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for a component.
|
* Sets the values for a component.
|
||||||
* @param component the index of the component to set.
|
* @param component the index of the component to set.
|
||||||
* @param components the values to set.
|
* @param components the values to set.
|
||||||
*/
|
*/
|
||||||
void setComponents(const int& component, const std::vector<bool>& components);
|
void setComponents(const int& component, const std::vector<bool>& components) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for an element and a component.
|
* Sets the value for an element and a component.
|
||||||
@ -101,10 +101,10 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @param value the value.
|
* @param value the value.
|
||||||
*/
|
*/
|
||||||
void setValue(const int& element, const int& component, const bool& value);
|
void setValue(const int& element, const int& component, const bool& value) throw (XAO_Exception);
|
||||||
|
|
||||||
virtual const std::string getStringValue(const int& element, const int& component);
|
virtual const std::string getStringValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
virtual void setStringValue(const int& element, const int& component, const std::string& value);
|
virtual void setStringValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::vector<bool> > m_values;
|
std::vector< std::vector<bool> > m_values;
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_BrepGeometry.hxx"
|
#include "XAO_BrepGeometry.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
|
|
||||||
@ -123,6 +121,7 @@ void BrepGeometry::initListIds(const TopAbs_ShapeEnum& shapeType, GeometricEleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, const int& shapeIndex)
|
TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, const int& shapeIndex)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
TopTools_MapOfShape mapShape;
|
TopTools_MapOfShape mapShape;
|
||||||
TopTools_ListOfShape listShape;
|
TopTools_ListOfShape listShape;
|
||||||
@ -147,7 +146,7 @@ TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Shape with reference [" << shapeIndex << "] not found.");
|
throw XAO_Exception(MsgBuilder() << "Shape with reference [" << shapeIndex << "] not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
@ -232,6 +231,7 @@ std::vector<int> BrepGeometry::getSolidFaces(const int& solidIndex, const int& s
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BrepGeometry::getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord)
|
void BrepGeometry::getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
xCoord = 0.;
|
xCoord = 0.;
|
||||||
yCoord = 0.;
|
yCoord = 0.;
|
||||||
@ -239,7 +239,7 @@ void BrepGeometry::getVertexXYZ(const int& vertexIndex, double& xCoord, double&
|
|||||||
|
|
||||||
TopoDS_Shape vertex = getSubShape(m_shape, TopAbs_VERTEX, vertexIndex);
|
TopoDS_Shape vertex = getSubShape(m_shape, TopAbs_VERTEX, vertexIndex);
|
||||||
if (vertex.ShapeType() != TopAbs_VERTEX)
|
if (vertex.ShapeType() != TopAbs_VERTEX)
|
||||||
throw SALOME_Exception(MsgBuilder() << "Shape " << vertexIndex<< " is not a point.");
|
throw XAO_Exception(MsgBuilder() << "Shape " << vertexIndex<< " is not a point.");
|
||||||
|
|
||||||
TopoDS_Vertex point = TopoDS::Vertex(vertex);
|
TopoDS_Vertex point = TopoDS::Vertex(vertex);
|
||||||
if (!point.IsNull())
|
if (!point.IsNull())
|
||||||
@ -320,6 +320,7 @@ void BrepGeometry::setSolidID(const int& index, const int& id)
|
|||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
const int BrepGeometry::findElement(const XAO::Dimension& dim, const int& id)
|
const int BrepGeometry::findElement(const XAO::Dimension& dim, const int& id)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return findVertex(id);
|
return findVertex(id);
|
||||||
@ -330,7 +331,7 @@ const int BrepGeometry::findElement(const XAO::Dimension& dim, const int& id)
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return findSolid(id);
|
return findSolid(id);
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown Dimension: " << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown Dimension: " << dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int BrepGeometry::findVertex(const int& id)
|
const int BrepGeometry::findVertex(const int& id)
|
||||||
@ -376,21 +377,25 @@ const std::string BrepGeometry::findSolidName(const int& id)
|
|||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
void BrepGeometry::changeVertexName(const int& id, const std::string& name)
|
void BrepGeometry::changeVertexName(const int& id, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setVertexName(findVertex(id), name);
|
setVertexName(findVertex(id), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrepGeometry::changeEdgeName(const int& id, const std::string& name)
|
void BrepGeometry::changeEdgeName(const int& id, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setEdgeName(findEdge(id), name);
|
setEdgeName(findEdge(id), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrepGeometry::changeFaceName(const int& id, const std::string& name)
|
void BrepGeometry::changeFaceName(const int& id, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setFaceName(findFace(id), name);
|
setFaceName(findFace(id), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrepGeometry::changeSolidName(const int& id, const std::string& name)
|
void BrepGeometry::changeSolidName(const int& id, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setSolidName(findSolid(id), name);
|
setSolidName(findSolid(id), name);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,8 @@ namespace XAO
|
|||||||
* @param yCoord the Y coordinate.
|
* @param yCoord the Y coordinate.
|
||||||
* @param zCoord the Z coordinate.
|
* @param zCoord the Z coordinate.
|
||||||
*/
|
*/
|
||||||
void getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord);
|
void getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the length of an edge.
|
* Gets the length of an edge.
|
||||||
@ -264,36 +265,38 @@ namespace XAO
|
|||||||
* @param id the ID of the vertex.
|
* @param id the ID of the vertex.
|
||||||
* @param name the name to set.
|
* @param name the name to set.
|
||||||
*/
|
*/
|
||||||
void changeVertexName(const int& id, const std::string& name);
|
void changeVertexName(const int& id, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the name of an edge.
|
* Changes the name of an edge.
|
||||||
* @param id the ID of the edge
|
* @param id the ID of the edge
|
||||||
* @param name the name to set.
|
* @param name the name to set.
|
||||||
*/
|
*/
|
||||||
void changeEdgeName(const int& id, const std::string& name);
|
void changeEdgeName(const int& id, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the name of a face.
|
* Changes the name of a face.
|
||||||
* @param id the ID of the face.
|
* @param id the ID of the face.
|
||||||
* @param name the name to set.
|
* @param name the name to set.
|
||||||
*/
|
*/
|
||||||
void changeFaceName(const int& id, const std::string& name);
|
void changeFaceName(const int& id, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the name of a solid.
|
* Changes the name of a solid.
|
||||||
* @param id the ID of the solid.
|
* @param id the ID of the solid.
|
||||||
* @param name the name to set.
|
* @param name the name to set.
|
||||||
*/
|
*/
|
||||||
void changeSolidName(const int& id, const std::string& name);
|
void changeSolidName(const int& id, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initIds();
|
void initIds();
|
||||||
void initListIds(const TopAbs_ShapeEnum& shapeType, GeometricElementList& eltList);
|
void initListIds(const TopAbs_ShapeEnum& shapeType, GeometricElementList& eltList);
|
||||||
TopoDS_Shape getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, const int& shapeIndex);
|
TopoDS_Shape getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, const int& shapeIndex)
|
||||||
|
throw (XAO_Exception);
|
||||||
const int countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType);
|
const int countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType);
|
||||||
std::vector<int> getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, const XAO::Dimension& dim);
|
std::vector<int> getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, const XAO::Dimension& dim);
|
||||||
const int findElement(const XAO::Dimension& dim, const int& id);
|
const int findElement(const XAO::Dimension& dim, const int& id)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TopoDS_Shape m_shape;
|
TopoDS_Shape m_shape;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_DoubleField.hxx"
|
#include "XAO_DoubleField.hxx"
|
||||||
#include "XAO_DoubleStep.hxx"
|
#include "XAO_DoubleStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
@ -32,19 +30,22 @@ DoubleField::DoubleField(const std::string& name, const XAO::Dimension& dimensio
|
|||||||
}
|
}
|
||||||
|
|
||||||
Step* DoubleField::addNewStep(const int& step)
|
Step* DoubleField::addNewStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleStep* DoubleField::addStep(const int& step)
|
DoubleStep* DoubleField::addStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleStep* DoubleField::addStep(const int& step, const int& stamp)
|
DoubleStep* DoubleField::addStep(const int& step, const int& stamp)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (hasStep(step))
|
if (hasStep(step))
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
throw XAO_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
||||||
|
|
||||||
DoubleStep* bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents);
|
DoubleStep* bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents);
|
||||||
m_steps.push_back(bstep);
|
m_steps.push_back(bstep);
|
||||||
@ -52,6 +53,7 @@ DoubleStep* DoubleField::addStep(const int& step, const int& stamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DoubleStep* DoubleField::getStep(const int& index)
|
DoubleStep* DoubleField::getStep(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkStepIndex(index);
|
checkStepIndex(index);
|
||||||
return (DoubleStep*)m_steps[index];
|
return (DoubleStep*)m_steps[index];
|
||||||
|
@ -47,14 +47,14 @@ namespace XAO
|
|||||||
|
|
||||||
virtual const XAO::Type getType() { return XAO::DOUBLE; }
|
virtual const XAO::Type getType() { return XAO::DOUBLE; }
|
||||||
|
|
||||||
virtual Step* addNewStep(const int& step);
|
virtual Step* addNewStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
* @param step the number of the step.
|
* @param step the number of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
DoubleStep* addStep(const int& step);
|
DoubleStep* addStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
@ -62,14 +62,14 @@ namespace XAO
|
|||||||
* @param stamp the stamp of the step.
|
* @param stamp the stamp of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
DoubleStep* addStep(const int& step, const int& stamp);
|
DoubleStep* addStep(const int& step, const int& stamp) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the step of given index.
|
* Gets the step of given index.
|
||||||
* @param index the index.
|
* @param index the index.
|
||||||
* @return the step for the given index.
|
* @return the step for the given index.
|
||||||
*/
|
*/
|
||||||
DoubleStep* getStep(const int& index);
|
DoubleStep* getStep(const int& index) throw (XAO_Exception);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_DoubleStep.hxx"
|
#include "XAO_DoubleStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
|
|
||||||
@ -59,6 +57,7 @@ std::vector<double> DoubleStep::getValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> DoubleStep::getElement(const int& element)
|
std::vector<double> DoubleStep::getElement(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ std::vector<double> DoubleStep::getElement(const int& element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> DoubleStep::getComponent(const int& component)
|
std::vector<double> DoubleStep::getComponent(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ std::vector<double> DoubleStep::getComponent(const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const double DoubleStep::getValue(const int& element, const int& component)
|
const double DoubleStep::getValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -92,11 +93,13 @@ const double DoubleStep::getValue(const int& element, const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string DoubleStep::getStringValue(const int& element, const int& component)
|
const std::string DoubleStep::getStringValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return XaoUtils::doubleToString(getValue(element, component));
|
return XaoUtils::doubleToString(getValue(element, component));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoubleStep::setValues(const std::vector<double>& values)
|
void DoubleStep::setValues(const std::vector<double>& values)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkNbValues(values.size());
|
checkNbValues(values.size());
|
||||||
|
|
||||||
@ -110,6 +113,7 @@ void DoubleStep::setValues(const std::vector<double>& values)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoubleStep::setElements(const int& element, const std::vector<double>& elements)
|
void DoubleStep::setElements(const int& element, const std::vector<double>& elements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkNbComponents(elements.size());
|
checkNbComponents(elements.size());
|
||||||
@ -119,6 +123,7 @@ void DoubleStep::setElements(const int& element, const std::vector<double>& elem
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoubleStep::setComponents(const int& component, const std::vector<double>& components)
|
void DoubleStep::setComponents(const int& component, const std::vector<double>& components)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(component);
|
checkElementIndex(component);
|
||||||
checkNbElements(components.size());
|
checkNbElements(components.size());
|
||||||
@ -128,6 +133,7 @@ void DoubleStep::setComponents(const int& component, const std::vector<double>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoubleStep::setValue(const int& element, const int& component, const double& value)
|
void DoubleStep::setValue(const int& element, const int& component, const double& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -136,6 +142,7 @@ void DoubleStep::setValue(const int& element, const int& component, const double
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoubleStep::setStringValue(const int& element, const int& component, const std::string& value)
|
void DoubleStep::setStringValue(const int& element, const int& component, const std::string& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setValue(element, component, XaoUtils::stringToDouble(value));
|
setValue(element, component, XaoUtils::stringToDouble(value));
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,14 @@ namespace XAO
|
|||||||
* @param element the index of the element.
|
* @param element the index of the element.
|
||||||
* @return a vector containing all the values for the given element.
|
* @return a vector containing all the values for the given element.
|
||||||
*/
|
*/
|
||||||
std::vector<double> getElement(const int& element);
|
std::vector<double> getElement(const int& element) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the values for a given component.
|
* Gets all the values for a given component.
|
||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return a vector containing all the values for the given component.
|
* @return a vector containing all the values for the given component.
|
||||||
*/
|
*/
|
||||||
std::vector<double> getComponent(const int& component);
|
std::vector<double> getComponent(const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value for an element and a component.
|
* Gets the value for an element and a component.
|
||||||
@ -73,27 +73,27 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return the value for the given element and component.
|
* @return the value for the given element and component.
|
||||||
*/
|
*/
|
||||||
const double getValue(const int& element, const int& component);
|
const double getValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the values from a list.
|
* Sets all the values from a list.
|
||||||
* @param values the list of values to set.
|
* @param values the list of values to set.
|
||||||
*/
|
*/
|
||||||
void setValues(const std::vector<double>& values);
|
void setValues(const std::vector<double>& values) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for an element.
|
* Sets the values for an element.
|
||||||
* @param element the index of the element to set.
|
* @param element the index of the element to set.
|
||||||
* @param elements the values to set.
|
* @param elements the values to set.
|
||||||
*/
|
*/
|
||||||
void setElements(const int& element, const std::vector<double>& elements);
|
void setElements(const int& element, const std::vector<double>& elements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for a component.
|
* Sets the values for a component.
|
||||||
* @param component the index of the component to set.
|
* @param component the index of the component to set.
|
||||||
* @param components the values to set.
|
* @param components the values to set.
|
||||||
*/
|
*/
|
||||||
void setComponents(const int& component, const std::vector<double>& components);
|
void setComponents(const int& component, const std::vector<double>& components) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for an element and a component.
|
* Sets the value for an element and a component.
|
||||||
@ -101,10 +101,10 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @param value the value.
|
* @param value the value.
|
||||||
*/
|
*/
|
||||||
void setValue(const int& element, const int& component, const double& value);
|
void setValue(const int& element, const int& component, const double& value) throw (XAO_Exception);
|
||||||
|
|
||||||
virtual const std::string getStringValue(const int& element, const int& component);
|
virtual const std::string getStringValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
virtual void setStringValue(const int& element, const int& component, const std::string& value);
|
virtual void setStringValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::vector<double> > m_values;
|
std::vector< std::vector<double> > m_values;
|
||||||
|
28
src/XAO/XAO_Exception.hxx
Normal file
28
src/XAO/XAO_Exception.hxx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* XAO_Exception.hxx
|
||||||
|
*
|
||||||
|
* Created on: 12 sept. 2013
|
||||||
|
* Author: salome
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XAO_EXCEPTION_HXX__
|
||||||
|
#define __XAO_EXCEPTION_HXX__
|
||||||
|
|
||||||
|
namespace XAO
|
||||||
|
{
|
||||||
|
|
||||||
|
class XAO_Exception : public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XAO_Exception(const char* message) : m_message(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char* what() const throw () { return m_message; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* m_message;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __XAO_EXCEPTION_HXX__ */
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
#include "XAO_Field.hxx"
|
#include "XAO_Field.hxx"
|
||||||
@ -51,12 +50,14 @@ Field::~Field()
|
|||||||
|
|
||||||
Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension,
|
Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension,
|
||||||
const int& nbElements, const int& nbComponents)
|
const int& nbElements, const int& nbComponents)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return createField(type, "", dimension, nbElements, nbComponents);
|
return createField(type, "", dimension, nbElements, nbComponents);
|
||||||
}
|
}
|
||||||
|
|
||||||
Field* Field::createField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dimension,
|
Field* Field::createField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dimension,
|
||||||
const int& nbElements, const int& nbComponents)
|
const int& nbElements, const int& nbComponents)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (type == XAO::BOOLEAN)
|
if (type == XAO::BOOLEAN)
|
||||||
return new BooleanField(name, dimension, nbElements, nbComponents);
|
return new BooleanField(name, dimension, nbElements, nbComponents);
|
||||||
@ -67,16 +68,18 @@ Field* Field::createField(const XAO::Type& type, const std::string& name, const
|
|||||||
if (type == XAO::STRING)
|
if (type == XAO::STRING)
|
||||||
return new StringField(name, dimension, nbElements, nbComponents);
|
return new StringField(name, dimension, nbElements, nbComponents);
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad Type: " << type);
|
throw XAO_Exception(MsgBuilder() << "Bad Type: " << type);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string Field::getComponentName(const int& index)
|
const std::string Field::getComponentName(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponent(index);
|
checkComponent(index);
|
||||||
return m_components[index];
|
return m_components[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Field::setComponentName(const int& index, const std::string& name)
|
void Field::setComponentName(const int& index, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponent(index);
|
checkComponent(index);
|
||||||
m_components[index] = name;
|
m_components[index] = name;
|
||||||
@ -112,19 +115,21 @@ bool Field::hasStep(const int& step)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Field::checkComponent(const int& component)
|
void Field::checkComponent(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (component < m_nbComponents && component >= 0)
|
if (component < m_nbComponents && component >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, "
|
||||||
<< m_nbComponents << "]: " << component);
|
<< m_nbComponents << "]: " << component);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Field::checkStepIndex(const int& step)
|
void Field::checkStepIndex(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (step < m_steps.size() && step >= 0)
|
if (step < m_steps.size() && step >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, "
|
||||||
<< m_steps.size() << "]: " << step);
|
<< m_steps.size() << "]: " << step);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ namespace XAO
|
|||||||
* @return the created field.
|
* @return the created field.
|
||||||
*/
|
*/
|
||||||
static Field* createField(const XAO::Type& type, const XAO::Dimension& dimension,
|
static Field* createField(const XAO::Type& type, const XAO::Dimension& dimension,
|
||||||
const int& nbElements, const int& nbComponents);
|
const int& nbElements, const int& nbComponents)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
/**
|
/**
|
||||||
@ -71,7 +72,8 @@ namespace XAO
|
|||||||
* @return the created field.
|
* @return the created field.
|
||||||
*/
|
*/
|
||||||
static Field* createField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dimension,
|
static Field* createField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dimension,
|
||||||
const int& nbElements, const int& nbComponents);
|
const int& nbElements, const int& nbComponents)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
@ -149,14 +151,14 @@ namespace XAO
|
|||||||
* @param index the index of the component to get.
|
* @param index the index of the component to get.
|
||||||
* @return the name of the component for the given index.
|
* @return the name of the component for the given index.
|
||||||
*/
|
*/
|
||||||
const std::string getComponentName(const int& index);
|
const std::string getComponentName(const int& index) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of a component.
|
* Sets the name of a component.
|
||||||
* @param componentIndex the index of the component to set.
|
* @param componentIndex the index of the component to set.
|
||||||
* @param name the name to set.
|
* @param name the name to set.
|
||||||
*/
|
*/
|
||||||
void setComponentName(const int& componentIndex, const std::string& name);
|
void setComponentName(const int& componentIndex, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step of the same type than the field.
|
* Adds a new step of the same type than the field.
|
||||||
@ -192,9 +194,8 @@ namespace XAO
|
|||||||
stepIterator end() { return m_steps.end(); }
|
stepIterator end() { return m_steps.end(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Ensures that component is valid (< m_nbComponents). */
|
void checkComponent(const int& component) throw (XAO_Exception);
|
||||||
void checkComponent(const int& component);
|
void checkStepIndex(const int& step) throw (XAO_Exception);
|
||||||
void checkStepIndex(const int& step);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The name of the Field. */
|
/** The name of the Field. */
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_GeometricElement.hxx"
|
#include "XAO_GeometricElement.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
|
|
||||||
@ -68,14 +66,16 @@ void GeometricElementList::setSize(const int& nb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GeometricElementList::checkElementIndex(const int& index) const
|
void GeometricElementList::checkElementIndex(const int& index) const
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (m_count >= 0 && index < m_count)
|
if (m_count >= 0 && index < m_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Index of element is out of range [0, " << m_count<< "]: " << index);
|
throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, " << m_count<< "]: " << index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometricElementList::setElement(const int& index, const std::string& name, const std::string& reference)
|
void GeometricElementList::setElement(const int& index, const std::string& name, const std::string& reference)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
m_elements[index].setName(name);
|
m_elements[index].setName(name);
|
||||||
@ -83,36 +83,42 @@ void GeometricElementList::setElement(const int& index, const std::string& name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string GeometricElementList::getName(const int& index)
|
const std::string GeometricElementList::getName(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
return m_elements[index].getName();
|
return m_elements[index].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometricElementList::setName(const int& index, const std::string& name)
|
void GeometricElementList::setName(const int& index, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
m_elements[index].setName(name);
|
m_elements[index].setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool GeometricElementList::hasName(const int& index)
|
const bool GeometricElementList::hasName(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
return m_elements[index].hasName();
|
return m_elements[index].hasName();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string GeometricElementList::getReference(const int& index)
|
const std::string GeometricElementList::getReference(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
return m_elements[index].getReference();
|
return m_elements[index].getReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometricElementList::setReference(const int& index, const std::string& name)
|
void GeometricElementList::setReference(const int& index, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(index);
|
checkElementIndex(index);
|
||||||
m_elements[index].setReference(name);
|
m_elements[index].setReference(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int GeometricElementList::getIndexByReference(const std::string& ref)
|
const int GeometricElementList::getIndexByReference(const std::string& ref)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
for (int index = 0; index < m_count; ++index)
|
for (int index = 0; index < m_count; ++index)
|
||||||
{
|
{
|
||||||
@ -120,5 +126,5 @@ const int GeometricElementList::getIndexByReference(const std::string& ref)
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Reference not found: " << ref);
|
throw XAO_Exception(MsgBuilder() << "Reference not found: " << ref);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "XAO_Exception.hxx"
|
||||||
|
|
||||||
namespace XAO
|
namespace XAO
|
||||||
{
|
{
|
||||||
@ -136,52 +137,52 @@ namespace XAO
|
|||||||
* \param index the index of the element to set.
|
* \param index the index of the element to set.
|
||||||
* \param name the name to set.
|
* \param name the name to set.
|
||||||
* \param reference the reference to set.
|
* \param reference the reference to set.
|
||||||
* \throw SALOME_Exception if index is bigger than the size of the list.
|
* \throw XAO_Exception if index is bigger than the size of the list.
|
||||||
*/
|
*/
|
||||||
void setElement(const int& index, const std::string& name, const std::string& reference);
|
void setElement(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Gets the name of an element.
|
* Gets the name of an element.
|
||||||
* \param index the index of the element to set.
|
* \param index the index of the element to set.
|
||||||
* \return the name of the element with the given index.
|
* \return the name of the element with the given index.
|
||||||
* \throw SALOME_Exception if index is bigger than the size of the list.
|
* \throw XAO_Exception if index is bigger than the size of the list.
|
||||||
*/
|
*/
|
||||||
const std::string getName(const int& index);
|
const std::string getName(const int& index) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Sets the name of an element.
|
* Sets the name of an element.
|
||||||
* \param index the index of the element.
|
* \param index the index of the element.
|
||||||
* \param name the name to set.
|
* \param name the name to set.
|
||||||
* \throw SALOME_Exception if index is bigger than the size of the list.
|
* \throw XAO_Exception if index is bigger than the size of the list.
|
||||||
*/
|
*/
|
||||||
void setName(const int& index, const std::string& name);
|
void setName(const int& index, const std::string& name) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an element has a name.
|
* Checks if an element has a name.
|
||||||
* @param index the index of the element.
|
* @param index the index of the element.
|
||||||
* @return true if the element has a name, false otherwise.
|
* @return true if the element has a name, false otherwise.
|
||||||
*/
|
*/
|
||||||
const bool hasName(const int& index);
|
const bool hasName(const int& index) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the reference of an element.
|
* Gets the reference of an element.
|
||||||
* \param index the index of the element.
|
* \param index the index of the element.
|
||||||
* \return the reference of the element.
|
* \return the reference of the element.
|
||||||
* \throw SALOME_Exception if index is bigger than the size of the list.
|
* \throw XAO_Exception if index is bigger than the size of the list.
|
||||||
*/
|
*/
|
||||||
const std::string getReference(const int& index);
|
const std::string getReference(const int& index) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Sets the reference of an element.
|
* Sets the reference of an element.
|
||||||
* \param index the index of the element to set.
|
* \param index the index of the element to set.
|
||||||
* \param reference the reference to set.
|
* \param reference the reference to set.
|
||||||
* \throw SALOME_Exception if index is bigger than the size of the list.
|
* \throw XAO_Exception if index is bigger than the size of the list.
|
||||||
*/
|
*/
|
||||||
void setReference(const int& index, const std::string& reference);
|
void setReference(const int& index, const std::string& reference) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index of an element using its reference.
|
* Gets the index of an element using its reference.
|
||||||
* \param reference the searched reference.
|
* \param reference the searched reference.
|
||||||
* \return the index of the element or -1 if no element found.
|
* \return the index of the element or -1 if no element found.
|
||||||
*/
|
*/
|
||||||
const int getIndexByReference(const std::string& reference);
|
const int getIndexByReference(const std::string& reference) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterator on the element of the list.
|
* Iterator on the element of the list.
|
||||||
@ -201,7 +202,7 @@ namespace XAO
|
|||||||
iterator end() { return m_elements.end(); }
|
iterator end() { return m_elements.end(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkElementIndex(const int& index) const;
|
void checkElementIndex(const int& index) const throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_count;
|
int m_count;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Nathalie Gore (OpenCascade)
|
// Author : Nathalie Gore (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
#include "XAO_Geometry.hxx"
|
#include "XAO_Geometry.hxx"
|
||||||
#include "XAO_BrepGeometry.hxx"
|
#include "XAO_BrepGeometry.hxx"
|
||||||
@ -32,23 +30,26 @@ Geometry::Geometry(const std::string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Geometry* Geometry::createGeometry(const XAO::Format& format)
|
Geometry* Geometry::createGeometry(const XAO::Format& format)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return createGeometry(format, "");
|
return createGeometry(format, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry* Geometry::createGeometry(const XAO::Format& format, const std::string& name)
|
Geometry* Geometry::createGeometry(const XAO::Format& format, const std::string& name)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (format == XAO::BREP)
|
if (format == XAO::BREP)
|
||||||
return new BrepGeometry(name);
|
return new BrepGeometry(name);
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Geometry format not supported: " << format);
|
throw XAO_Exception(MsgBuilder() << "Geometry format not supported: " << format);
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry::~Geometry()
|
Geometry::~Geometry()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const int Geometry::countElements(const XAO::Dimension& dim)
|
const int Geometry::countElements(const XAO::Dimension& dim) const
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return countVertices();
|
return countVertices();
|
||||||
@ -59,10 +60,11 @@ const int Geometry::countElements(const XAO::Dimension& dim)
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return countSolids();
|
return countSolids();
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string Geometry::getElementReference(const XAO::Dimension& dim, const int& index)
|
const std::string Geometry::getElementReference(const XAO::Dimension& dim, const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return getVertexReference(index);
|
return getVertexReference(index);
|
||||||
@ -73,10 +75,11 @@ const std::string Geometry::getElementReference(const XAO::Dimension& dim, const
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return getSolidReference(index);
|
return getSolidReference(index);
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int Geometry::getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference)
|
const int Geometry::getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return getVertexIndexByReference(reference);
|
return getVertexIndexByReference(reference);
|
||||||
@ -87,10 +90,11 @@ const int Geometry::getElementIndexByReference(const XAO::Dimension& dim, const
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return getSolidIndexByReference(reference);
|
return getSolidIndexByReference(reference);
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometricElementList::iterator Geometry::begin(const XAO::Dimension& dim)
|
GeometricElementList::iterator Geometry::begin(const XAO::Dimension& dim)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return m_vertices.begin();
|
return m_vertices.begin();
|
||||||
@ -101,10 +105,11 @@ GeometricElementList::iterator Geometry::begin(const XAO::Dimension& dim)
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return m_solids.begin();
|
return m_solids.begin();
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometricElementList::iterator Geometry::end(const XAO::Dimension& dim)
|
GeometricElementList::iterator Geometry::end(const XAO::Dimension& dim)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::VERTEX)
|
if (dim == XAO::VERTEX)
|
||||||
return m_vertices.end();
|
return m_vertices.end();
|
||||||
@ -115,5 +120,5 @@ GeometricElementList::iterator Geometry::end(const XAO::Dimension& dim)
|
|||||||
if (dim == XAO::SOLID)
|
if (dim == XAO::SOLID)
|
||||||
return m_solids.end();
|
return m_solids.end();
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace XAO
|
|||||||
* @param format the format of the geometry.
|
* @param format the format of the geometry.
|
||||||
* @return the created geometry.
|
* @return the created geometry.
|
||||||
*/
|
*/
|
||||||
static Geometry* createGeometry(const XAO::Format& format);
|
static Geometry* createGeometry(const XAO::Format& format) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -55,7 +55,8 @@ namespace XAO
|
|||||||
* @name name the name of the geometry.
|
* @name name the name of the geometry.
|
||||||
* @return the created geometry.
|
* @return the created geometry.
|
||||||
*/
|
*/
|
||||||
static Geometry* createGeometry(const XAO::Format& format, const std::string& name);
|
static Geometry* createGeometry(const XAO::Format& format, const std::string& name)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~Geometry();
|
~Geometry();
|
||||||
@ -86,37 +87,37 @@ namespace XAO
|
|||||||
virtual const std::string getShape() = 0;
|
virtual const std::string getShape() = 0;
|
||||||
virtual void setShape(const std::string& shape) = 0;
|
virtual void setShape(const std::string& shape) = 0;
|
||||||
|
|
||||||
const int countElements(const XAO::Dimension& dim);
|
const int countElements(const XAO::Dimension& dim) const throw (XAO_Exception);
|
||||||
const int countVertices() { return m_vertices.getSize(); }
|
const int countVertices() const { return m_vertices.getSize(); }
|
||||||
const int countEdges() { return m_edges.getSize(); }
|
const int countEdges() const { return m_edges.getSize(); }
|
||||||
const int countFaces() { return m_faces.getSize(); }
|
const int countFaces() const { return m_faces.getSize(); }
|
||||||
const int countSolids() { return m_solids.getSize(); }
|
const int countSolids() const { return m_solids.getSize(); }
|
||||||
|
|
||||||
void setCountVertices(const int& nb) { m_vertices.setSize(nb); }
|
void setCountVertices(const int& nb) { m_vertices.setSize(nb); }
|
||||||
void setCountEdges(const int& nb) { m_edges.setSize(nb); }
|
void setCountEdges(const int& nb) { m_edges.setSize(nb); }
|
||||||
void setCountFaces(const int& nb) { m_faces.setSize(nb); }
|
void setCountFaces(const int& nb) { m_faces.setSize(nb); }
|
||||||
void setCountSolids(const int& nb) { m_solids.setSize(nb); }
|
void setCountSolids(const int& nb) { m_solids.setSize(nb); }
|
||||||
|
|
||||||
const std::string getVertexName(const int& index) { return m_vertices.getName(index); }
|
const std::string getVertexName(const int& index) throw (XAO_Exception) { return m_vertices.getName(index); }
|
||||||
const std::string getEdgeName(const int& index) { return m_edges.getName(index); }
|
const std::string getEdgeName(const int& index) throw (XAO_Exception) { return m_edges.getName(index); }
|
||||||
const std::string getFaceName(const int& index) { return m_faces.getName(index); }
|
const std::string getFaceName(const int& index) throw (XAO_Exception) { return m_faces.getName(index); }
|
||||||
const std::string getSolidName(const int& index) { return m_solids.getName(index); }
|
const std::string getSolidName(const int& index) throw (XAO_Exception) { return m_solids.getName(index); }
|
||||||
|
|
||||||
void setVertexName(const int& index, const std::string& name) { m_vertices.setName(index, name); }
|
void setVertexName(const int& index, const std::string& name) throw (XAO_Exception) { m_vertices.setName(index, name); }
|
||||||
void setEdgeName(const int& index, const std::string& name) { m_edges.setName(index, name); }
|
void setEdgeName(const int& index, const std::string& name) throw (XAO_Exception) { m_edges.setName(index, name); }
|
||||||
void setFaceName(const int& index, const std::string& name) { m_faces.setName(index, name); }
|
void setFaceName(const int& index, const std::string& name) throw (XAO_Exception) { m_faces.setName(index, name); }
|
||||||
void setSolidName(const int& index, const std::string& name) { m_solids.setName(index, name); }
|
void setSolidName(const int& index, const std::string& name) throw (XAO_Exception) { m_solids.setName(index, name); }
|
||||||
|
|
||||||
const bool hasVertexName(const int& index) { return m_vertices.hasName(index); }
|
const bool hasVertexName(const int& index) throw (XAO_Exception) { return m_vertices.hasName(index); }
|
||||||
const bool hasEdgeName(const int& index) { return m_edges.hasName(index); }
|
const bool hasEdgeName(const int& index) throw (XAO_Exception) { return m_edges.hasName(index); }
|
||||||
const bool hasFaceName(const int& index) { return m_faces.hasName(index); }
|
const bool hasFaceName(const int& index) throw (XAO_Exception) { return m_faces.hasName(index); }
|
||||||
const bool hasSolidName(const int& index) { return m_solids.hasName(index); }
|
const bool hasSolidName(const int& index) throw (XAO_Exception) { return m_solids.hasName(index); }
|
||||||
|
|
||||||
const std::string getVertexReference(const int& index) { return m_vertices.getReference(index); }
|
const std::string getVertexReference(const int& index) { return m_vertices.getReference(index); }
|
||||||
const std::string getEdgeReference(const int& index) { return m_edges.getReference(index); }
|
const std::string getEdgeReference(const int& index) { return m_edges.getReference(index); }
|
||||||
const std::string getFaceReference(const int& index) { return m_faces.getReference(index); }
|
const std::string getFaceReference(const int& index) { return m_faces.getReference(index); }
|
||||||
const std::string getSolidReference(const int& index) { return m_solids.getReference(index); }
|
const std::string getSolidReference(const int& index) { return m_solids.getReference(index); }
|
||||||
const std::string getElementReference(const XAO::Dimension& dim, const int& index);
|
const std::string getElementReference(const XAO::Dimension& dim, const int& index) throw (XAO_Exception);
|
||||||
|
|
||||||
void setVertexReference(const int& index, const std::string& reference) { m_vertices.setReference(index, reference); }
|
void setVertexReference(const int& index, const std::string& reference) { m_vertices.setReference(index, reference); }
|
||||||
void setEdgeReference(const int& index, const std::string& reference) { m_edges.setReference(index, reference); }
|
void setEdgeReference(const int& index, const std::string& reference) { m_edges.setReference(index, reference); }
|
||||||
@ -132,10 +133,10 @@ namespace XAO
|
|||||||
const int getEdgeIndexByReference(const std::string& reference) { return m_edges.getIndexByReference(reference); }
|
const int getEdgeIndexByReference(const std::string& reference) { return m_edges.getIndexByReference(reference); }
|
||||||
const int getFaceIndexByReference(const std::string& reference) { return m_faces.getIndexByReference(reference); }
|
const int getFaceIndexByReference(const std::string& reference) { return m_faces.getIndexByReference(reference); }
|
||||||
const int getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); }
|
const int getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); }
|
||||||
const int getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference);
|
const int getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference) throw (XAO_Exception);
|
||||||
|
|
||||||
GeometricElementList::iterator begin(const XAO::Dimension& dim);
|
GeometricElementList::iterator begin(const XAO::Dimension& dim) throw (XAO_Exception);
|
||||||
GeometricElementList::iterator end(const XAO::Dimension& dim);
|
GeometricElementList::iterator end(const XAO::Dimension& dim) throw (XAO_Exception);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade)
|
// Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
#include "XAO_Group.hxx"
|
#include "XAO_Group.hxx"
|
||||||
|
|
||||||
@ -27,19 +25,22 @@ using namespace XAO;
|
|||||||
|
|
||||||
|
|
||||||
Group::Group(const XAO::Dimension& dim, const int& nbElements)
|
Group::Group(const XAO::Dimension& dim, const int& nbElements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
initGroup("", dim, nbElements);
|
initGroup("", dim, nbElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::Group(const std::string& name, const XAO::Dimension& dim, const int& nbElements)
|
Group::Group(const std::string& name, const XAO::Dimension& dim, const int& nbElements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
initGroup(name, dim, nbElements);
|
initGroup(name, dim, nbElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::initGroup(const std::string& name, const XAO::Dimension& dim, const int& nbElements)
|
void Group::initGroup(const std::string& name, const XAO::Dimension& dim, const int& nbElements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dim == XAO::WHOLE)
|
if (dim == XAO::WHOLE)
|
||||||
throw SALOME_Exception("Dimension WHOLE is not valid for group.");
|
throw XAO_Exception("Dimension WHOLE is not valid for group.");
|
||||||
|
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_dimension = dim;
|
m_dimension = dim;
|
||||||
@ -52,12 +53,13 @@ Group::~Group()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Group::checkIndex(const int& element)
|
void Group::checkIndex(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (element < m_elements.size() && element >= 0)
|
if (element < m_elements.size() && element >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Index of element is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, "
|
||||||
<< m_elements.size()-1 << "]: " << element);
|
<< m_elements.size()-1 << "]: " << element);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::add(const int& value)
|
void Group::add(const int& value)
|
||||||
|
@ -40,7 +40,7 @@ namespace XAO
|
|||||||
* @param dim the dimension of the group.
|
* @param dim the dimension of the group.
|
||||||
* @param nbElements the number of geometrical elements for the dimension in the geometry.
|
* @param nbElements the number of geometrical elements for the dimension in the geometry.
|
||||||
*/
|
*/
|
||||||
Group(const XAO::Dimension& dim, const int& nbElements);
|
Group(const XAO::Dimension& dim, const int& nbElements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -48,7 +48,7 @@ namespace XAO
|
|||||||
* @param dim the dimension of the group.
|
* @param dim the dimension of the group.
|
||||||
* @param nbElements the number of geometrical elements for the dimension in the geometry.
|
* @param nbElements the number of geometrical elements for the dimension in the geometry.
|
||||||
*/
|
*/
|
||||||
Group(const std::string& name, const XAO::Dimension& dim, const int& nbelements);
|
Group(const std::string& name, const XAO::Dimension& dim, const int& nbelements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
@ -144,14 +144,16 @@ namespace XAO
|
|||||||
* @param dim the dimension of the group.
|
* @param dim the dimension of the group.
|
||||||
* @param nbElements the number of elements in the geometry for the dimension.
|
* @param nbElements the number of elements in the geometry for the dimension.
|
||||||
*/
|
*/
|
||||||
void initGroup(const std::string& name, const XAO::Dimension& dim, const int& nbElements);
|
void initGroup(const std::string& name, const XAO::Dimension& dim, const int& nbElements)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that the given element is valid.
|
* Ensures that the given element is valid.
|
||||||
* @param element
|
* @param element
|
||||||
* @throw SALOME_Exception if element is bigger than the number of elements.
|
* @throw XAO_Exception if element is bigger than the number of elements.
|
||||||
*/
|
*/
|
||||||
void checkIndex(const int& element);
|
void checkIndex(const int& element)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The name of the group. */
|
/** The name of the group. */
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_IntegerField.hxx"
|
#include "XAO_IntegerField.hxx"
|
||||||
#include "XAO_IntegerStep.hxx"
|
#include "XAO_IntegerStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
@ -32,19 +30,22 @@ IntegerField::IntegerField(const std::string& name, const XAO::Dimension& dimens
|
|||||||
}
|
}
|
||||||
|
|
||||||
Step* IntegerField::addNewStep(const int& step)
|
Step* IntegerField::addNewStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntegerStep* IntegerField::addStep(const int& step)
|
IntegerStep* IntegerField::addStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntegerStep* IntegerField::addStep(const int& step, const int& stamp)
|
IntegerStep* IntegerField::addStep(const int& step, const int& stamp)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (hasStep(step))
|
if (hasStep(step))
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
throw XAO_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
||||||
|
|
||||||
IntegerStep* bstep = new IntegerStep(step, stamp, m_nbElements, m_nbComponents);
|
IntegerStep* bstep = new IntegerStep(step, stamp, m_nbElements, m_nbComponents);
|
||||||
m_steps.push_back(bstep);
|
m_steps.push_back(bstep);
|
||||||
@ -52,6 +53,7 @@ IntegerStep* IntegerField::addStep(const int& step, const int& stamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntegerStep* IntegerField::getStep(const int& index)
|
IntegerStep* IntegerField::getStep(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkStepIndex(index);
|
checkStepIndex(index);
|
||||||
return (IntegerStep*)m_steps[index];
|
return (IntegerStep*)m_steps[index];
|
||||||
|
@ -47,14 +47,14 @@ namespace XAO
|
|||||||
|
|
||||||
virtual const XAO::Type getType() { return XAO::INTEGER; }
|
virtual const XAO::Type getType() { return XAO::INTEGER; }
|
||||||
|
|
||||||
virtual Step* addNewStep(const int& step);
|
virtual Step* addNewStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
* @param step the number of the step.
|
* @param step the number of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
IntegerStep* addStep(const int& step);
|
IntegerStep* addStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
@ -62,14 +62,14 @@ namespace XAO
|
|||||||
* @param stamp the stamp of the step.
|
* @param stamp the stamp of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
IntegerStep* addStep(const int& step, const int& stamp);
|
IntegerStep* addStep(const int& step, const int& stamp) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the step of given index.
|
* Gets the step of given index.
|
||||||
* @param index the index of the step.
|
* @param index the index of the step.
|
||||||
* @return the step for the given index.
|
* @return the step for the given index.
|
||||||
*/
|
*/
|
||||||
IntegerStep* getStep(const int& index);
|
IntegerStep* getStep(const int& index) throw (XAO_Exception);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_IntegerStep.hxx"
|
#include "XAO_IntegerStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
|
|
||||||
@ -59,6 +57,7 @@ std::vector<int> IntegerStep::getValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> IntegerStep::getElement(const int& element)
|
std::vector<int> IntegerStep::getElement(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ std::vector<int> IntegerStep::getElement(const int& element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> IntegerStep::getComponent(const int& component)
|
std::vector<int> IntegerStep::getComponent(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ std::vector<int> IntegerStep::getComponent(const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int IntegerStep::getValue(const int& element, const int& component)
|
const int IntegerStep::getValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -92,11 +93,13 @@ const int IntegerStep::getValue(const int& element, const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string IntegerStep::getStringValue(const int& element, const int& component)
|
const std::string IntegerStep::getStringValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return XaoUtils::intToString(getValue(element, component));
|
return XaoUtils::intToString(getValue(element, component));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegerStep::setValues(const std::vector<int>& values)
|
void IntegerStep::setValues(const std::vector<int>& values)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkNbValues(values.size());
|
checkNbValues(values.size());
|
||||||
|
|
||||||
@ -110,6 +113,7 @@ void IntegerStep::setValues(const std::vector<int>& values)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntegerStep::setElements(const int& element, const std::vector<int>& elements)
|
void IntegerStep::setElements(const int& element, const std::vector<int>& elements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkNbComponents(elements.size());
|
checkNbComponents(elements.size());
|
||||||
@ -119,6 +123,7 @@ void IntegerStep::setElements(const int& element, const std::vector<int>& elemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntegerStep::setComponents(const int& component, const std::vector<int>& components)
|
void IntegerStep::setComponents(const int& component, const std::vector<int>& components)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(component);
|
checkElementIndex(component);
|
||||||
checkNbElements(components.size());
|
checkNbElements(components.size());
|
||||||
@ -128,6 +133,7 @@ void IntegerStep::setComponents(const int& component, const std::vector<int>& co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntegerStep::setValue(const int& element, const int& component, const int& value)
|
void IntegerStep::setValue(const int& element, const int& component, const int& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -136,6 +142,7 @@ void IntegerStep::setValue(const int& element, const int& component, const int&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntegerStep::setStringValue(const int& element, const int& component, const std::string& value)
|
void IntegerStep::setStringValue(const int& element, const int& component, const std::string& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setValue(element, component, XaoUtils::stringToInt(value));
|
setValue(element, component, XaoUtils::stringToInt(value));
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,14 @@ namespace XAO
|
|||||||
* @param element the index of the element.
|
* @param element the index of the element.
|
||||||
* @return a vector containing all the values for the given element.
|
* @return a vector containing all the values for the given element.
|
||||||
*/
|
*/
|
||||||
std::vector<int> getElement(const int& element);
|
std::vector<int> getElement(const int& element) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the values for a given component.
|
* Gets all the values for a given component.
|
||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return a vector containing all the values for the given component.
|
* @return a vector containing all the values for the given component.
|
||||||
*/
|
*/
|
||||||
std::vector<int> getComponent(const int& component);
|
std::vector<int> getComponent(const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value for an element and a component.
|
* Gets the value for an element and a component.
|
||||||
@ -73,27 +73,27 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return the value for the given element and component.
|
* @return the value for the given element and component.
|
||||||
*/
|
*/
|
||||||
const int getValue(const int& element, const int& component);
|
const int getValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the values from a list.
|
* Sets all the values from a list.
|
||||||
* @param values the list of values to set.
|
* @param values the list of values to set.
|
||||||
*/
|
*/
|
||||||
void setValues(const std::vector<int>& values);
|
void setValues(const std::vector<int>& values) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for an element.
|
* Sets the values for an element.
|
||||||
* @param element the index of the element to set.
|
* @param element the index of the element to set.
|
||||||
* @param elements the values to set.
|
* @param elements the values to set.
|
||||||
*/
|
*/
|
||||||
void setElements(const int& element, const std::vector<int>& elements);
|
void setElements(const int& element, const std::vector<int>& elements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for a component.
|
* Sets the values for a component.
|
||||||
* @param component the index of the component to set.
|
* @param component the index of the component to set.
|
||||||
* @param components the values to set.
|
* @param components the values to set.
|
||||||
*/
|
*/
|
||||||
void setComponents(const int& component, const std::vector<int>& components);
|
void setComponents(const int& component, const std::vector<int>& components) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for an element and a component.
|
* Sets the value for an element and a component.
|
||||||
@ -101,10 +101,10 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @param value the value.
|
* @param value the value.
|
||||||
*/
|
*/
|
||||||
void setValue(const int& element, const int& component, const int& value);
|
void setValue(const int& element, const int& component, const int& value) throw (XAO_Exception);
|
||||||
|
|
||||||
virtual const std::string getStringValue(const int& element, const int& component);
|
virtual const std::string getStringValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
virtual void setStringValue(const int& element, const int& component, const std::string& value);
|
virtual void setStringValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::vector<int> > m_values;
|
std::vector< std::vector<int> > m_values;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
#include "XAO_Step.hxx"
|
#include "XAO_Step.hxx"
|
||||||
@ -31,46 +29,51 @@
|
|||||||
using namespace XAO;
|
using namespace XAO;
|
||||||
|
|
||||||
void Step::checkElementIndex(const int& element)
|
void Step::checkElementIndex(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (element < m_nbElements && element >= 0)
|
if (element < m_nbElements && element >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Element index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Element index is out of range [0, "
|
||||||
<< m_nbElements-1 << "]: " << element);
|
<< m_nbElements-1 << "]: " << element);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Step::checkComponentIndex(const int& component)
|
void Step::checkComponentIndex(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (component < m_nbComponents && component >= 0)
|
if (component < m_nbComponents && component >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Component index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Component index is out of range [0, "
|
||||||
<< m_nbComponents-1 << "]: " << component);
|
<< m_nbComponents-1 << "]: " << component);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Step::checkNbElements(const int& nbElements)
|
void Step::checkNbElements(const int& nbElements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (nbElements == m_nbElements)
|
if (nbElements == m_nbElements)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Invalid number of elements: " << nbElements
|
throw XAO_Exception(MsgBuilder() << "Invalid number of elements: " << nbElements
|
||||||
<< ", expected " << m_nbElements);
|
<< ", expected " << m_nbElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Step::checkNbComponents(const int& nbComponents)
|
void Step::checkNbComponents(const int& nbComponents)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (nbComponents == m_nbComponents)
|
if (nbComponents == m_nbComponents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Invalid number of components: " << nbComponents
|
throw XAO_Exception(MsgBuilder() << "Invalid number of components: " << nbComponents
|
||||||
<< ", expected " << m_nbComponents);
|
<< ", expected " << m_nbComponents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Step::checkNbValues(const int& nbValues)
|
void Step::checkNbValues(const int& nbValues)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (nbValues == m_nbElements * m_nbComponents)
|
if (nbValues == m_nbElements * m_nbComponents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Invalid number of values:" << nbValues
|
throw XAO_Exception(MsgBuilder() << "Invalid number of values:" << nbValues
|
||||||
<< ", expected " << m_nbElements * m_nbComponents);
|
<< ", expected " << m_nbElements * m_nbComponents);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace XAO
|
|||||||
* @param element the index of the element.
|
* @param element the index of the element.
|
||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @param value the string value.
|
* @param value the string value.
|
||||||
* @throw SALOME_Exception if the value is not valid.
|
* @throw XAO_Exception if the value is not valid.
|
||||||
*/
|
*/
|
||||||
virtual void setStringValue(const int& element, const int& component, const std::string& value) = 0;
|
virtual void setStringValue(const int& element, const int& component, const std::string& value) = 0;
|
||||||
|
|
||||||
@ -112,30 +112,30 @@ namespace XAO
|
|||||||
* Checks that given element index is in the range of element indexes.
|
* Checks that given element index is in the range of element indexes.
|
||||||
* @param element the index to check.
|
* @param element the index to check.
|
||||||
*/
|
*/
|
||||||
void checkElementIndex(const int& element);
|
void checkElementIndex(const int& element) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Checks that given component index is in the range of component indexes.
|
* Checks that given component index is in the range of component indexes.
|
||||||
* @param component the index to check.
|
* @param component the index to check.
|
||||||
*/
|
*/
|
||||||
void checkComponentIndex(const int& component);
|
void checkComponentIndex(const int& component)throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the given number of elements is correct.
|
* Checks that the given number of elements is correct.
|
||||||
* @param nbElements the number of elements to check.
|
* @param nbElements the number of elements to check.
|
||||||
*/
|
*/
|
||||||
void checkNbElements(const int& nbElements);
|
void checkNbElements(const int& nbElements)throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the given number of components is correct.
|
* Checks that the given number of components is correct.
|
||||||
* @param nbComponents the number of components to check.
|
* @param nbComponents the number of components to check.
|
||||||
*/
|
*/
|
||||||
void checkNbComponents(const int& nbComponents);
|
void checkNbComponents(const int& nbComponents)throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks that the given number of values is correct.
|
* checks that the given number of values is correct.
|
||||||
* @param nbValues the number of values to check.
|
* @param nbValues the number of values to check.
|
||||||
*/
|
*/
|
||||||
void checkNbValues(const int& nbValues);
|
void checkNbValues(const int& nbValues)throw (XAO_Exception);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** the index of the step. */
|
/** the index of the step. */
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_StringField.hxx"
|
#include "XAO_StringField.hxx"
|
||||||
#include "XAO_StringStep.hxx"
|
#include "XAO_StringStep.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
@ -32,19 +30,22 @@ StringField::StringField(const std::string& name, const XAO::Dimension& dimensio
|
|||||||
}
|
}
|
||||||
|
|
||||||
Step* StringField::addNewStep(const int& step)
|
Step* StringField::addNewStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringStep* StringField::addStep(const int& step)
|
StringStep* StringField::addStep(const int& step)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addStep(step, 0);
|
return addStep(step, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringStep* StringField::addStep(const int& step, const int& stamp)
|
StringStep* StringField::addStep(const int& step, const int& stamp)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
if (hasStep(step))
|
if (hasStep(step))
|
||||||
throw SALOME_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
throw XAO_Exception(MsgBuilder() << "Step with number " << step << "already exists.");
|
||||||
|
|
||||||
StringStep* bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents);
|
StringStep* bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents);
|
||||||
m_steps.push_back(bstep);
|
m_steps.push_back(bstep);
|
||||||
@ -52,6 +53,7 @@ StringStep* StringField::addStep(const int& step, const int& stamp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
StringStep* StringField::getStep(const int& index)
|
StringStep* StringField::getStep(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkStepIndex(index);
|
checkStepIndex(index);
|
||||||
return (StringStep*)m_steps[index];
|
return (StringStep*)m_steps[index];
|
||||||
|
@ -47,14 +47,14 @@ namespace XAO
|
|||||||
|
|
||||||
virtual const XAO::Type getType() { return XAO::STRING; }
|
virtual const XAO::Type getType() { return XAO::STRING; }
|
||||||
|
|
||||||
virtual Step* addNewStep(const int& step);
|
virtual Step* addNewStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
* @param step the number of the step.
|
* @param step the number of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
StringStep* addStep(const int& step);
|
StringStep* addStep(const int& step) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new step.
|
* Adds a new step.
|
||||||
@ -62,14 +62,14 @@ namespace XAO
|
|||||||
* @param stamp the stamp of the step.
|
* @param stamp the stamp of the step.
|
||||||
* @return the newly created step.
|
* @return the newly created step.
|
||||||
*/
|
*/
|
||||||
StringStep* addStep(const int& step, const int& stamp);
|
StringStep* addStep(const int& step, const int& stamp) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the step of given index.
|
* Gets the step of given index.
|
||||||
* @param index the index of the step.
|
* @param index the index of the step.
|
||||||
* @return the step for the given index.
|
* @return the step for the given index.
|
||||||
*/
|
*/
|
||||||
StringStep* getStep(const int& index);
|
StringStep* getStep(const int& index) throw (XAO_Exception);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_StringStep.hxx"
|
#include "XAO_StringStep.hxx"
|
||||||
|
|
||||||
using namespace XAO;
|
using namespace XAO;
|
||||||
@ -58,6 +56,7 @@ std::vector<std::string> StringStep::getValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> StringStep::getElement(const int& element)
|
std::vector<std::string> StringStep::getElement(const int& element)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
|
|
||||||
@ -66,6 +65,7 @@ std::vector<std::string> StringStep::getElement(const int& element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> StringStep::getComponent(const int& component)
|
std::vector<std::string> StringStep::getComponent(const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
|
|
||||||
@ -83,6 +83,7 @@ std::vector<std::string> StringStep::getComponent(const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string StringStep::getValue(const int& element, const int& component)
|
const std::string StringStep::getValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -91,11 +92,13 @@ const std::string StringStep::getValue(const int& element, const int& component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string StringStep::getStringValue(const int& element, const int& component)
|
const std::string StringStep::getStringValue(const int& element, const int& component)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return getValue(element, component);
|
return getValue(element, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringStep::setValues(const std::vector<std::string>& values)
|
void StringStep::setValues(const std::vector<std::string>& values)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkNbValues(values.size());
|
checkNbValues(values.size());
|
||||||
|
|
||||||
@ -109,6 +112,7 @@ void StringStep::setValues(const std::vector<std::string>& values)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StringStep::setElements(const int& element, const std::vector<std::string>& elements)
|
void StringStep::setElements(const int& element, const std::vector<std::string>& elements)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkNbComponents(elements.size());
|
checkNbComponents(elements.size());
|
||||||
@ -118,6 +122,7 @@ void StringStep::setElements(const int& element, const std::vector<std::string>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StringStep::setComponents(const int& component, const std::vector<std::string>& components)
|
void StringStep::setComponents(const int& component, const std::vector<std::string>& components)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(component);
|
checkElementIndex(component);
|
||||||
checkNbElements(components.size());
|
checkNbElements(components.size());
|
||||||
@ -127,6 +132,7 @@ void StringStep::setComponents(const int& component, const std::vector<std::stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StringStep::setValue(const int& element, const int& component, const std::string& value)
|
void StringStep::setValue(const int& element, const int& component, const std::string& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkElementIndex(element);
|
checkElementIndex(element);
|
||||||
checkComponentIndex(component);
|
checkComponentIndex(component);
|
||||||
@ -135,6 +141,7 @@ void StringStep::setValue(const int& element, const int& component, const std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StringStep::setStringValue(const int& element, const int& component, const std::string& value)
|
void StringStep::setStringValue(const int& element, const int& component, const std::string& value)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
setValue(element, component, value);
|
setValue(element, component, value);
|
||||||
}
|
}
|
||||||
|
@ -59,14 +59,14 @@ namespace XAO
|
|||||||
* @param element the index of the element.
|
* @param element the index of the element.
|
||||||
* @return a vector containing all the values for the given element.
|
* @return a vector containing all the values for the given element.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getElement(const int& element);
|
std::vector<std::string> getElement(const int& element) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the values for a given component.
|
* Gets all the values for a given component.
|
||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return a vector containing all the values for the given component.
|
* @return a vector containing all the values for the given component.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getComponent(const int& component);
|
std::vector<std::string> getComponent(const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value for an element and a component.
|
* Gets the value for an element and a component.
|
||||||
@ -74,27 +74,27 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @return the value for the given element and component.
|
* @return the value for the given element and component.
|
||||||
*/
|
*/
|
||||||
const std::string getValue(const int& element, const int& component);
|
const std::string getValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the values from a list.
|
* Sets all the values from a list.
|
||||||
* @param values the list of values to set.
|
* @param values the list of values to set.
|
||||||
*/
|
*/
|
||||||
void setValues(const std::vector<std::string>& values);
|
void setValues(const std::vector<std::string>& values) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for an element.
|
* Sets the values for an element.
|
||||||
* @param element the index of the element to set.
|
* @param element the index of the element to set.
|
||||||
* @param elements the values to set.
|
* @param elements the values to set.
|
||||||
*/
|
*/
|
||||||
void setElements(const int& element, const std::vector<std::string>& elements);
|
void setElements(const int& element, const std::vector<std::string>& elements) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the values for a component.
|
* Sets the values for a component.
|
||||||
* @param component the index of the component to set.
|
* @param component the index of the component to set.
|
||||||
* @param components the values to set.
|
* @param components the values to set.
|
||||||
*/
|
*/
|
||||||
void setComponents(const int& component, const std::vector<std::string>& components);
|
void setComponents(const int& component, const std::vector<std::string>& components) throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for an element and a component.
|
* Sets the value for an element and a component.
|
||||||
@ -102,10 +102,10 @@ namespace XAO
|
|||||||
* @param component the index of the component.
|
* @param component the index of the component.
|
||||||
* @param value the value.
|
* @param value the value.
|
||||||
*/
|
*/
|
||||||
void setValue(const int& element, const int& component, const std::string& value);
|
void setValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception);
|
||||||
|
|
||||||
virtual const std::string getStringValue(const int& element, const int& component);
|
virtual const std::string getStringValue(const int& element, const int& component) throw (XAO_Exception);
|
||||||
virtual void setStringValue(const int& element, const int& component, const std::string& value);
|
virtual void setStringValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector< std::vector<std::string> > m_values;
|
std::vector< std::vector<std::string> > m_values;
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
//
|
//
|
||||||
// Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade)
|
// Author : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
#include "XAO_Geometry.hxx"
|
#include "XAO_Geometry.hxx"
|
||||||
@ -70,6 +68,7 @@ const int Xao::countGroups() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Group* Xao::getGroup(const int& index)
|
Group* Xao::getGroup(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkGroupIndex(index);
|
checkGroupIndex(index);
|
||||||
|
|
||||||
@ -84,13 +83,17 @@ Group* Xao::getGroup(const int& index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Group* Xao::addGroup(const XAO::Dimension& dim)
|
Group* Xao::addGroup(const XAO::Dimension& dim)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addGroup("", dim);
|
return addGroup("", dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Xao::addGroup(const std::string& name, const XAO::Dimension& dim)
|
Group* Xao::addGroup(const std::string& name, const XAO::Dimension& dim)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkGeometry();
|
checkGeometry();
|
||||||
|
checkGroupDimension(dim);
|
||||||
|
|
||||||
Group* group = new Group(name, dim, m_geometry->countElements(dim));
|
Group* group = new Group(name, dim, m_geometry->countElements(dim));
|
||||||
m_groups.push_back(group);
|
m_groups.push_back(group);
|
||||||
return group;
|
return group;
|
||||||
@ -109,6 +112,7 @@ const int Xao::countFields() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Field* Xao::getField(const int& index)
|
Field* Xao::getField(const int& index)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkFieldIndex(index);
|
checkFieldIndex(index);
|
||||||
|
|
||||||
@ -123,11 +127,13 @@ Field* Xao::getField(const int& index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Field* Xao::addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents)
|
Field* Xao::addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
return addField(type, "", dim, nbComponents);
|
return addField(type, "", dim, nbComponents);
|
||||||
}
|
}
|
||||||
|
|
||||||
Field* Xao::addField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dim, const int& nbComponents)
|
Field* Xao::addField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dim, const int& nbComponents)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
checkGeometry();
|
checkGeometry();
|
||||||
int nbElts = m_geometry->countElements(dim);
|
int nbElts = m_geometry->countElements(dim);
|
||||||
@ -164,25 +170,35 @@ const bool Xao::setXML(const std::string& xml)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Xao::checkGeometry() const
|
void Xao::checkGeometry() const
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (m_geometry == NULL)
|
if (m_geometry == NULL)
|
||||||
throw SALOME_Exception("Geometry is null");
|
throw XAO_Exception("Geometry is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Xao::checkGroupIndex(const int& index) const
|
void Xao::checkGroupIndex(const int& index) const
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < countGroups())
|
if (index >= 0 && index < countGroups())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Group index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Group index is out of range [0, "
|
||||||
<< countGroups()-1 << "]: " << index);
|
<< countGroups()-1 << "]: " << index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Xao::checkFieldIndex(const int& index) const
|
void Xao::checkFieldIndex(const int& index) const
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < countFields())
|
if (index >= 0 && index < countFields())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Field index is out of range [0, "
|
throw XAO_Exception(MsgBuilder() << "Field index is out of range [0, "
|
||||||
<< countFields()-1 << "]: " << index);
|
<< countFields()-1 << "]: " << index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Xao::checkGroupDimension(const XAO::Dimension& dim) const
|
||||||
|
throw(XAO_Exception)
|
||||||
|
{
|
||||||
|
if (dim == XAO::WHOLE)
|
||||||
|
throw XAO_Exception(MsgBuilder() << "Invalid dimension for group: " << dim);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "XAO_Exception.hxx"
|
||||||
|
|
||||||
namespace XAO
|
namespace XAO
|
||||||
{
|
{
|
||||||
@ -151,22 +152,22 @@ namespace XAO
|
|||||||
/**
|
/**
|
||||||
* Gets a group.
|
* Gets a group.
|
||||||
* \param index the index of the wanted group.
|
* \param index the index of the wanted group.
|
||||||
* \return the group or NULL if index is bigger than the number of groups.
|
* \return the group.
|
||||||
*/
|
*/
|
||||||
Group* getGroup(const int& index);
|
Group* getGroup(const int& index) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Adds a group.
|
* Adds a group.
|
||||||
* \param dim the dimension of the group.
|
* \param dim the dimension of the group.
|
||||||
* \return the created group.
|
* \return the created group.
|
||||||
*/
|
*/
|
||||||
Group* addGroup(const XAO::Dimension& dim);
|
Group* addGroup(const XAO::Dimension& dim) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Adds a group.
|
* Adds a group.
|
||||||
* \param name the name of the group.
|
* \param name the name of the group.
|
||||||
* \param dim the dimension of the group.
|
* \param dim the dimension of the group.
|
||||||
* \return the created group.
|
* \return the created group.
|
||||||
*/
|
*/
|
||||||
Group* addGroup(const std::string& name, const XAO::Dimension& dim);
|
Group* addGroup(const std::string& name, const XAO::Dimension& dim) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Removes a group.
|
* Removes a group.
|
||||||
* \param group the group to remove.
|
* \param group the group to remove.
|
||||||
@ -186,9 +187,9 @@ namespace XAO
|
|||||||
/**
|
/**
|
||||||
* Gets a field.
|
* Gets a field.
|
||||||
* \param index the index of the wanted field.
|
* \param index the index of the wanted field.
|
||||||
* \return the field or NULL if the index is bigger than the number of fields.
|
* \return the field.
|
||||||
*/
|
*/
|
||||||
Field* getField(const int& index);
|
Field* getField(const int& index) throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Adds a field.
|
* Adds a field.
|
||||||
* \param type the type of the field.
|
* \param type the type of the field.
|
||||||
@ -196,7 +197,8 @@ namespace XAO
|
|||||||
* \param nbComponents the number of components in the field.
|
* \param nbComponents the number of components in the field.
|
||||||
* \return the created field.
|
* \return the created field.
|
||||||
*/
|
*/
|
||||||
Field* addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents);
|
Field* addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents)
|
||||||
|
throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Adds a field.
|
* Adds a field.
|
||||||
* \param type the type of the field.
|
* \param type the type of the field.
|
||||||
@ -205,7 +207,8 @@ namespace XAO
|
|||||||
* \param nbComponents the number of components in the field.
|
* \param nbComponents the number of components in the field.
|
||||||
* \return the created field.
|
* \return the created field.
|
||||||
*/
|
*/
|
||||||
Field* addField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dim, const int& nbComponents);
|
Field* addField(const XAO::Type& type, const std::string& name, const XAO::Dimension& dim, const int& nbComponents)
|
||||||
|
throw (XAO_Exception);
|
||||||
/**
|
/**
|
||||||
* Removes a field.
|
* Removes a field.
|
||||||
* \param field the field to remove.
|
* \param field the field to remove.
|
||||||
@ -242,9 +245,10 @@ namespace XAO
|
|||||||
const bool setXML(const std::string& xml);
|
const bool setXML(const std::string& xml);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkGeometry() const;
|
void checkGeometry() const throw (XAO_Exception);
|
||||||
void checkGroupIndex(const int& index) const;
|
void checkGroupIndex(const int& index) const throw (XAO_Exception);
|
||||||
void checkFieldIndex(const int& index) const;
|
void checkFieldIndex(const int& index) const throw (XAO_Exception);
|
||||||
|
void checkGroupDimension(const XAO::Dimension& dim) const throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The author of the file. */
|
/** The author of the file. */
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_XaoExporter.hxx"
|
#include "XAO_XaoExporter.hxx"
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
@ -74,10 +73,10 @@ std::string XaoExporter::readStringProp(xmlNodePtr node, const xmlChar* attribut
|
|||||||
if (required)
|
if (required)
|
||||||
{
|
{
|
||||||
if (exception.size() > 0)
|
if (exception.size() > 0)
|
||||||
throw SALOME_Exception(exception.c_str());
|
throw XAO_Exception(exception.c_str());
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Line " << node->line << ": "
|
throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": "
|
||||||
<< "Property " << (char*)attribute << " is required.");
|
<< "Property " << (char*)attribute << " is required.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -98,10 +97,10 @@ int XaoExporter::readIntegerProp(xmlNodePtr node, const xmlChar* attribute,
|
|||||||
if (required)
|
if (required)
|
||||||
{
|
{
|
||||||
if (exception.size() > 0)
|
if (exception.size() > 0)
|
||||||
throw SALOME_Exception(exception.c_str());
|
throw XAO_Exception(exception.c_str());
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Line " << node->line << ": "
|
throw XAO_Exception(MsgBuilder() << "Line " << node->line << ": "
|
||||||
<< "Property " << (char*)attribute << " is required.");
|
<< "Property " << (char*)attribute << " is required.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -113,6 +112,7 @@ int XaoExporter::readIntegerProp(xmlNodePtr node, const xmlChar* attribute,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName)
|
const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc = exportXMLDoc(xaoObject);
|
xmlDocPtr doc = exportXMLDoc(xaoObject);
|
||||||
xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", 1); // format = 1 for node indentation
|
xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", 1); // format = 1 for node indentation
|
||||||
@ -122,6 +122,7 @@ const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string XaoExporter::saveToXml(Xao* xaoObject)
|
const std::string XaoExporter::saveToXml(Xao* xaoObject)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc = exportXMLDoc(xaoObject);
|
xmlDocPtr doc = exportXMLDoc(xaoObject);
|
||||||
|
|
||||||
@ -274,13 +275,14 @@ void XaoExporter::exportStep(Step* step, Field* field, xmlNodePtr nodeSteps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject)
|
const bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
// parse the file and get the DOM
|
// parse the file and get the DOM
|
||||||
int options = XML_PARSE_HUGE || XML_PARSE_NOCDATA;
|
int options = XML_PARSE_HUGE || XML_PARSE_NOCDATA;
|
||||||
xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options);
|
xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options);
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
{
|
{
|
||||||
throw SALOME_Exception("Cannot read XAO file");
|
throw XAO_Exception("Cannot read XAO file");
|
||||||
}
|
}
|
||||||
|
|
||||||
parseXMLDoc(doc, xaoObject);
|
parseXMLDoc(doc, xaoObject);
|
||||||
@ -288,12 +290,13 @@ const bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool XaoExporter::setXML(const std::string& xml, Xao* xaoObject)
|
const bool XaoExporter::setXML(const std::string& xml, Xao* xaoObject)
|
||||||
|
throw (XAO_Exception)
|
||||||
{
|
{
|
||||||
int options = XML_PARSE_HUGE || XML_PARSE_NOCDATA;
|
int options = XML_PARSE_HUGE || XML_PARSE_NOCDATA;
|
||||||
xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options);
|
xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options);
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
{
|
{
|
||||||
throw SALOME_Exception("Cannot read XAO stream");
|
throw XAO_Exception("Cannot read XAO stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
parseXMLDoc(doc, xaoObject);
|
parseXMLDoc(doc, xaoObject);
|
||||||
@ -305,7 +308,7 @@ void XaoExporter::parseXMLDoc(xmlDocPtr doc, Xao* xaoObject)
|
|||||||
// Get the root element node
|
// Get the root element node
|
||||||
xmlNodePtr root = xmlDocGetRootElement(doc);
|
xmlNodePtr root = xmlDocGetRootElement(doc);
|
||||||
if (xmlStrcmp(root->name , C_TAG_XAO) != 0)
|
if (xmlStrcmp(root->name , C_TAG_XAO) != 0)
|
||||||
throw SALOME_Exception("Cannot read XAO file: invalid format XAO node not found");
|
throw XAO_Exception("Cannot read XAO file: invalid format XAO node not found");
|
||||||
|
|
||||||
parseXaoNode(doc, root, xaoObject);
|
parseXaoNode(doc, root, xaoObject);
|
||||||
|
|
||||||
@ -363,14 +366,14 @@ void XaoExporter::parseShapeNode(xmlDocPtr doc, xmlNodePtr shapeNode, Geometry*
|
|||||||
{
|
{
|
||||||
xmlChar* data = xmlNodeGetContent(shapeNode->children);
|
xmlChar* data = xmlNodeGetContent(shapeNode->children);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
throw SALOME_Exception("Missing BREP");
|
throw XAO_Exception("Missing BREP");
|
||||||
geometry->setShape((char*)data);
|
geometry->setShape((char*)data);
|
||||||
xmlFree(data);
|
xmlFree(data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw SALOME_Exception(MsgBuilder() << "Shape format not supported: "
|
throw XAO_Exception(MsgBuilder() << "Shape format not supported: "
|
||||||
<< XaoUtils::shapeFormatToString(geometry->getFormat()));
|
<< XaoUtils::shapeFormatToString(geometry->getFormat()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,8 +528,8 @@ void XaoExporter::parseFieldNode(xmlNodePtr fieldNode, Xao* xaoObject)
|
|||||||
// ensure that the components node is defined
|
// ensure that the components node is defined
|
||||||
if (componentsNode == NULL)
|
if (componentsNode == NULL)
|
||||||
{
|
{
|
||||||
throw SALOME_Exception(MsgBuilder() << "Line " << fieldNode->line << ": "
|
throw XAO_Exception(MsgBuilder() << "Line " << fieldNode->line << ": "
|
||||||
<< "No components defined for field.");
|
<< "No components defined for field.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the field
|
// create the field
|
||||||
@ -594,7 +597,7 @@ void XaoExporter::parseStepElementNode(xmlNodePtr eltNode, Step* step)
|
|||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
{
|
{
|
||||||
throw SALOME_Exception(MsgBuilder() << "Line " << valNode->line << ": no content for value.");
|
throw XAO_Exception(MsgBuilder() << "Line " << valNode->line << ": no content for value.");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string value = (char*)data;
|
std::string value = (char*)data;
|
||||||
|
@ -24,14 +24,16 @@ namespace XAO
|
|||||||
* @param fileName the path of the file to create.
|
* @param fileName the path of the file to create.
|
||||||
* @return true if the export was successful, false otherwise.
|
* @return true if the export was successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
static const bool saveToFile(Xao* xaoObject, const std::string& fileName);
|
static const bool saveToFile(Xao* xaoObject, const std::string& fileName)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the XAO object to a XML string.
|
* Saves the XAO object to a XML string.
|
||||||
* @param xaoObject the object to export.
|
* @param xaoObject the object to export.
|
||||||
* @return the XML string.
|
* @return the XML string.
|
||||||
*/
|
*/
|
||||||
static const std::string saveToXml(Xao* xaoObject);
|
static const std::string saveToXml(Xao* xaoObject)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a XAO object from a file.
|
* Reads a XAO object from a file.
|
||||||
@ -39,7 +41,8 @@ namespace XAO
|
|||||||
* @param xaoObject the XAO object.
|
* @param xaoObject the XAO object.
|
||||||
* @return true if the XAO object was read successful, false otherwise.
|
* @return true if the XAO object was read successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
static const bool readFromFile(const std::string& fileName, Xao* xaoObject);
|
static const bool readFromFile(const std::string& fileName, Xao* xaoObject)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a XAO object from an XML string.
|
* Reads a XAO object from an XML string.
|
||||||
@ -47,7 +50,8 @@ namespace XAO
|
|||||||
* @param xaoObject the XAO object.
|
* @param xaoObject the XAO object.
|
||||||
* @return true if the XAO object was read successful, false otherwise.
|
* @return true if the XAO object was read successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
static const bool setXML(const std::string& xml, Xao* xaoObject);
|
static const bool setXML(const std::string& xml, Xao* xaoObject)
|
||||||
|
throw (XAO_Exception);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static xmlDocPtr exportXMLDoc(Xao* xaoObject);
|
static xmlDocPtr exportXMLDoc(Xao* xaoObject);
|
||||||
|
@ -18,10 +18,7 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iosfwd>
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
#include "XAO_XaoUtils.hxx"
|
#include "XAO_XaoUtils.hxx"
|
||||||
@ -37,11 +34,12 @@ const std::string XaoUtils::intToString(const int& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int XaoUtils::stringToInt(const std::string& value)
|
const int XaoUtils::stringToInt(const std::string& value)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
std::istringstream convert(value);
|
std::istringstream convert(value);
|
||||||
if ( !(convert >> res) )
|
if ( !(convert >> res) )
|
||||||
throw SALOME_Exception(MsgBuilder() << "Cannot convert '" << value << "' to integer.");
|
throw XAO_Exception(MsgBuilder() << "Cannot convert '" << value << "' to integer.");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,11 +51,12 @@ const std::string XaoUtils::doubleToString(const double& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const double XaoUtils::stringToDouble(const std::string& value)
|
const double XaoUtils::stringToDouble(const std::string& value)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
double res;
|
double res;
|
||||||
std::istringstream convert(value);
|
std::istringstream convert(value);
|
||||||
if ( !(convert >> res) )
|
if ( !(convert >> res) )
|
||||||
throw SALOME_Exception(MsgBuilder() << "Cannot convert '" << value << "' to double.");
|
throw XAO_Exception(MsgBuilder() << "Cannot convert '" << value << "' to double.");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,16 +68,18 @@ const std::string XaoUtils::booleanToString(const bool& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool XaoUtils::stringToBoolean(const std::string& value)
|
const bool XaoUtils::stringToBoolean(const std::string& value)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (value == "true" || value == "1")
|
if (value == "true" || value == "1")
|
||||||
return true;
|
return true;
|
||||||
if (value == "false" || value == "0")
|
if (value == "false" || value == "0")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Invalid boolean value: " << value);
|
throw XAO_Exception(MsgBuilder() << "Invalid boolean value: " << value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string XaoUtils::dimensionToString(const XAO::Dimension& dimension)
|
const std::string XaoUtils::dimensionToString(const XAO::Dimension& dimension)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dimension == XAO::VERTEX)
|
if (dimension == XAO::VERTEX)
|
||||||
return "vertex";
|
return "vertex";
|
||||||
@ -91,10 +92,11 @@ const std::string XaoUtils::dimensionToString(const XAO::Dimension& dimension)
|
|||||||
if (dimension == XAO::WHOLE)
|
if (dimension == XAO::WHOLE)
|
||||||
return "whole";
|
return "whole";
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad dimension: " << dimension);
|
throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
const XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension)
|
const XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (dimension == "vertex")
|
if (dimension == "vertex")
|
||||||
return XAO::VERTEX;
|
return XAO::VERTEX;
|
||||||
@ -107,10 +109,11 @@ const XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension)
|
|||||||
if (dimension == "whole")
|
if (dimension == "whole")
|
||||||
return XAO::WHOLE;
|
return XAO::WHOLE;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad dimension: " << dimension);
|
throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string XaoUtils::fieldTypeToString(const XAO::Type& type)
|
const std::string XaoUtils::fieldTypeToString(const XAO::Type& type)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (type ==XAO:: BOOLEAN)
|
if (type ==XAO:: BOOLEAN)
|
||||||
return "boolean";
|
return "boolean";
|
||||||
@ -121,10 +124,11 @@ const std::string XaoUtils::fieldTypeToString(const XAO::Type& type)
|
|||||||
if (type == XAO::STRING)
|
if (type == XAO::STRING)
|
||||||
return "string";
|
return "string";
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad type: " << type);
|
throw XAO_Exception(MsgBuilder() << "Bad type: " << type);
|
||||||
}
|
}
|
||||||
|
|
||||||
const XAO::Type XaoUtils::stringToFieldType(const std::string& type)
|
const XAO::Type XaoUtils::stringToFieldType(const std::string& type)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (type == "boolean")
|
if (type == "boolean")
|
||||||
return XAO::BOOLEAN;
|
return XAO::BOOLEAN;
|
||||||
@ -135,25 +139,27 @@ const XAO::Type XaoUtils::stringToFieldType(const std::string& type)
|
|||||||
if (type == "string")
|
if (type == "string")
|
||||||
return XAO::STRING;
|
return XAO::STRING;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad type: " << type);
|
throw XAO_Exception(MsgBuilder() << "Bad type: " << type);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string XaoUtils::shapeFormatToString(const XAO::Format& format)
|
const std::string XaoUtils::shapeFormatToString(const XAO::Format& format)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (format == XAO::BREP)
|
if (format == XAO::BREP)
|
||||||
return "BREP";
|
return "BREP";
|
||||||
if (format == XAO::STEP)
|
if (format == XAO::STEP)
|
||||||
return "STEP";
|
return "STEP";
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad format: " << format);
|
throw XAO_Exception(MsgBuilder() << "Bad format: " << format);
|
||||||
}
|
}
|
||||||
|
|
||||||
const XAO::Format XaoUtils::stringToShapeFormat(const std::string& format)
|
const XAO::Format XaoUtils::stringToShapeFormat(const std::string& format)
|
||||||
|
throw(XAO_Exception)
|
||||||
{
|
{
|
||||||
if (format == "BREP")
|
if (format == "BREP")
|
||||||
return XAO::BREP;
|
return XAO::BREP;
|
||||||
if (format == "STEP")
|
if (format == "STEP")
|
||||||
return XAO::STEP;
|
return XAO::STEP;
|
||||||
|
|
||||||
throw SALOME_Exception(MsgBuilder() << "Bad format: " << format);
|
throw XAO_Exception(MsgBuilder() << "Bad format: " << format);
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,11 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
#include "XAO_Xao.hxx"
|
#include "XAO_Xao.hxx"
|
||||||
#include "XAO_Field.hxx"
|
#include "XAO_Exception.hxx"
|
||||||
|
|
||||||
|
|
||||||
namespace XAO
|
namespace XAO
|
||||||
{
|
{
|
||||||
@ -47,82 +49,86 @@ namespace XAO
|
|||||||
* Converts a string into an integer.
|
* Converts a string into an integer.
|
||||||
* \param value the string to convert.
|
* \param value the string to convert.
|
||||||
* \return the integer value.
|
* \return the integer value.
|
||||||
|
* \throw XAO_Exception if value cannot be converted to string.
|
||||||
*/
|
*/
|
||||||
static const int stringToInt(const std::string& value);
|
static const int stringToInt(const std::string& value) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a double into a string.
|
* Converts a double into a string.
|
||||||
* @param value the double to convert.
|
* \param value the double to convert.
|
||||||
* @return the string.
|
* \return the string.
|
||||||
*/
|
*/
|
||||||
static const std::string doubleToString(const double& value);
|
static const std::string doubleToString(const double& value);
|
||||||
/**
|
/**
|
||||||
* Converts a string into a double.
|
* Converts a string into a double.
|
||||||
* @param value the string to convert.
|
* \param value the string to convert.
|
||||||
* @return the double value.
|
* \return the double value.
|
||||||
|
* \throw XAO_Exception if value cannot be converted to string.
|
||||||
*/
|
*/
|
||||||
static const double stringToDouble(const std::string& value);
|
static const double stringToDouble(const std::string& value) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a boolean into a string.
|
* Converts a boolean into a string.
|
||||||
* @param value the boolean to convert.
|
* \param value the boolean to convert.
|
||||||
* @return the string.
|
* \return the string.
|
||||||
*/
|
*/
|
||||||
static const std::string booleanToString(const bool& value);
|
static const std::string booleanToString(const bool& value);
|
||||||
/**
|
/**
|
||||||
* Converts a string into a boolean.
|
* Converts a string into a boolean.
|
||||||
* @param value the string to convert.
|
* \param value the string to convert.
|
||||||
* @return the boolean value.
|
* \return the boolean value.
|
||||||
|
* \throw XAO_Exception if value cannot be converted to boolean.
|
||||||
|
* \note accepted values are "true", "1", "false", "0".
|
||||||
*/
|
*/
|
||||||
static const bool stringToBoolean(const std::string& value);
|
static const bool stringToBoolean(const std::string& value) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Dimension to string.
|
* Converts a Dimension to string.
|
||||||
* \param dimension the Dimension to convert.
|
* \param dimension the Dimension to convert.
|
||||||
* \return the dimension as a string.
|
* \return the dimension as a string.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception
|
||||||
*/
|
*/
|
||||||
static const std::string dimensionToString(const XAO::Dimension& dimension);
|
static const std::string dimensionToString(const XAO::Dimension& dimension) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string into a Dimension.
|
* Converts a string into a Dimension.
|
||||||
* \param dimension the dimension as a string.
|
* \param dimension the dimension as a string.
|
||||||
* \return the converted Dimension.
|
* \return the converted Dimension.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception if dimension cannot be converted.
|
||||||
*/
|
*/
|
||||||
static const XAO::Dimension stringToDimension(const std::string& dimension);
|
static const XAO::Dimension stringToDimension(const std::string& dimension) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Type to string.
|
* Converts a Type to string.
|
||||||
* \param type the Type to convert.
|
* \param type the Type to convert.
|
||||||
* \return the Type as a string.
|
* \return the Type as a string.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception
|
||||||
*/
|
*/
|
||||||
static const std::string fieldTypeToString(const XAO::Type& type);
|
static const std::string fieldTypeToString(const XAO::Type& type) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string into a Type.
|
* Converts a string into a Type.
|
||||||
* \param type the Type as a string.
|
* \param type the Type as a string.
|
||||||
* \return the converted Type.
|
* \return the converted Type.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception if type cannot be converted.
|
||||||
*/
|
*/
|
||||||
static const XAO::Type stringToFieldType(const std::string& type);
|
static const XAO::Type stringToFieldType(const std::string& type) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Format to string.
|
* Converts a Format to string.
|
||||||
* \param format the Format to convert.
|
* \param format the Format to convert.
|
||||||
* \return the Format as a string.
|
* \return the Format as a string.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception
|
||||||
*/
|
*/
|
||||||
static const std::string shapeFormatToString(const XAO::Format& format);
|
static const std::string shapeFormatToString(const XAO::Format& format) throw(XAO_Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a string into a Format.
|
* Converts a string into a Format.
|
||||||
* \param format the Format as a string.
|
* \param format the Format as a string.
|
||||||
* \return the converted Format.
|
* \return the converted Format.
|
||||||
* \throw SALOME_Exception
|
* \throw XAO_Exception if format cannot be converted.
|
||||||
*/
|
*/
|
||||||
static const XAO::Format stringToShapeFormat(const std::string& format);
|
static const XAO::Format stringToShapeFormat(const std::string& format) throw(XAO_Exception);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "TestUtils.hxx"
|
#include "TestUtils.hxx"
|
||||||
#include "BrepGeometryTest.hxx"
|
#include "BrepGeometryTest.hxx"
|
||||||
|
#include "../XAO_XaoUtils.hxx"
|
||||||
#include "../XAO_Xao.hxx"
|
#include "../XAO_Xao.hxx"
|
||||||
#include "../XAO_BrepGeometry.hxx"
|
#include "../XAO_BrepGeometry.hxx"
|
||||||
|
|
||||||
@ -104,32 +104,32 @@ void BrepGeometryTest::testGetNames()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findVertexName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findVertexName(id));
|
||||||
geom->changeVertexName(id, std::string("va"));
|
geom->changeVertexName(id, std::string("va"));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->findVertexName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->findVertexName(id));
|
||||||
CPPUNIT_ASSERT_THROW(geom->changeVertexName(100, "a"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->changeVertexName(100, "a"), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(geom->findVertexName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->findVertexName(100), XAO_Exception);
|
||||||
|
|
||||||
// edge of index 1 has id = 8
|
// edge of index 1 has id = 8
|
||||||
id = 8;
|
id = 8;
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findEdgeName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findEdgeName(id));
|
||||||
geom->changeEdgeName(id, std::string("ea"));
|
geom->changeEdgeName(id, std::string("ea"));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->findEdgeName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->findEdgeName(id));
|
||||||
CPPUNIT_ASSERT_THROW(geom->changeEdgeName(100, "a"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->changeEdgeName(100, "a"), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(geom->findEdgeName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->findEdgeName(100), XAO_Exception);
|
||||||
|
|
||||||
// face of index 1 has id = 13
|
// face of index 1 has id = 13
|
||||||
id = 13;
|
id = 13;
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findFaceName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findFaceName(id));
|
||||||
geom->changeFaceName(id, std::string("fa"));
|
geom->changeFaceName(id, std::string("fa"));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->findFaceName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->findFaceName(id));
|
||||||
CPPUNIT_ASSERT_THROW(geom->changeFaceName(100, "a"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->changeFaceName(100, "a"), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(geom->findFaceName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->findFaceName(100), XAO_Exception);
|
||||||
|
|
||||||
// solid of index 0 has id = 1
|
// solid of index 0 has id = 1
|
||||||
id = 1;
|
id = 1;
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findSolidName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), geom->findSolidName(id));
|
||||||
geom->changeSolidName(id, std::string("sa"));
|
geom->changeSolidName(id, std::string("sa"));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->findSolidName(id));
|
CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->findSolidName(id));
|
||||||
CPPUNIT_ASSERT_THROW(geom->changeSolidName(100, "a"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->changeSolidName(100, "a"), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(geom->findSolidName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->findSolidName(100), XAO_Exception);
|
||||||
|
|
||||||
delete geom;
|
delete geom;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "FieldTest.hxx"
|
#include "FieldTest.hxx"
|
||||||
#include "../XAO_Xao.hxx"
|
#include "../XAO_Xao.hxx"
|
||||||
@ -48,8 +47,8 @@ Field* FieldTest::testField(XAO::Type type)
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string("x"), f->getComponentName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("x"), f->getComponentName(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("y"), f->getComponentName(1));
|
CPPUNIT_ASSERT_EQUAL(std::string("y"), f->getComponentName(1));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("z"), f->getComponentName(2));
|
CPPUNIT_ASSERT_EQUAL(std::string("z"), f->getComponentName(2));
|
||||||
CPPUNIT_ASSERT_THROW(f->setComponentName(3, "a"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->setComponentName(3, "a"), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(f->getComponentName(3), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->getComponentName(3), XAO_Exception);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(0, f->countSteps());
|
||||||
Step* step = f->addNewStep(0);
|
Step* step = f->addNewStep(0);
|
||||||
@ -58,7 +57,7 @@ Field* FieldTest::testField(XAO::Type type)
|
|||||||
step = f->addNewStep(1);
|
step = f->addNewStep(1);
|
||||||
step = f->addNewStep(2);
|
step = f->addNewStep(2);
|
||||||
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
||||||
CPPUNIT_ASSERT_THROW(f->addNewStep(2), SALOME_Exception); // step already exists
|
CPPUNIT_ASSERT_THROW(f->addNewStep(2), XAO_Exception); // step already exists
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(true, f->removeStep(step));
|
CPPUNIT_ASSERT_EQUAL(true, f->removeStep(step));
|
||||||
CPPUNIT_ASSERT_EQUAL(2, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(2, f->countSteps());
|
||||||
@ -75,12 +74,12 @@ void FieldTest::testBooleanField()
|
|||||||
BooleanStep* step = f->getStep(0);
|
BooleanStep* step = f->getStep(0);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType());
|
||||||
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
||||||
CPPUNIT_ASSERT_THROW(f->getStep(2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception);
|
||||||
|
|
||||||
step = f->addStep(10);
|
step = f->addStep(10);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::BOOLEAN, step->getType());
|
||||||
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
||||||
CPPUNIT_ASSERT_THROW(f->addStep(10), SALOME_Exception); // step already exists
|
CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldTest::testIntegerField()
|
void FieldTest::testIntegerField()
|
||||||
@ -90,12 +89,12 @@ void FieldTest::testIntegerField()
|
|||||||
IntegerStep* step = f->getStep(0);
|
IntegerStep* step = f->getStep(0);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType());
|
||||||
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
||||||
CPPUNIT_ASSERT_THROW(f->getStep(2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception);
|
||||||
|
|
||||||
step = f->addStep(10);
|
step = f->addStep(10);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, step->getType());
|
||||||
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
||||||
CPPUNIT_ASSERT_THROW(f->addStep(10), SALOME_Exception); // step already exists
|
CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists
|
||||||
}
|
}
|
||||||
void FieldTest::testDoubleField()
|
void FieldTest::testDoubleField()
|
||||||
{
|
{
|
||||||
@ -104,12 +103,12 @@ void FieldTest::testDoubleField()
|
|||||||
DoubleStep* step = f->getStep(0);
|
DoubleStep* step = f->getStep(0);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType());
|
||||||
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
||||||
CPPUNIT_ASSERT_THROW(f->getStep(2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception);
|
||||||
|
|
||||||
step = f->addStep(10);
|
step = f->addStep(10);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, step->getType());
|
||||||
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
||||||
CPPUNIT_ASSERT_THROW(f->addStep(10), SALOME_Exception); // step already exists
|
CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists
|
||||||
}
|
}
|
||||||
void FieldTest::testStringField()
|
void FieldTest::testStringField()
|
||||||
{
|
{
|
||||||
@ -118,12 +117,12 @@ void FieldTest::testStringField()
|
|||||||
StringStep* step = f->getStep(0);
|
StringStep* step = f->getStep(0);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType());
|
||||||
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
CPPUNIT_ASSERT_MESSAGE("step is NULL", step != NULL);
|
||||||
CPPUNIT_ASSERT_THROW(f->getStep(2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(f->getStep(2), XAO_Exception);
|
||||||
|
|
||||||
step = f->addStep(10);
|
step = f->addStep(10);
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType());
|
CPPUNIT_ASSERT_EQUAL(XAO::STRING, step->getType());
|
||||||
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
CPPUNIT_ASSERT_EQUAL(3, f->countSteps());
|
||||||
CPPUNIT_ASSERT_THROW(f->addStep(10), SALOME_Exception); // step already exists
|
CPPUNIT_ASSERT_THROW(f->addStep(10), XAO_Exception); // step already exists
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldTest::testStep(XAO::Type type, Step* step)
|
void FieldTest::testStep(XAO::Type type, Step* step)
|
||||||
@ -180,8 +179,8 @@ void FieldTest::testBooleanStepValues()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(true, step->getValue(1, 2));
|
CPPUNIT_ASSERT_EQUAL(true, step->getValue(1, 2));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("true"), step->getStringValue(1, 2));
|
CPPUNIT_ASSERT_EQUAL(std::string("true"), step->getStringValue(1, 2));
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception);
|
||||||
|
|
||||||
// get all values
|
// get all values
|
||||||
std::vector<bool> values;
|
std::vector<bool> values;
|
||||||
@ -195,14 +194,14 @@ void FieldTest::testBooleanStepValues()
|
|||||||
|
|
||||||
// get one element
|
// get one element
|
||||||
values = step->getElement(2);
|
values = step->getElement(2);
|
||||||
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
||||||
for (int i = 0; i < nbComponents; ++i)
|
for (int i = 0; i < nbComponents; ++i)
|
||||||
CPPUNIT_ASSERT((i % 2 == 0) == values[i]);
|
CPPUNIT_ASSERT((i % 2 == 0) == values[i]);
|
||||||
|
|
||||||
// get one component
|
// get one component
|
||||||
values = step->getComponent(1);
|
values = step->getComponent(1);
|
||||||
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
||||||
for (int i = 0; i < nbElements; ++i)
|
for (int i = 0; i < nbElements; ++i)
|
||||||
CPPUNIT_ASSERT(false == values[i]);
|
CPPUNIT_ASSERT(false == values[i]);
|
||||||
@ -211,7 +210,7 @@ void FieldTest::testBooleanStepValues()
|
|||||||
std::vector<bool> newEltValues;
|
std::vector<bool> newEltValues;
|
||||||
// only one value
|
// only one value
|
||||||
newEltValues.push_back(true);
|
newEltValues.push_back(true);
|
||||||
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbComponents; ++i)
|
for (int i = 1; i < nbComponents; ++i)
|
||||||
newEltValues.push_back(true);
|
newEltValues.push_back(true);
|
||||||
@ -221,7 +220,7 @@ void FieldTest::testBooleanStepValues()
|
|||||||
std::vector<bool> newCompValues;
|
std::vector<bool> newCompValues;
|
||||||
// only one value
|
// only one value
|
||||||
newCompValues.push_back(true);
|
newCompValues.push_back(true);
|
||||||
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbElements; ++i)
|
for (int i = 1; i < nbElements; ++i)
|
||||||
newCompValues.push_back(true);
|
newCompValues.push_back(true);
|
||||||
@ -229,13 +228,13 @@ void FieldTest::testBooleanStepValues()
|
|||||||
|
|
||||||
// set string value
|
// set string value
|
||||||
step->setStringValue(0, 0, "true");
|
step->setStringValue(0, 0, "true");
|
||||||
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception);
|
||||||
|
|
||||||
// set all values
|
// set all values
|
||||||
std::vector<bool> allValues;
|
std::vector<bool> allValues;
|
||||||
// only one value
|
// only one value
|
||||||
allValues.push_back(true);
|
allValues.push_back(true);
|
||||||
CPPUNIT_ASSERT_THROW(step->setValues(allValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbElements*nbComponents; ++i)
|
for (int i = 1; i < nbElements*nbComponents; ++i)
|
||||||
allValues.push_back(true);
|
allValues.push_back(true);
|
||||||
@ -255,8 +254,8 @@ void FieldTest::testIntegerStepValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(12, step->getValue(1, 2));
|
CPPUNIT_ASSERT_EQUAL(12, step->getValue(1, 2));
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception);
|
||||||
|
|
||||||
// get all values
|
// get all values
|
||||||
std::vector<int> values;
|
std::vector<int> values;
|
||||||
@ -270,14 +269,14 @@ void FieldTest::testIntegerStepValues()
|
|||||||
|
|
||||||
// get one element
|
// get one element
|
||||||
values = step->getElement(2);
|
values = step->getElement(2);
|
||||||
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
||||||
for (int i = 0; i < nbComponents; ++i)
|
for (int i = 0; i < nbComponents; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(20+i, values[i]);
|
CPPUNIT_ASSERT_EQUAL(20+i, values[i]);
|
||||||
|
|
||||||
// get one component
|
// get one component
|
||||||
values = step->getComponent(1);
|
values = step->getComponent(1);
|
||||||
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
||||||
for (int i = 0; i < nbElements; ++i)
|
for (int i = 0; i < nbElements; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(10*i+1, values[i]);
|
CPPUNIT_ASSERT_EQUAL(10*i+1, values[i]);
|
||||||
@ -285,7 +284,7 @@ void FieldTest::testIntegerStepValues()
|
|||||||
// set one element
|
// set one element
|
||||||
std::vector<int> newEltValues;
|
std::vector<int> newEltValues;
|
||||||
newEltValues.push_back(1);
|
newEltValues.push_back(1);
|
||||||
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbComponents; ++i)
|
for (int i = 1; i < nbComponents; ++i)
|
||||||
newEltValues.push_back(1);
|
newEltValues.push_back(1);
|
||||||
step->setElements(2, newEltValues);
|
step->setElements(2, newEltValues);
|
||||||
@ -293,20 +292,20 @@ void FieldTest::testIntegerStepValues()
|
|||||||
// set one component
|
// set one component
|
||||||
std::vector<int> newCompValues;
|
std::vector<int> newCompValues;
|
||||||
newCompValues.push_back(100);
|
newCompValues.push_back(100);
|
||||||
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbElements; ++i)
|
for (int i = 1; i < nbElements; ++i)
|
||||||
newCompValues.push_back(100);
|
newCompValues.push_back(100);
|
||||||
step->setComponents(1, newCompValues);
|
step->setComponents(1, newCompValues);
|
||||||
|
|
||||||
// set string value
|
// set string value
|
||||||
step->setStringValue(0, 0, "0");
|
step->setStringValue(0, 0, "0");
|
||||||
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception);
|
||||||
|
|
||||||
// set all values
|
// set all values
|
||||||
std::vector<int> allValues;
|
std::vector<int> allValues;
|
||||||
// only one value
|
// only one value
|
||||||
allValues.push_back(11);
|
allValues.push_back(11);
|
||||||
CPPUNIT_ASSERT_THROW(step->setValues(allValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbElements*nbComponents; ++i)
|
for (int i = 1; i < nbElements*nbComponents; ++i)
|
||||||
allValues.push_back(11);
|
allValues.push_back(11);
|
||||||
@ -326,8 +325,8 @@ void FieldTest::testDoubleStepValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(10.2, step->getValue(1, 2));
|
CPPUNIT_ASSERT_EQUAL(10.2, step->getValue(1, 2));
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception);
|
||||||
|
|
||||||
// get all values
|
// get all values
|
||||||
std::vector<double> values;
|
std::vector<double> values;
|
||||||
@ -341,14 +340,14 @@ void FieldTest::testDoubleStepValues()
|
|||||||
|
|
||||||
// get one element
|
// get one element
|
||||||
values = step->getElement(2);
|
values = step->getElement(2);
|
||||||
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
||||||
for (int i = 0; i < nbComponents; ++i)
|
for (int i = 0; i < nbComponents; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(20+i*0.1, values[i]);
|
CPPUNIT_ASSERT_EQUAL(20+i*0.1, values[i]);
|
||||||
|
|
||||||
// get one component
|
// get one component
|
||||||
values = step->getComponent(1);
|
values = step->getComponent(1);
|
||||||
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
||||||
for (int i = 0; i < nbElements; ++i)
|
for (int i = 0; i < nbElements; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(10*i+0.1, values[i]);
|
CPPUNIT_ASSERT_EQUAL(10*i+0.1, values[i]);
|
||||||
@ -356,7 +355,7 @@ void FieldTest::testDoubleStepValues()
|
|||||||
// set one element
|
// set one element
|
||||||
std::vector<double> newEltValues;
|
std::vector<double> newEltValues;
|
||||||
newEltValues.push_back(1.);
|
newEltValues.push_back(1.);
|
||||||
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbComponents; ++i)
|
for (int i = 1; i < nbComponents; ++i)
|
||||||
newEltValues.push_back(1.);
|
newEltValues.push_back(1.);
|
||||||
step->setElements(2, newEltValues);
|
step->setElements(2, newEltValues);
|
||||||
@ -364,19 +363,19 @@ void FieldTest::testDoubleStepValues()
|
|||||||
// set one component
|
// set one component
|
||||||
std::vector<double> newCompValues;
|
std::vector<double> newCompValues;
|
||||||
newCompValues.push_back(100.0);
|
newCompValues.push_back(100.0);
|
||||||
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbElements; ++i)
|
for (int i = 1; i < nbElements; ++i)
|
||||||
newCompValues.push_back(100.0);
|
newCompValues.push_back(100.0);
|
||||||
step->setComponents(1, newCompValues);
|
step->setComponents(1, newCompValues);
|
||||||
|
|
||||||
// set string value
|
// set string value
|
||||||
step->setStringValue(0, 0, "0.2");
|
step->setStringValue(0, 0, "0.2");
|
||||||
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setStringValue(0, 0, "aa"), XAO_Exception);
|
||||||
|
|
||||||
std::vector<double> allValues;
|
std::vector<double> allValues;
|
||||||
// only one value
|
// only one value
|
||||||
allValues.push_back(1.1);
|
allValues.push_back(1.1);
|
||||||
CPPUNIT_ASSERT_THROW(step->setValues(allValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbElements*nbComponents; ++i)
|
for (int i = 1; i < nbElements*nbComponents; ++i)
|
||||||
allValues.push_back(1.1);
|
allValues.push_back(1.1);
|
||||||
@ -395,8 +394,8 @@ void FieldTest::testStringStepValues()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("12"), step->getValue(1, 2));
|
CPPUNIT_ASSERT_EQUAL(std::string("12"), step->getValue(1, 2));
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(nbElements, 2), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getValue(1, nbComponents), XAO_Exception);
|
||||||
|
|
||||||
// get all values
|
// get all values
|
||||||
std::vector<std::string> values;
|
std::vector<std::string> values;
|
||||||
@ -410,14 +409,14 @@ void FieldTest::testStringStepValues()
|
|||||||
|
|
||||||
// get one element
|
// get one element
|
||||||
values = step->getElement(2);
|
values = step->getElement(2);
|
||||||
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getElement(nbElements), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbComponents, (int)values.size());
|
||||||
for (int i = 0; i < nbComponents; ++i)
|
for (int i = 0; i < nbComponents; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(20+i), values[i]);
|
CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(20+i), values[i]);
|
||||||
|
|
||||||
// get one component
|
// get one component
|
||||||
values = step->getComponent(1);
|
values = step->getComponent(1);
|
||||||
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->getComponent(nbComponents), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
CPPUNIT_ASSERT_EQUAL(nbElements, (int)values.size());
|
||||||
for (int i = 0; i < nbElements; ++i)
|
for (int i = 0; i < nbElements; ++i)
|
||||||
CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10*i+1), values[i]);
|
CPPUNIT_ASSERT_EQUAL(XaoUtils::intToString(10*i+1), values[i]);
|
||||||
@ -425,7 +424,7 @@ void FieldTest::testStringStepValues()
|
|||||||
// set one element
|
// set one element
|
||||||
std::vector<std::string> newEltValues;
|
std::vector<std::string> newEltValues;
|
||||||
newEltValues.push_back("1");
|
newEltValues.push_back("1");
|
||||||
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setElements(2, newEltValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbComponents; ++i)
|
for (int i = 1; i < nbComponents; ++i)
|
||||||
newEltValues.push_back("1");
|
newEltValues.push_back("1");
|
||||||
step->setElements(2, newEltValues);
|
step->setElements(2, newEltValues);
|
||||||
@ -433,7 +432,7 @@ void FieldTest::testStringStepValues()
|
|||||||
// set one component
|
// set one component
|
||||||
std::vector<std::string> newCompValues;
|
std::vector<std::string> newCompValues;
|
||||||
newCompValues.push_back("100");
|
newCompValues.push_back("100");
|
||||||
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setComponents(1, newCompValues), XAO_Exception);
|
||||||
for (int i = 1; i < nbElements; ++i)
|
for (int i = 1; i < nbElements; ++i)
|
||||||
newCompValues.push_back("100");
|
newCompValues.push_back("100");
|
||||||
step->setComponents(1, newCompValues);
|
step->setComponents(1, newCompValues);
|
||||||
@ -445,7 +444,7 @@ void FieldTest::testStringStepValues()
|
|||||||
std::vector<std::string> allValues;
|
std::vector<std::string> allValues;
|
||||||
// only one value
|
// only one value
|
||||||
allValues.push_back("abc");
|
allValues.push_back("abc");
|
||||||
CPPUNIT_ASSERT_THROW(step->setValues(allValues), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(step->setValues(allValues), XAO_Exception);
|
||||||
// all values
|
// all values
|
||||||
for (int i = 1; i < nbElements*nbComponents; ++i)
|
for (int i = 1; i < nbElements*nbComponents; ++i)
|
||||||
allValues.push_back("abc");
|
allValues.push_back("abc");
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "TestUtils.hxx"
|
#include "TestUtils.hxx"
|
||||||
#include "GeometryTest.hxx"
|
#include "GeometryTest.hxx"
|
||||||
|
#include "../XAO_XaoUtils.hxx"
|
||||||
#include "../XAO_Geometry.hxx"
|
#include "../XAO_Geometry.hxx"
|
||||||
#include "../XAO_GeometricElement.hxx"
|
#include "../XAO_GeometricElement.hxx"
|
||||||
|
|
||||||
@ -51,16 +51,16 @@ void GeometryTest::testGeometryElementList()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getReference(0));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.getName(20), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.getName(20), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.getReference(20), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.getReference(20), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.hasName(20), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.hasName(20), XAO_Exception);
|
||||||
|
|
||||||
otherLst.setName(0, "aa");
|
otherLst.setName(0, "aa");
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("aa"), otherLst.getName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("aa"), otherLst.getName(0));
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.setName(20, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.setName(20, "aa"), XAO_Exception);
|
||||||
otherLst.setReference(0, "bb");
|
otherLst.setReference(0, "bb");
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("bb"), otherLst.getReference(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("bb"), otherLst.getReference(0));
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.setReference(20, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.setReference(20, "aa"), XAO_Exception);
|
||||||
|
|
||||||
otherLst.setSize(10);
|
otherLst.setSize(10);
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string(""), otherLst.getName(0));
|
||||||
@ -71,7 +71,7 @@ void GeometryTest::testGeometryElementList()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string("name"), otherLst.getName(3));
|
CPPUNIT_ASSERT_EQUAL(std::string("name"), otherLst.getName(3));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("ref"), otherLst.getReference(3));
|
CPPUNIT_ASSERT_EQUAL(std::string("ref"), otherLst.getReference(3));
|
||||||
CPPUNIT_ASSERT_EQUAL(true, otherLst.hasName(3));
|
CPPUNIT_ASSERT_EQUAL(true, otherLst.hasName(3));
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.setElement(30, "name", "ref"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.setElement(30, "name", "ref"), XAO_Exception);
|
||||||
|
|
||||||
// ---- create elements "name i", "Ri"
|
// ---- create elements "name i", "Ri"
|
||||||
for (int i = 0; i < otherLst.getSize(); ++i)
|
for (int i = 0; i < otherLst.getSize(); ++i)
|
||||||
@ -85,7 +85,7 @@ void GeometryTest::testGeometryElementList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(8, otherLst.getIndexByReference("R8"));
|
CPPUNIT_ASSERT_EQUAL(8, otherLst.getIndexByReference("R8"));
|
||||||
CPPUNIT_ASSERT_THROW(otherLst.getIndexByReference("ZZ"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(otherLst.getIndexByReference("ZZ"), XAO_Exception);
|
||||||
|
|
||||||
GeometricElementList::iterator first = otherLst.begin();
|
GeometricElementList::iterator first = otherLst.begin();
|
||||||
GeometricElement firstElt = first->second;
|
GeometricElement firstElt = first->second;
|
||||||
@ -107,14 +107,14 @@ void GeometryTest::testGeometry()
|
|||||||
|
|
||||||
void GeometryTest::testGeometryErrors()
|
void GeometryTest::testGeometryErrors()
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_THROW(Geometry::createGeometry(XAO::STEP), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(Geometry::createGeometry(XAO::STEP), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryTest::testSetElement()
|
void GeometryTest::testSetElement()
|
||||||
{
|
{
|
||||||
Geometry* geom = Geometry::createGeometry(XAO::BREP, "cube");
|
Geometry* geom = Geometry::createGeometry(XAO::BREP, "cube");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_THROW(geom->setVertexName(0, "aa"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->setVertexName(0, "aa"), XAO_Exception);
|
||||||
|
|
||||||
char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Box_1.brep"));
|
char* txt = TestUtils::readTextFile(TestUtils::getTestFilePath("Box_1.brep"));
|
||||||
geom->setShape(txt);
|
geom->setShape(txt);
|
||||||
@ -123,20 +123,20 @@ void GeometryTest::testSetElement()
|
|||||||
geom->setVertexName(0, "va");
|
geom->setVertexName(0, "va");
|
||||||
CPPUNIT_ASSERT_EQUAL(true, geom->hasVertexName(0));
|
CPPUNIT_ASSERT_EQUAL(true, geom->hasVertexName(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->getVertexName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("va"), geom->getVertexName(0));
|
||||||
CPPUNIT_ASSERT_THROW(geom->getVertexName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->getVertexName(100), XAO_Exception);
|
||||||
CPPUNIT_ASSERT_THROW(geom->hasVertexName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->hasVertexName(100), XAO_Exception);
|
||||||
|
|
||||||
geom->setEdgeName(0, "ea");
|
geom->setEdgeName(0, "ea");
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->getEdgeName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("ea"), geom->getEdgeName(0));
|
||||||
CPPUNIT_ASSERT_THROW(geom->getEdgeName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->getEdgeName(100), XAO_Exception);
|
||||||
|
|
||||||
geom->setFaceName(0, "fa");
|
geom->setFaceName(0, "fa");
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->getFaceName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("fa"), geom->getFaceName(0));
|
||||||
CPPUNIT_ASSERT_THROW(geom->getFaceName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->getFaceName(100), XAO_Exception);
|
||||||
|
|
||||||
geom->setSolidName(0, "sa");
|
geom->setSolidName(0, "sa");
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->getSolidName(0));
|
CPPUNIT_ASSERT_EQUAL(std::string("sa"), geom->getSolidName(0));
|
||||||
CPPUNIT_ASSERT_THROW(geom->getSolidName(100), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->getSolidName(100), XAO_Exception);
|
||||||
|
|
||||||
delete geom;
|
delete geom;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "TestUtils.hxx"
|
#include "TestUtils.hxx"
|
||||||
#include "GroupTest.hxx"
|
#include "GroupTest.hxx"
|
||||||
|
#include "../XAO_XaoUtils.hxx"
|
||||||
#include "../XAO_Xao.hxx"
|
#include "../XAO_Xao.hxx"
|
||||||
#include "../XAO_Group.hxx"
|
#include "../XAO_Group.hxx"
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ void GroupTest::testGroup()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(10, group->get(0));
|
CPPUNIT_ASSERT_EQUAL(10, group->get(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(12, group->get(1));
|
CPPUNIT_ASSERT_EQUAL(12, group->get(1));
|
||||||
CPPUNIT_ASSERT_THROW(group->get(2), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(group->get(2), XAO_Exception);
|
||||||
|
|
||||||
group->remove(15);
|
group->remove(15);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, group->count());
|
CPPUNIT_ASSERT_EQUAL(2, group->count());
|
||||||
@ -54,5 +54,5 @@ void GroupTest::testGroup()
|
|||||||
|
|
||||||
void GroupTest::testGroupErrors()
|
void GroupTest::testGroupErrors()
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_THROW(new Group(XAO::WHOLE, 20), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(new Group(XAO::WHOLE, 20), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,9 @@
|
|||||||
//
|
//
|
||||||
// Author : Frederic Pons (OpenCascade)
|
// Author : Frederic Pons (OpenCascade)
|
||||||
|
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "TestUtils.hxx"
|
#include "TestUtils.hxx"
|
||||||
#include "ImportExportTest.hxx"
|
#include "ImportExportTest.hxx"
|
||||||
|
#include "../XAO_XaoUtils.hxx"
|
||||||
#include "../XAO_Geometry.hxx"
|
#include "../XAO_Geometry.hxx"
|
||||||
#include "../XAO_Group.hxx"
|
#include "../XAO_Group.hxx"
|
||||||
#include "../XAO_Field.hxx"
|
#include "../XAO_Field.hxx"
|
||||||
@ -116,7 +115,7 @@ void ImportExportTest::testGeometryError()
|
|||||||
xao.setGeometry(geom);
|
xao.setGeometry(geom);
|
||||||
|
|
||||||
geom->setCountVertices(2);
|
geom->setCountVertices(2);
|
||||||
CPPUNIT_ASSERT_THROW(geom->setVertex(3, "v4", "4"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(geom->setVertex(3, "v4", "4"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportExportTest::testImportXao()
|
void ImportExportTest::testImportXao()
|
||||||
|
@ -24,7 +24,6 @@ bin_PROGRAMS= TestXAO
|
|||||||
|
|
||||||
TestXAO_CPPFLAGS= \
|
TestXAO_CPPFLAGS= \
|
||||||
@CPPUNIT_INCLUDES@ @PTHREAD_CFLAGS@ \
|
@CPPUNIT_INCLUDES@ @PTHREAD_CFLAGS@ \
|
||||||
$(GEOM_CXXFLAGS) \
|
|
||||||
$(CAS_CPPFLAGS) \
|
$(CAS_CPPFLAGS) \
|
||||||
$(LIBXML_INCLUDES) \
|
$(LIBXML_INCLUDES) \
|
||||||
-I$(srcdir)
|
-I$(srcdir)
|
||||||
@ -33,7 +32,6 @@ TestXAO_LDFLAGS = \
|
|||||||
@CPPUNIT_LIBS@ \
|
@CPPUNIT_LIBS@ \
|
||||||
$(CAS_LDPATH) \
|
$(CAS_LDPATH) \
|
||||||
$(LIBXML_LIBS) \
|
$(LIBXML_LIBS) \
|
||||||
$(GEOM_LDFLAGS) \
|
|
||||||
../libXAO.la
|
../libXAO.la
|
||||||
|
|
||||||
dist_TestXAO_SOURCES = \
|
dist_TestXAO_SOURCES = \
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "TestUtils.hxx"
|
#include "TestUtils.hxx"
|
||||||
#include "XaoTest.hxx"
|
#include "XaoTest.hxx"
|
||||||
|
#include "../XAO_XaoUtils.hxx"
|
||||||
#include "../XAO_Xao.hxx"
|
#include "../XAO_Xao.hxx"
|
||||||
#include "../XAO_BrepGeometry.hxx"
|
#include "../XAO_BrepGeometry.hxx"
|
||||||
#include "../XAO_Group.hxx"
|
#include "../XAO_Group.hxx"
|
||||||
@ -25,7 +25,7 @@ void XaoTest::cleanUp()
|
|||||||
void XaoTest::testGroups()
|
void XaoTest::testGroups()
|
||||||
{
|
{
|
||||||
Xao obj;
|
Xao obj;
|
||||||
CPPUNIT_ASSERT_THROW(obj.addGroup(XAO::FACE), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(obj.addGroup(XAO::FACE), XAO_Exception);
|
||||||
|
|
||||||
BrepGeometry* geom = new BrepGeometry("test");
|
BrepGeometry* geom = new BrepGeometry("test");
|
||||||
obj.setGeometry(geom);
|
obj.setGeometry(geom);
|
||||||
@ -36,7 +36,7 @@ void XaoTest::testGroups()
|
|||||||
|
|
||||||
Group* agr = obj.getGroup(0);
|
Group* agr = obj.getGroup(0);
|
||||||
CPPUNIT_ASSERT(gr == agr);
|
CPPUNIT_ASSERT(gr == agr);
|
||||||
CPPUNIT_ASSERT_THROW(obj.getGroup(10), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(obj.getGroup(10), XAO_Exception);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(true, obj.removeGroup(gr2));
|
CPPUNIT_ASSERT_EQUAL(true, obj.removeGroup(gr2));
|
||||||
CPPUNIT_ASSERT(gr2 != NULL);
|
CPPUNIT_ASSERT(gr2 != NULL);
|
||||||
@ -47,7 +47,7 @@ void XaoTest::testGroups()
|
|||||||
void XaoTest::testFields()
|
void XaoTest::testFields()
|
||||||
{
|
{
|
||||||
Xao obj;
|
Xao obj;
|
||||||
CPPUNIT_ASSERT_THROW(obj.addField(XAO::INTEGER, XAO::FACE, 3), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(obj.addField(XAO::INTEGER, XAO::FACE, 3), XAO_Exception);
|
||||||
|
|
||||||
BrepGeometry* geom = new BrepGeometry("test");
|
BrepGeometry* geom = new BrepGeometry("test");
|
||||||
obj.setGeometry(geom);
|
obj.setGeometry(geom);
|
||||||
@ -61,7 +61,7 @@ void XaoTest::testFields()
|
|||||||
Field* fd = obj.addField(XAO::DOUBLE, XAO::FACE, 3);
|
Field* fd = obj.addField(XAO::DOUBLE, XAO::FACE, 3);
|
||||||
Field* fs = obj.addField(XAO::STRING, XAO::FACE, 3);
|
Field* fs = obj.addField(XAO::STRING, XAO::FACE, 3);
|
||||||
CPPUNIT_ASSERT_EQUAL(4, obj.countFields());
|
CPPUNIT_ASSERT_EQUAL(4, obj.countFields());
|
||||||
CPPUNIT_ASSERT_THROW(obj.getField(10), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(obj.getField(10), XAO_Exception);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(true, obj.removeField(fb));
|
CPPUNIT_ASSERT_EQUAL(true, obj.removeField(fb));
|
||||||
CPPUNIT_ASSERT(fb != NULL);
|
CPPUNIT_ASSERT(fb != NULL);
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#include <Utils_SALOME_Exception.hxx>
|
|
||||||
|
|
||||||
#include "XaoUtilsTest.hxx"
|
#include "XaoUtilsTest.hxx"
|
||||||
#include "../XAO_Xao.hxx"
|
#include "../XAO_Xao.hxx"
|
||||||
#include "../XAO_XaoUtils.hxx"
|
#include "../XAO_XaoUtils.hxx"
|
||||||
@ -28,7 +26,7 @@ void XaoUtilsTest::testBoolean()
|
|||||||
CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("1"));
|
CPPUNIT_ASSERT_EQUAL(true, XaoUtils::stringToBoolean("1"));
|
||||||
CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("false"));
|
CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("false"));
|
||||||
CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("0"));
|
CPPUNIT_ASSERT_EQUAL(false, XaoUtils::stringToBoolean("0"));
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToBoolean("abc"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToBoolean("abc"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaoUtilsTest::testInteger()
|
void XaoUtilsTest::testInteger()
|
||||||
@ -37,7 +35,7 @@ void XaoUtilsTest::testInteger()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string("123"), XaoUtils::intToString(123));
|
CPPUNIT_ASSERT_EQUAL(std::string("123"), XaoUtils::intToString(123));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(123, XaoUtils::stringToInt("123"));
|
CPPUNIT_ASSERT_EQUAL(123, XaoUtils::stringToInt("123"));
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToInt("abc"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToInt("abc"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaoUtilsTest::testDouble()
|
void XaoUtilsTest::testDouble()
|
||||||
@ -46,7 +44,7 @@ void XaoUtilsTest::testDouble()
|
|||||||
CPPUNIT_ASSERT_EQUAL(std::string("12.3"), XaoUtils::doubleToString(12.3));
|
CPPUNIT_ASSERT_EQUAL(std::string("12.3"), XaoUtils::doubleToString(12.3));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.123, XaoUtils::stringToDouble("0.123"), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.123, XaoUtils::stringToDouble("0.123"), 1e-3);
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToDouble("abc"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToDouble("abc"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaoUtilsTest::testDimension()
|
void XaoUtilsTest::testDimension()
|
||||||
@ -62,7 +60,7 @@ void XaoUtilsTest::testDimension()
|
|||||||
CPPUNIT_ASSERT_EQUAL(XAO::FACE, XaoUtils::stringToDimension("face"));
|
CPPUNIT_ASSERT_EQUAL(XAO::FACE, XaoUtils::stringToDimension("face"));
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::SOLID, XaoUtils::stringToDimension("solid"));
|
CPPUNIT_ASSERT_EQUAL(XAO::SOLID, XaoUtils::stringToDimension("solid"));
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::WHOLE, XaoUtils::stringToDimension("whole"));
|
CPPUNIT_ASSERT_EQUAL(XAO::WHOLE, XaoUtils::stringToDimension("whole"));
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToDimension("zz"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToDimension("zz"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaoUtilsTest::testType()
|
void XaoUtilsTest::testType()
|
||||||
@ -76,7 +74,7 @@ void XaoUtilsTest::testType()
|
|||||||
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, XaoUtils::stringToFieldType("integer"));
|
CPPUNIT_ASSERT_EQUAL(XAO::INTEGER, XaoUtils::stringToFieldType("integer"));
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, XaoUtils::stringToFieldType("double"));
|
CPPUNIT_ASSERT_EQUAL(XAO::DOUBLE, XaoUtils::stringToFieldType("double"));
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::STRING, XaoUtils::stringToFieldType("string"));
|
CPPUNIT_ASSERT_EQUAL(XAO::STRING, XaoUtils::stringToFieldType("string"));
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToFieldType("zz"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToFieldType("zz"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaoUtilsTest::testFormat()
|
void XaoUtilsTest::testFormat()
|
||||||
@ -86,5 +84,5 @@ void XaoUtilsTest::testFormat()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::BREP, XaoUtils::stringToShapeFormat("BREP"));
|
CPPUNIT_ASSERT_EQUAL(XAO::BREP, XaoUtils::stringToShapeFormat("BREP"));
|
||||||
CPPUNIT_ASSERT_EQUAL(XAO::STEP, XaoUtils::stringToShapeFormat("STEP"));
|
CPPUNIT_ASSERT_EQUAL(XAO::STEP, XaoUtils::stringToShapeFormat("STEP"));
|
||||||
CPPUNIT_ASSERT_THROW(XaoUtils::stringToShapeFormat("zz"), SALOME_Exception);
|
CPPUNIT_ASSERT_THROW(XaoUtils::stringToShapeFormat("zz"), XAO_Exception);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user