From 7230314b57342b801658d1310a8c8526842ebf51 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 14 Dec 2020 16:58:21 +0300 Subject: [PATCH] bos #20493 Sync XAO with GEOM module --- src/XAO/XAO_BooleanField.cxx | 16 ++--- src/XAO/XAO_BooleanField.hxx | 13 ++-- src/XAO/XAO_BooleanStep.cxx | 31 ++++----- src/XAO/XAO_BooleanStep.hxx | 22 +++---- src/XAO/XAO_BrepGeometry.cxx | 75 ++++++++++----------- src/XAO/XAO_BrepGeometry.hxx | 78 +++++++++++----------- src/XAO/XAO_DoubleField.cxx | 18 ++--- src/XAO/XAO_DoubleField.hxx | 12 ++-- src/XAO/XAO_DoubleStep.cxx | 42 ++++++------ src/XAO/XAO_DoubleStep.hxx | 23 ++++--- src/XAO/XAO_Exception.hxx | 8 +-- src/XAO/XAO_Field.cxx | 24 +++---- src/XAO/XAO_Field.hxx | 37 +++++------ src/XAO/XAO_GeometricElement.cxx | 30 ++++----- src/XAO/XAO_GeometricElement.hxx | 24 +++---- src/XAO/XAO_Geometry.cxx | 46 ++++++------- src/XAO/XAO_Geometry.hxx | 109 +++++++++++++++---------------- src/XAO/XAO_Group.cxx | 10 ++- src/XAO/XAO_Group.hxx | 20 +++--- src/XAO/XAO_IntegerField.cxx | 18 ++--- src/XAO/XAO_IntegerField.hxx | 12 ++-- src/XAO/XAO_IntegerStep.cxx | 42 ++++++------ src/XAO/XAO_IntegerStep.hxx | 22 +++---- src/XAO/XAO_Step.cxx | 15 ++--- src/XAO/XAO_Step.hxx | 30 ++++----- src/XAO/XAO_StringField.cxx | 18 ++--- src/XAO/XAO_StringField.hxx | 12 ++-- src/XAO/XAO_StringStep.cxx | 42 ++++++------ src/XAO/XAO_StringStep.hxx | 22 +++---- src/XAO/XAO_Xao.cxx | 76 ++++++++++----------- src/XAO/XAO_Xao.hxx | 56 ++++++++-------- src/XAO/XAO_XaoExporter.cxx | 24 +++---- src/XAO/XAO_XaoExporter.hxx | 14 ++-- src/XAO/XAO_XaoUtils.cxx | 37 ++++------- src/XAO/XAO_XaoUtils.hxx | 24 +++---- 35 files changed, 513 insertions(+), 589 deletions(-) diff --git a/src/XAO/XAO_BooleanField.cxx b/src/XAO/XAO_BooleanField.cxx index 7e9239ea0..dfae8c33f 100644 --- a/src/XAO/XAO_BooleanField.cxx +++ b/src/XAO/XAO_BooleanField.cxx @@ -24,26 +24,23 @@ using namespace XAO; -BooleanField::BooleanField(const XAO::Dimension& dimension, - const int& nbElements, const int& nbComponents, const std::string& name) +BooleanField::BooleanField(XAO::Dimension dimension, + int nbElements, int nbComponents, const std::string& name) : Field(dimension, nbElements, nbComponents, name) { } -Step* BooleanField::addNewStep(const int& step) -throw (XAO_Exception) +Step* BooleanField::addNewStep(int step) { return addStep(step, 0); } -BooleanStep* BooleanField::addStep(const int& step) -throw (XAO_Exception) +BooleanStep* BooleanField::addStep(int step) { return addStep(step, 0); } -BooleanStep* BooleanField::addStep(const int& step, const int& stamp) -throw (XAO_Exception) +BooleanStep* BooleanField::addStep(int step, int stamp) { if (hasStep(step)) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); @@ -53,8 +50,7 @@ throw (XAO_Exception) return bstep; } -BooleanStep* BooleanField::getStep(const int& index) -throw (XAO_Exception) +BooleanStep* BooleanField::getStep(int index) { checkStepIndex(index); return (BooleanStep*)m_steps[index]; diff --git a/src/XAO/XAO_BooleanField.hxx b/src/XAO/XAO_BooleanField.hxx index 083fc73ca..e6f5870c1 100644 --- a/src/XAO/XAO_BooleanField.hxx +++ b/src/XAO/XAO_BooleanField.hxx @@ -49,18 +49,18 @@ namespace XAO * @param nbComponents the number of components. * @param name the name of the field. */ - BooleanField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name); + BooleanField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - virtual const XAO::Type getType() { return XAO::BOOLEAN; } + virtual XAO::Type getType() { return XAO::BOOLEAN; } - virtual Step* addNewStep(const int& step) throw (XAO_Exception); + virtual Step* addNewStep(int step); /** * Adds a new step. * @param step the number of the step. * @return the newly created step. */ - BooleanStep* addStep(const int& step) throw (XAO_Exception); + BooleanStep* addStep(int step); /** * Adds a new step. @@ -68,15 +68,14 @@ namespace XAO * @param stamp the stamp of the step. * @return the newly created step. */ - BooleanStep* addStep(const int& step, const int& stamp) - throw (XAO_Exception); + BooleanStep* addStep(int step, int stamp); /** * Gets the step of given index. * @param index the index. * @return the step for the given index. */ - BooleanStep* getStep(const int& index) throw (XAO_Exception); + BooleanStep* getStep(int index); }; } diff --git a/src/XAO/XAO_BooleanStep.cxx b/src/XAO/XAO_BooleanStep.cxx index 46b75ae69..571f7e9b8 100644 --- a/src/XAO/XAO_BooleanStep.cxx +++ b/src/XAO/XAO_BooleanStep.cxx @@ -23,7 +23,7 @@ using namespace XAO; -BooleanStep::BooleanStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents) +BooleanStep::BooleanStep(int step, int stamp, int nbElements, int nbComponents) { m_nbElements = nbElements; m_nbComponents = nbComponents; @@ -56,8 +56,7 @@ std::vector BooleanStep::getValues() return result; } -std::vector BooleanStep::getElement(const int& element) -throw (XAO_Exception) +std::vector BooleanStep::getElement(int element) { checkElementIndex(element); @@ -65,8 +64,7 @@ throw (XAO_Exception) return result; } -std::vector BooleanStep::getComponent(const int& component) -throw (XAO_Exception) +std::vector BooleanStep::getComponent(int component) { checkComponentIndex(component); @@ -83,8 +81,7 @@ throw (XAO_Exception) return result; } -const bool BooleanStep::getValue(const int& element, const int& component) -throw (XAO_Exception) +bool BooleanStep::getValue(int element, int component) { checkElementIndex(element); checkComponentIndex(component); @@ -92,14 +89,12 @@ throw (XAO_Exception) return m_values[element][component]; } -const std::string BooleanStep::getStringValue(const int& element, const int& component) -throw (XAO_Exception) +const std::string BooleanStep::getStringValue(int element, int component) { return XaoUtils::booleanToString(getValue(element, component)); } void BooleanStep::setValues(const std::vector& values) -throw (XAO_Exception) { checkNbValues((int)values.size()); @@ -112,28 +107,25 @@ throw (XAO_Exception) } } -void BooleanStep::setElement(const int& element, const std::vector& elements) -throw (XAO_Exception) +void BooleanStep::setElement(int element, const std::vector& elements) { checkElementIndex(element); - checkNbComponents((int)elements.size()); + checkNbComponents(elements.size()); for (int i = 0; i < m_nbComponents; ++i) m_values[element][i] = elements[i]; } -void BooleanStep::setComponent(const int& component, const std::vector& components) -throw (XAO_Exception) +void BooleanStep::setComponent(int component, const std::vector& components) { checkComponentIndex(component); - checkNbElements((int)components.size()); + checkNbElements(components.size()); for (int i = 0; i < m_nbElements; ++i) m_values[i][component] = components[i]; } -void BooleanStep::setValue(const int& element, const int& component, const bool& value) -throw (XAO_Exception) +void BooleanStep::setValue(int element, int component, bool value) { checkElementIndex(element); checkComponentIndex(component); @@ -141,8 +133,7 @@ throw (XAO_Exception) m_values[element][component] = value; } -void BooleanStep::setStringValue(const int& element, const int& component, const std::string& value) -throw (XAO_Exception) +void BooleanStep::setStringValue(int element, int component, const std::string& value) { setValue(element, component, XaoUtils::stringToBoolean(value)); } diff --git a/src/XAO/XAO_BooleanStep.hxx b/src/XAO/XAO_BooleanStep.hxx index bde926ff4..6b0845342 100644 --- a/src/XAO/XAO_BooleanStep.hxx +++ b/src/XAO/XAO_BooleanStep.hxx @@ -49,9 +49,9 @@ namespace XAO * @param nbElements the number elements of the geometry. * @param nbComponents the number of components of the field. */ - BooleanStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents); + BooleanStep(int step, int stamp, int nbElements, int nbComponents); - virtual const XAO::Type getType() { return XAO::BOOLEAN; } + virtual XAO::Type getType() { return XAO::BOOLEAN; } /** * Gets all the values in a vector by elements and by components. @@ -64,14 +64,14 @@ namespace XAO * @param element the index of the element to get. * @return a vector containing all the values for the given element. */ - std::vector getElement(const int& element) throw (XAO_Exception); + std::vector getElement(int element); /** * Gets all the values for a component. * @param component the index of the component to get. * @return a vector containing all the values for the given component. */ - std::vector getComponent(const int& component) throw (XAO_Exception); + std::vector getComponent(int component); /** * Gets a value for an element and a component. @@ -79,27 +79,27 @@ namespace XAO * @param component the index of the component. * @return the value. */ - const bool getValue(const int& element, const int& component) throw (XAO_Exception); + bool getValue(int element, int component); /** * Sets all the values from a list. * @param values the list of values to set. */ - void setValues(const std::vector& values) throw (XAO_Exception); + void setValues(const std::vector& values); /** * Sets the values for an element. * @param element the index of the element to set. * @param elements the values to set. */ - void setElement(const int& element, const std::vector& elements) throw (XAO_Exception); + void setElement(int element, const std::vector& elements); /** * Sets the values for a component. * @param component the index of the component to set. * @param components the values to set. */ - void setComponent(const int& component, const std::vector& components) throw (XAO_Exception); + void setComponent(int component, const std::vector& components); /** * Sets the value for an element and a component. @@ -107,10 +107,10 @@ namespace XAO * @param component the index of the component. * @param value the value. */ - void setValue(const int& element, const int& component, const bool& value) throw (XAO_Exception); + void setValue(int element, int component, bool value); - 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) throw (XAO_Exception); + virtual const std::string getStringValue(int element, int component); + virtual void setStringValue(int element, int component, const std::string& value); private: std::vector< std::vector > m_values; diff --git a/src/XAO/XAO_BrepGeometry.cxx b/src/XAO/XAO_BrepGeometry.cxx index 1dccf451a..e69f66d18 100644 --- a/src/XAO/XAO_BrepGeometry.cxx +++ b/src/XAO/XAO_BrepGeometry.cxx @@ -66,7 +66,6 @@ void BrepGeometry::setShapeString(const std::string& shape) } void BrepGeometry::writeShapeFile(const std::string& fileName) -throw (XAO_Exception) { bool res = BRepTools::Write(m_shape, fileName.c_str()); if (!res) @@ -74,7 +73,6 @@ throw (XAO_Exception) } void BrepGeometry::readShapeFile(const std::string& fileName) -throw (XAO_Exception) { BRep_Builder builder; bool res = BRepTools::Read(m_shape, fileName.c_str(), builder); @@ -136,8 +134,7 @@ void BrepGeometry::initListIds(const TopAbs_ShapeEnum& shapeType, GeometricEleme } } -TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, const int& shapeIndex) -throw (XAO_Exception) +TopoDS_Shape BrepGeometry::getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, int shapeIndex) { TopTools_MapOfShape mapShape; TopTools_ListOfShape listShape; @@ -166,7 +163,7 @@ throw (XAO_Exception) } // ----------------------------- -const int BrepGeometry::countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType) +int BrepGeometry::countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType) { int res = 0; TopExp_Explorer exp(shape, shapeType); @@ -176,7 +173,7 @@ const int BrepGeometry::countGeometricalElements(const TopoDS_Shape& shape, cons return res; } -std::vector BrepGeometry::getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, const XAO::Dimension& dim) +std::vector BrepGeometry::getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, XAO::Dimension dim) { std::vector indexList; @@ -208,7 +205,7 @@ std::vector BrepGeometry::getGeometricalElements(const TopoDS_Shape& shape, return indexList; } -void BrepGeometry::getEdgeVertices(const int& edgeIndex, int& vertexA, int& vertexB) +void BrepGeometry::getEdgeVertices(int edgeIndex, int& vertexA, int& vertexB) { TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); std::vector vertices = getGeometricalElements(edge, TopAbs_VERTEX, XAO::VERTEX); @@ -218,13 +215,13 @@ void BrepGeometry::getEdgeVertices(const int& edgeIndex, int& vertexA, int& vert vertexB = vertices[1]; } -const int BrepGeometry::countFaceWires(const int& faceIndex) +int BrepGeometry::countFaceWires(int faceIndex) { TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); return countGeometricalElements(face, TopAbs_WIRE); } -std::vector BrepGeometry::getFaceEdges(const int& faceIndex, const int& wireIndex) +std::vector BrepGeometry::getFaceEdges(int faceIndex, int wireIndex) { // get the face TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); @@ -233,21 +230,20 @@ std::vector BrepGeometry::getFaceEdges(const int& faceIndex, const int& wir return getGeometricalElements(wire, TopAbs_EDGE, XAO::EDGE); } -const int BrepGeometry::countSolidShells(const int& solidIndex) +int BrepGeometry::countSolidShells(int solidIndex) { TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); return countGeometricalElements(solid, TopAbs_SHELL); } -std::vector BrepGeometry::getSolidFaces(const int& solidIndex, const int& shellIndex) +std::vector BrepGeometry::getSolidFaces(int solidIndex, int shellIndex) { TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); TopoDS_Shape shell = getSubShape(solid, TopAbs_SHELL, shellIndex); return getGeometricalElements(shell, TopAbs_FACE, XAO::FACE); } -void BrepGeometry::getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord) -throw (XAO_Exception) +void BrepGeometry::getVertexXYZ(int vertexIndex, double& xCoord, double& yCoord, double& zCoord) { xCoord = 0.; yCoord = 0.; @@ -268,7 +264,7 @@ throw (XAO_Exception) } // ----------------------------- -const double BrepGeometry::getEdgeLength(const int& edgeIndex) +double BrepGeometry::getEdgeLength(int edgeIndex) { TopoDS_Shape edge = getSubShape(m_shape, TopAbs_EDGE, edgeIndex); GProp_GProps system; @@ -276,7 +272,7 @@ const double BrepGeometry::getEdgeLength(const int& edgeIndex) return system.Mass(); } -const double BrepGeometry::getFaceArea(const int& faceIndex) +double BrepGeometry::getFaceArea(int faceIndex) { TopoDS_Shape face = getSubShape(m_shape, TopAbs_FACE, faceIndex); GProp_GProps system; @@ -284,7 +280,7 @@ const double BrepGeometry::getFaceArea(const int& faceIndex) return system.Mass(); } -const double BrepGeometry::getSolidVolume(const int& solidIndex) +double BrepGeometry::getSolidVolume(int solidIndex) { TopoDS_Shape solid = getSubShape(m_shape, TopAbs_SOLID, solidIndex); GProp_GProps system; @@ -293,50 +289,49 @@ const double BrepGeometry::getSolidVolume(const int& solidIndex) } // ----------------------------- -const int BrepGeometry::getVertexID(const int& index) +int BrepGeometry::getVertexID(int index) { return XaoUtils::stringToInt(getVertexReference(index)); } -const int BrepGeometry::getEdgeID(const int& index) +int BrepGeometry::getEdgeID(int index) { return XaoUtils::stringToInt(getEdgeReference(index)); } -const int BrepGeometry::getFaceID(const int& index) +int BrepGeometry::getFaceID(int index) { return XaoUtils::stringToInt(getFaceReference(index)); } -const int BrepGeometry::getSolidID(const int& index) +int BrepGeometry::getSolidID(int index) { return XaoUtils::stringToInt(getSolidReference(index)); } // ----------------------------- -void BrepGeometry::setVertexID(const int& index, const int& id) +void BrepGeometry::setVertexID(int index, int id) { setVertexReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setEdgeID(const int& index, const int& id) +void BrepGeometry::setEdgeID(int index, int id) { setEdgeReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setFaceID(const int& index, const int& id) +void BrepGeometry::setFaceID(int index, int id) { setEdgeReference(index, XaoUtils::intToString(id)); } -void BrepGeometry::setSolidID(const int& index, const int& id) +void BrepGeometry::setSolidID(int index, int id) { setEdgeReference(index, XaoUtils::intToString(id)); } // ----------------------------- -const int BrepGeometry::findElement(const XAO::Dimension& dim, const int& id) -throw (XAO_Exception) +int BrepGeometry::findElement(XAO::Dimension dim, int id) { if (dim == XAO::VERTEX) return findVertex(id); @@ -350,68 +345,64 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown Dimension: " << dim); } -const int BrepGeometry::findVertex(const int& id) +int BrepGeometry::findVertex(int id) { return getVertexIndexByReference(XaoUtils::intToString(id)); } -const int BrepGeometry::findEdge(const int& id) +int BrepGeometry::findEdge(int id) { return getEdgeIndexByReference(XaoUtils::intToString(id)); } -const int BrepGeometry::findFace(const int& id) +int BrepGeometry::findFace(int id) { return getFaceIndexByReference(XaoUtils::intToString(id)); } -const int BrepGeometry::findSolid(const int& id) +int BrepGeometry::findSolid(int id) { return getSolidIndexByReference(XaoUtils::intToString(id)); } // ----------------------------- -const std::string BrepGeometry::findVertexName(const int& id) +const std::string BrepGeometry::findVertexName(int id) { return getVertexName(findVertex(id)); } -const std::string BrepGeometry::findEdgeName(const int& id) +const std::string BrepGeometry::findEdgeName(int id) { return getEdgeName(findEdge(id)); } -const std::string BrepGeometry::findFaceName(const int& id) +const std::string BrepGeometry::findFaceName(int id) { return getFaceName(findFace(id)); } -const std::string BrepGeometry::findSolidName(const int& id) +const std::string BrepGeometry::findSolidName(int id) { return getSolidName(findSolid(id)); } // ----------------------------- -void BrepGeometry::changeVertexName(const int& id, const std::string& name) -throw (XAO_Exception) +void BrepGeometry::changeVertexName(int id, const std::string& name) { setVertexName(findVertex(id), name); } -void BrepGeometry::changeEdgeName(const int& id, const std::string& name) -throw (XAO_Exception) +void BrepGeometry::changeEdgeName(int id, const std::string& name) { setEdgeName(findEdge(id), name); } -void BrepGeometry::changeFaceName(const int& id, const std::string& name) -throw (XAO_Exception) +void BrepGeometry::changeFaceName(int id, const std::string& name) { setFaceName(findFace(id), name); } -void BrepGeometry::changeSolidName(const int& id, const std::string& name) -throw (XAO_Exception) +void BrepGeometry::changeSolidName(int id, const std::string& name) { setSolidName(findSolid(id), name); } diff --git a/src/XAO/XAO_BrepGeometry.hxx b/src/XAO/XAO_BrepGeometry.hxx index 5e02757ab..082c8165e 100644 --- a/src/XAO/XAO_BrepGeometry.hxx +++ b/src/XAO/XAO_BrepGeometry.hxx @@ -61,7 +61,7 @@ namespace XAO * Gets the format of the geometry. * @return the format of the geometry. */ - virtual const XAO::Format getFormat() { return XAO::BREP; } + virtual XAO::Format getFormat() { return XAO::BREP; } /** * Gets the shape as a string. @@ -79,13 +79,13 @@ namespace XAO * Writes shape to a file * @param fileName the path to the file */ - virtual void writeShapeFile(const std::string& fileName) throw (XAO_Exception); + virtual void writeShapeFile(const std::string& fileName) ; /** * Reads shape from a file * @param fileName the path to the file */ - virtual void readShapeFile(const std::string& fileName) throw (XAO_Exception); + virtual void readShapeFile(const std::string& fileName) ; #ifdef SWIG %pythoncode %{ @@ -115,14 +115,14 @@ namespace XAO * @param vertexA * @param vertexB */ - void getEdgeVertices(const int& edgeIndex, int& vertexA, int& vertexB); + void getEdgeVertices(int edgeIndex, int& vertexA, int& vertexB); /** * Gets the number of wires of a face (including holes). * @param faceIndex the index of the face. * @return the number of wires. */ - const int countFaceWires(const int& faceIndex); + int countFaceWires(int faceIndex); /** * Gets the indices of the wires of the face. @@ -130,14 +130,14 @@ namespace XAO * @param wireIndex the index of the wire. * @return the list of wires for the given face. */ - std::vector getFaceEdges(const int& faceIndex, const int& wireIndex); + std::vector getFaceEdges(int faceIndex, int wireIndex); /** * Gets the number of shells of a solid (including cavities). * @param solidIndex the index of the solid. * @return the number of shells. */ - const int countSolidShells(const int& solidIndex); + int countSolidShells(int solidIndex); /** * Gets the indices of the shells of the solids. @@ -145,7 +145,7 @@ namespace XAO * @param shellIndex the index of the shell (for the given solid). * @return the list of shells for the given solid. */ - std::vector getSolidFaces(const int& solidIndex, const int& shellIndex); + std::vector getSolidFaces(int solidIndex, int shellIndex); /** * Gets the coordinates of a vertex. @@ -154,179 +154,179 @@ namespace XAO * @param yCoord the Y coordinate. * @param zCoord the Z coordinate. */ - void getVertexXYZ(const int& vertexIndex, double& xCoord, double& yCoord, double& zCoord) - throw (XAO_Exception); + void getVertexXYZ(int vertexIndex, double& xCoord, double& yCoord, double& zCoord) + ; /** * Gets the length of an edge. * @param index the index of the edge. * @return the length of the edge. */ - const double getEdgeLength(const int& index); + double getEdgeLength(int index); /** * Gets the are of a face. * @param index the index of a face. * @return the area of the face. */ - const double getFaceArea(const int& index); + double getFaceArea(int index); /** * Gets the volume of a solid. * @param index the index of the solid. * @return the volume of the solid. */ - const double getSolidVolume(const int& index); + double getSolidVolume(int index); /** * Gets the ID of a vertex. * @param index the index of the vertex. * @return the ID of the vertex. */ - const int getVertexID(const int& index); + int getVertexID(int index); /** * Gets the ID of an edge. * @param index the index of the edge. * @return the ID of the edge. */ - const int getEdgeID(const int& index); + int getEdgeID(int index); /** * Gets the ID of a face. * @param index the index of the face. * @return the ID of the face. */ - const int getFaceID(const int& index); + int getFaceID(int index); /** * Gets the ID of a solid. * @param index the index of the solid. * @return the ID of the solid. */ - const int getSolidID(const int& index); + int getSolidID(int index); /** * Sets the ID of a vertex. * @param index the index of the vertex to set. * @param id the id to set. */ - void setVertexID(const int& index, const int& id); + void setVertexID(int index, int id); /** * Sets the ID of an edge. * @param index the index of the edge to set. * @param id the id to set. */ - void setEdgeID(const int& index, const int& id); + void setEdgeID(int index, int id); /** * Sets the ID of a face. * @param index the index of the face to set. * @param id the id to set. */ - void setFaceID(const int& index, const int& id); + void setFaceID(int index, int id); /** * Sets the ID of a solid. * @param index the index of the solid to set. * @param id the id to set. */ - void setSolidID(const int& index, const int& id); + void setSolidID(int index, int id); /** * Finds a vertex with its ID. * @param id the ID of the vertex. * @return the index of the vertex. */ - const int findVertex(const int& id); + int findVertex(int id); /** * Finds an edge with its ID. * @param id the ID of the edge. * @return the index of the edge. */ - const int findEdge(const int& id); + int findEdge(int id); /** * Finds a face with its ID. * @param id the ID of the face. * @return the index of the face. */ - const int findFace(const int& id); + int findFace(int id); /** * Finds a solid with its ID. * @param id the ID of the solid. * @return th index of the solid. */ - const int findSolid(const int& id); + int findSolid(int id); /** * Finds the name of a vertex with its ID. * @param id the ID of the vertex. * @return the name of the vertex. */ - const std::string findVertexName(const int& id); + const std::string findVertexName(int id); /** * Finds the name of an edge with its ID. * @param id the ID of the edge. * @return the name of the edge. */ - const std::string findEdgeName(const int& id); + const std::string findEdgeName(int id); /** * Finds the name of a face with its ID. * @param id the ID of the face. * @return the name of the face. */ - const std::string findFaceName(const int& id); + const std::string findFaceName(int id); /** * Finds the name of a solid with its ID. * @param id the ID of the solid. * @return the name of the solid. */ - const std::string findSolidName(const int& id); + const std::string findSolidName(int id); /** * Changes the name of a vertex. * @param id the ID of the vertex. * @param name the name to set. */ - void changeVertexName(const int& id, const std::string& name) throw (XAO_Exception); + void changeVertexName(int id, const std::string& name) ; /** * Changes the name of an edge. * @param id the ID of the edge * @param name the name to set. */ - void changeEdgeName(const int& id, const std::string& name) throw (XAO_Exception); + void changeEdgeName(int id, const std::string& name) ; /** * Changes the name of a face. * @param id the ID of the face. * @param name the name to set. */ - void changeFaceName(const int& id, const std::string& name) throw (XAO_Exception); + void changeFaceName(int id, const std::string& name) ; /** * Changes the name of a solid. * @param id the ID of the solid. * @param name the name to set. */ - void changeSolidName(const int& id, const std::string& name) throw (XAO_Exception); + void changeSolidName(int id, const std::string& name) ; private: void initIds(); void initListIds(const TopAbs_ShapeEnum& shapeType, GeometricElementList& eltList); - 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); - std::vector getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, const XAO::Dimension& dim); - const int findElement(const XAO::Dimension& dim, const int& id) - throw (XAO_Exception); + TopoDS_Shape getSubShape(const TopoDS_Shape& mainShape, const TopAbs_ShapeEnum& shapeType, int shapeIndex) + ; + int countGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType); + std::vector getGeometricalElements(const TopoDS_Shape& shape, const TopAbs_ShapeEnum& shapeType, XAO::Dimension dim); + int findElement(XAO::Dimension dim, int id) + ; private: TopoDS_Shape m_shape; diff --git a/src/XAO/XAO_DoubleField.cxx b/src/XAO/XAO_DoubleField.cxx index e6544525e..e237d4acf 100644 --- a/src/XAO/XAO_DoubleField.cxx +++ b/src/XAO/XAO_DoubleField.cxx @@ -24,25 +24,25 @@ using namespace XAO; -DoubleField::DoubleField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name) +DoubleField::DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) : Field(dimension, nbElements, nbComponents, name) { } -Step* DoubleField::addNewStep(const int& step) -throw (XAO_Exception) +Step* DoubleField::addNewStep(int step) + { return addStep(step, 0); } -DoubleStep* DoubleField::addStep(const int& step) -throw (XAO_Exception) +DoubleStep* DoubleField::addStep(int step) + { return addStep(step, 0); } -DoubleStep* DoubleField::addStep(const int& step, const int& stamp) -throw (XAO_Exception) +DoubleStep* DoubleField::addStep(int step, int stamp) + { if (hasStep(step)) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); @@ -52,8 +52,8 @@ throw (XAO_Exception) return bstep; } -DoubleStep* DoubleField::getStep(const int& index) -throw (XAO_Exception) +DoubleStep* DoubleField::getStep(int index) + { checkStepIndex(index); return (DoubleStep*)m_steps[index]; diff --git a/src/XAO/XAO_DoubleField.hxx b/src/XAO/XAO_DoubleField.hxx index ee055c534..4ac86366e 100644 --- a/src/XAO/XAO_DoubleField.hxx +++ b/src/XAO/XAO_DoubleField.hxx @@ -49,18 +49,18 @@ namespace XAO * @param nbComponents the number of components. * @param name the name of the field. */ - DoubleField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name); + DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - virtual const XAO::Type getType() { return XAO::DOUBLE; } + virtual XAO::Type getType() { return XAO::DOUBLE; } - virtual Step* addNewStep(const int& step) throw (XAO_Exception); + virtual Step* addNewStep(int step) ; /** * Adds a new step. * @param step the number of the step. * @return the newly created step. */ - DoubleStep* addStep(const int& step) throw (XAO_Exception); + DoubleStep* addStep(int step) ; /** * Adds a new step. @@ -68,14 +68,14 @@ namespace XAO * @param stamp the stamp of the step. * @return the newly created step. */ - DoubleStep* addStep(const int& step, const int& stamp) throw (XAO_Exception); + DoubleStep* addStep(int step, int stamp) ; /** * Gets the step of given index. * @param index the index. * @return the step for the given index. */ - DoubleStep* getStep(const int& index) throw (XAO_Exception); + DoubleStep* getStep(int index) ; }; } diff --git a/src/XAO/XAO_DoubleStep.cxx b/src/XAO/XAO_DoubleStep.cxx index 787155320..64f56925f 100644 --- a/src/XAO/XAO_DoubleStep.cxx +++ b/src/XAO/XAO_DoubleStep.cxx @@ -23,7 +23,7 @@ using namespace XAO; -DoubleStep::DoubleStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents) +DoubleStep::DoubleStep(int step, int stamp, int nbElements, int nbComponents) { m_nbElements = nbElements; m_nbComponents = nbComponents; @@ -56,8 +56,8 @@ std::vector DoubleStep::getValues() return result; } -std::vector DoubleStep::getElement(const int& element) -throw (XAO_Exception) +std::vector DoubleStep::getElement(int element) + { checkElementIndex(element); @@ -65,8 +65,8 @@ throw (XAO_Exception) return result; } -std::vector DoubleStep::getComponent(const int& component) -throw (XAO_Exception) +std::vector DoubleStep::getComponent(int component) + { checkComponentIndex(component); @@ -83,8 +83,8 @@ throw (XAO_Exception) return result; } -const double DoubleStep::getValue(const int& element, const int& component) -throw (XAO_Exception) +double DoubleStep::getValue(int element, int component) + { checkElementIndex(element); checkComponentIndex(component); @@ -92,16 +92,16 @@ throw (XAO_Exception) return m_values[element][component]; } -const std::string DoubleStep::getStringValue(const int& element, const int& component) -throw (XAO_Exception) +const std::string DoubleStep::getStringValue(int element, int component) + { return XaoUtils::doubleToString(getValue(element, component)); } void DoubleStep::setValues(const std::vector& values) -throw (XAO_Exception) + { - checkNbValues((int)values.size()); + checkNbValues(values.size()); for (int i = 0; i < m_nbElements; ++i) { @@ -112,28 +112,28 @@ throw (XAO_Exception) } } -void DoubleStep::setElement(const int& element, const std::vector& elements) -throw (XAO_Exception) +void DoubleStep::setElement(int element, const std::vector& elements) + { checkElementIndex(element); - checkNbComponents((int)elements.size()); + checkNbComponents(elements.size()); for (int i = 0; i < m_nbComponents; ++i) m_values[element][i] = elements[i]; } -void DoubleStep::setComponent(const int& component, const std::vector& components) -throw (XAO_Exception) +void DoubleStep::setComponent(int component, const std::vector& components) + { checkElementIndex(component); - checkNbElements((int)components.size()); + checkNbElements(components.size()); for (int i = 0; i < m_nbElements; ++i) m_values[i][component] = components[i]; } -void DoubleStep::setValue(const int& element, const int& component, const double& value) -throw (XAO_Exception) +void DoubleStep::setValue(int element, int component, double value) + { checkElementIndex(element); checkComponentIndex(component); @@ -141,8 +141,8 @@ throw (XAO_Exception) m_values[element][component] = value; } -void DoubleStep::setStringValue(const int& element, const int& component, const std::string& value) -throw (XAO_Exception) +void DoubleStep::setStringValue(int element, int component, const std::string& value) + { setValue(element, component, XaoUtils::stringToDouble(value)); } diff --git a/src/XAO/XAO_DoubleStep.hxx b/src/XAO/XAO_DoubleStep.hxx index 18cb9c073..f14280a8e 100644 --- a/src/XAO/XAO_DoubleStep.hxx +++ b/src/XAO/XAO_DoubleStep.hxx @@ -28,7 +28,6 @@ #include "XAO_Step.hxx" #ifdef WIN32 -#pragma warning(disable:4251) // std::vector needs dll-interface #pragma warning(disable:4290) // Warning Exception ... #endif @@ -49,9 +48,9 @@ namespace XAO * @param nbElements the number elements of the geometry. * @param nbComponents the number of components of the field. */ - DoubleStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents); + DoubleStep(int step, int stamp, int nbElements, int nbComponents); - virtual const XAO::Type getType() { return XAO::DOUBLE; } + virtual XAO::Type getType() { return XAO::DOUBLE; } /** * Gets all the values of the step as a list. @@ -64,14 +63,14 @@ namespace XAO * @param element the index of the element. * @return a vector containing all the values for the given element. */ - std::vector getElement(const int& element) throw (XAO_Exception); + std::vector getElement(int element) ; /** * Gets all the values for a given component. * @param component the index of the component. * @return a vector containing all the values for the given component. */ - std::vector getComponent(const int& component) throw (XAO_Exception); + std::vector getComponent(int component) ; /** * Gets the value for an element and a component. @@ -79,27 +78,27 @@ namespace XAO * @param component the index of the component. * @return the value for the given element and component. */ - const double getValue(const int& element, const int& component) throw (XAO_Exception); + double getValue(int element, int component) ; /** * Sets all the values from a list. * @param values the list of values to set. */ - void setValues(const std::vector& values) throw (XAO_Exception); + void setValues(const std::vector& values) ; /** * Sets the values for an element. * @param element the index of the element to set. * @param elements the values to set. */ - void setElement(const int& element, const std::vector& elements) throw (XAO_Exception); + void setElement(int element, const std::vector& elements) ; /** * Sets the values for a component. * @param component the index of the component to set. * @param components the values to set. */ - void setComponent(const int& component, const std::vector& components) throw (XAO_Exception); + void setComponent(int component, const std::vector& components) ; /** * Sets the value for an element and a component. @@ -107,10 +106,10 @@ namespace XAO * @param component the index of the component. * @param value the value. */ - void setValue(const int& element, const int& component, const double& value) throw (XAO_Exception); + void setValue(int element, int component, double value) ; - 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) throw (XAO_Exception); + virtual const std::string getStringValue(int element, int component) ; + virtual void setStringValue(int element, int component, const std::string& value) ; private: std::vector< std::vector > m_values; diff --git a/src/XAO/XAO_Exception.hxx b/src/XAO/XAO_Exception.hxx index 3c99bb7a5..03a268f63 100644 --- a/src/XAO/XAO_Exception.hxx +++ b/src/XAO/XAO_Exception.hxx @@ -24,10 +24,6 @@ #include "XAO.hxx" #include -#ifdef WIN32 -#pragma warning(disable : 4275) // for std::exception -#endif - namespace XAO { /** @@ -45,13 +41,13 @@ namespace XAO { } - virtual ~XAO_Exception() throw() {}; + virtual ~XAO_Exception() noexcept {}; /** * Returns the error message. * @return the error message. */ - virtual const char* what() const throw () + virtual const char* what() const noexcept { return m_message; } diff --git a/src/XAO/XAO_Field.cxx b/src/XAO/XAO_Field.cxx index cc7087c7b..9213c463f 100644 --- a/src/XAO/XAO_Field.cxx +++ b/src/XAO/XAO_Field.cxx @@ -33,8 +33,8 @@ using namespace XAO; // ------------------------------------------------------- -Field::Field(const XAO::Dimension& dimension, - const int& nbElements, const int& nbComponents, const std::string& name) +Field::Field(XAO::Dimension dimension, + int nbElements, int nbComponents, const std::string& name) : m_name(name), m_dimension(dimension), m_nbComponents(nbComponents), m_components(nbComponents, ""), m_nbElements(nbElements) @@ -47,9 +47,8 @@ Field::~Field() delete m_steps[i]; } -Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension, - const int& nbElements, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +Field* Field::createField(XAO::Type type, XAO::Dimension dimension, + int nbElements, int nbComponents, const std::string& name) { if (type == XAO::BOOLEAN) return new BooleanField(dimension, nbElements, nbComponents, name); @@ -63,22 +62,19 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad Type: " << type); } -const std::string Field::getComponentName(const int& index) -throw (XAO_Exception) +const std::string Field::getComponentName(int index) { checkComponent(index); return m_components[index]; } -void Field::setComponentName(const int& index, const std::string& name) -throw (XAO_Exception) +void Field::setComponentName(int index, const std::string& name) { checkComponent(index); m_components[index] = name; } void Field::setComponentsNames(const std::vector& names) -throw (XAO_Exception) { for (unsigned int i = 0; i < names.size(); ++i) { @@ -103,7 +99,7 @@ bool Field::removeStep(Step* step) return false; } -bool Field::hasStep(const int& step) +bool Field::hasStep(int step) { std::vector::iterator it = m_steps.begin(); for (; it != m_steps.end(); ++it) @@ -116,8 +112,7 @@ bool Field::hasStep(const int& step) return false; } -void Field::checkComponent(const int& component) -throw (XAO_Exception) +void Field::checkComponent(int component) { if (component < m_nbComponents && component >= 0) return; @@ -126,8 +121,7 @@ throw (XAO_Exception) << m_nbComponents-1 << "]: " << component); } -void Field::checkStepIndex(const int& step) -throw (XAO_Exception) +void Field::checkStepIndex(int step) { if (step < (int)m_steps.size() && step >= 0) return; diff --git a/src/XAO/XAO_Field.hxx b/src/XAO/XAO_Field.hxx index 22cd0ae09..1b0ded1ff 100644 --- a/src/XAO/XAO_Field.hxx +++ b/src/XAO/XAO_Field.hxx @@ -52,8 +52,8 @@ namespace XAO * @param nbComponents the number of components. * @param name the name of the field. */ - Field(const XAO::Dimension& dimension, - const int& nbElements, const int& nbComponents, const std::string& name); + Field(XAO::Dimension dimension, + int nbElements, int nbComponents, const std::string& name); public: /** @@ -65,10 +65,9 @@ namespace XAO * @name the name of the field. * @return the created field. */ - static Field* createField(const XAO::Type& type, const XAO::Dimension& dimension, - const int& nbElements, const int& nbComponents, - const std::string& name = std::string("")) - throw (XAO_Exception); + static Field* createField(XAO::Type type, XAO::Dimension dimension, + int nbElements, int nbComponents, + const std::string& name = std::string("")); /** * Destructor. @@ -79,7 +78,7 @@ namespace XAO * Gets the Type of the field. * @return the Type of the field. */ - virtual const XAO::Type getType() = 0; + virtual XAO::Type getType() = 0; /** * Gets the name of the Field. @@ -103,7 +102,7 @@ namespace XAO * Gets the Dimension of the Field. * @return the Dimension of the Field. */ - const XAO::Dimension getDimension() const + XAO::Dimension getDimension() const { return m_dimension; } @@ -112,7 +111,7 @@ namespace XAO * Gets the number of elements of each step. * @return the number of elements of each step. */ - const int countElements() const + int countElements() const { return m_nbElements; } @@ -121,7 +120,7 @@ namespace XAO * Gets the number of components. * @return the number of components. */ - const int countComponents() const + int countComponents() const { return m_nbComponents; } @@ -130,7 +129,7 @@ namespace XAO * Gets the number of values for each step. * @return the number of values for each step. */ - const int countValues() const + int countValues() const { return m_nbElements * m_nbComponents; } @@ -139,34 +138,34 @@ namespace XAO * Gets the number of the steps. * @return the number of steps. */ - const int countSteps() const { return (int)m_steps.size(); } + int countSteps() const { return m_steps.size(); } /** * Gets the name of a component. * @param index the index of the component to get. * @return the name of the component for the given index. */ - const std::string getComponentName(const int& index) throw (XAO_Exception); + const std::string getComponentName(int index); /** * Sets the name of a component. * @param componentIndex the index of the component to set. * @param name the name to set. */ - void setComponentName(const int& componentIndex, const std::string& name) throw (XAO_Exception); + void setComponentName(int componentIndex, const std::string& name); /** * Sets the name of the components. * @param names the names to set. */ - void setComponentsNames(const std::vector& names) throw (XAO_Exception); + void setComponentsNames(const std::vector& names); /** * Adds a new step of the same type than the field. * @param number the numer of the step. * @return the new create step. */ - virtual Step* addNewStep(const int& number) throw (XAO_Exception) = 0; + virtual Step* addNewStep(int number) = 0; /** * Remove a step. @@ -180,7 +179,7 @@ namespace XAO * @param step the step number. * @return true if the field has a step for the given number. */ - bool hasStep(const int& step); + bool hasStep(int step); /** * Returns the first step. @@ -195,8 +194,8 @@ namespace XAO stepIterator end() { return m_steps.end(); } protected: - void checkComponent(const int& component) throw (XAO_Exception); - void checkStepIndex(const int& step) throw (XAO_Exception); + void checkComponent(int component) ; + void checkStepIndex(int step) ; protected: /** The name of the Field. */ diff --git a/src/XAO/XAO_GeometricElement.cxx b/src/XAO/XAO_GeometricElement.cxx index 82cd85048..566f9b34e 100644 --- a/src/XAO/XAO_GeometricElement.cxx +++ b/src/XAO/XAO_GeometricElement.cxx @@ -40,7 +40,7 @@ GeometricElement::~GeometricElement() { } -const bool GeometricElement::hasName() +bool GeometricElement::hasName() { return !m_name.empty(); } @@ -50,12 +50,12 @@ GeometricElementList::GeometricElementList() setSize(0); } -GeometricElementList::GeometricElementList(const int& count) +GeometricElementList::GeometricElementList(int count) { setSize(count); } -void GeometricElementList::setSize(const int& nb) +void GeometricElementList::setSize(int nb) { m_count = nb; m_elements.clear(); @@ -65,8 +65,7 @@ void GeometricElementList::setSize(const int& nb) } } -void GeometricElementList::checkElementIndex(const int& index) const -throw (XAO_Exception) +void GeometricElementList::checkElementIndex(int index) const { if (m_count >= 0 && index < m_count) return; @@ -75,51 +74,44 @@ throw (XAO_Exception) << m_count-1 << "]: " << index); } -void GeometricElementList::setElement(const int& index, const std::string& name, const std::string& reference) -throw (XAO_Exception) +void GeometricElementList::setElement(int index, const std::string& name, const std::string& reference) { checkElementIndex(index); m_elements[index].setName(name); m_elements[index].setReference(reference); } -const std::string GeometricElementList::getName(const int& index) -throw (XAO_Exception) +const std::string GeometricElementList::getName(int index) { checkElementIndex(index); return m_elements[index].getName(); } -void GeometricElementList::setName(const int& index, const std::string& name) -throw (XAO_Exception) +void GeometricElementList::setName(int index, const std::string& name) { checkElementIndex(index); m_elements[index].setName(name); } -const bool GeometricElementList::hasName(const int& index) -throw (XAO_Exception) +bool GeometricElementList::hasName(int index) { checkElementIndex(index); return m_elements[index].hasName(); } -const std::string GeometricElementList::getReference(const int& index) -throw (XAO_Exception) +const std::string GeometricElementList::getReference(int index) { checkElementIndex(index); return m_elements[index].getReference(); } -void GeometricElementList::setReference(const int& index, const std::string& name) -throw (XAO_Exception) +void GeometricElementList::setReference(int index, const std::string& name) { checkElementIndex(index); m_elements[index].setReference(name); } -const int GeometricElementList::getIndexByReference(const std::string& ref) -throw (XAO_Exception) +int GeometricElementList::getIndexByReference(const std::string& ref) { for (int index = 0; index < m_count; ++index) { diff --git a/src/XAO/XAO_GeometricElement.hxx b/src/XAO/XAO_GeometricElement.hxx index 234f63bf7..c10b8a6e9 100644 --- a/src/XAO/XAO_GeometricElement.hxx +++ b/src/XAO/XAO_GeometricElement.hxx @@ -78,7 +78,7 @@ namespace XAO * Checks if the element has a name. * @return true if the element has a name, false otherwise. */ - const bool hasName(); + bool hasName(); /** * Gets the reference of the element. @@ -120,7 +120,7 @@ namespace XAO * Constructor with size. * \param nb the size to set. */ - GeometricElementList(const int& nb); + GeometricElementList(int nb); /** * Destructor. @@ -131,14 +131,14 @@ namespace XAO * Gets the size of the list. * \return the size of the list. */ - const int getSize() const { return m_count; } + int getSize() const { return m_count; } /** * Sets the size of the list. * \param nb the size to set. * \warning the list will be cleared. */ - void setSize(const int& nb); + void setSize(int nb); /** * Sets the name and the reference of an element. @@ -147,28 +147,28 @@ namespace XAO * \param reference the reference to set. * \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) throw (XAO_Exception); + void setElement(int index, const std::string& name, const std::string& reference); /** * Gets the name of an element. * \param index the index of the element to set. * \return the name of the element with the given index. * \throw XAO_Exception if index is bigger than the size of the list. */ - const std::string getName(const int& index) throw (XAO_Exception); + const std::string getName(int index); /** * Sets the name of an element. * \param index the index of the element. * \param name the name to set. * \throw XAO_Exception if index is bigger than the size of the list. */ - void setName(const int& index, const std::string& name) throw (XAO_Exception); + void setName(int index, const std::string& name); /** * Checks if an element has a name. * @param index the index of the element. * @return true if the element has a name, false otherwise. */ - const bool hasName(const int& index) throw (XAO_Exception); + bool hasName(int index); /** * Gets the reference of an element. @@ -176,21 +176,21 @@ namespace XAO * \return the reference of the element. * \throw XAO_Exception if index is bigger than the size of the list. */ - const std::string getReference(const int& index) throw (XAO_Exception); + const std::string getReference(int index); /** * Sets the reference of an element. * \param index the index of the element to set. * \param reference the reference to set. * \throw XAO_Exception if index is bigger than the size of the list. */ - void setReference(const int& index, const std::string& reference) throw (XAO_Exception); + void setReference(int index, const std::string& reference); /** * Gets the index of an element using its reference. * \param reference the searched reference. * \return the index of the element or -1 if no element found. */ - const int getIndexByReference(const std::string& reference) throw (XAO_Exception); + int getIndexByReference(const std::string& reference); /** * Iterator on the element of the list. @@ -210,7 +210,7 @@ namespace XAO iterator end() { return m_elements.end(); } private: - void checkElementIndex(const int& index) const throw (XAO_Exception); + void checkElementIndex(int index) const; private: int m_count; diff --git a/src/XAO/XAO_Geometry.cxx b/src/XAO/XAO_Geometry.cxx index 22031582e..fe72864d5 100644 --- a/src/XAO/XAO_Geometry.cxx +++ b/src/XAO/XAO_Geometry.cxx @@ -30,14 +30,12 @@ Geometry::Geometry(const std::string& name) m_readOnly = false; } -Geometry* Geometry::createGeometry(const XAO::Format& format) -throw (XAO_Exception) +Geometry* Geometry::createGeometry(XAO::Format format) { return createGeometry(format, ""); } -Geometry* Geometry::createGeometry(const XAO::Format& format, const std::string& name) -throw (XAO_Exception) +Geometry* Geometry::createGeometry(XAO::Format format, const std::string& name) { if (format == XAO::BREP) return new BrepGeometry(name); @@ -50,14 +48,12 @@ Geometry::~Geometry() } void Geometry::checkReadOnly() -throw (XAO_Exception) { if (m_readOnly) throw XAO_Exception("Geometry is read only."); } -const int Geometry::countElements(const XAO::Dimension& dim) const -throw (XAO_Exception) +int Geometry::countElements(XAO::Dimension dim) const { if (dim == XAO::VERTEX) return countVertices(); @@ -73,8 +69,7 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -const std::string Geometry::getElementReference(const XAO::Dimension& dim, const int& index) -throw (XAO_Exception) +const std::string Geometry::getElementReference(XAO::Dimension dim, int index) { if (dim == XAO::VERTEX) return getVertexReference(index); @@ -88,8 +83,7 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -const int Geometry::getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference) -throw (XAO_Exception) +int Geometry::getElementIndexByReference(XAO::Dimension dim, const std::string& reference) { if (dim == XAO::VERTEX) return getVertexIndexByReference(reference); @@ -103,8 +97,7 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -GeometricElementList::iterator Geometry::begin(const XAO::Dimension& dim) -throw (XAO_Exception) +GeometricElementList::iterator Geometry::begin(XAO::Dimension dim) { if (dim == XAO::VERTEX) return m_vertices.begin(); @@ -118,8 +111,7 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -GeometricElementList::iterator Geometry::end(const XAO::Dimension& dim) -throw (XAO_Exception) +GeometricElementList::iterator Geometry::end(XAO::Dimension dim) { if (dim == XAO::VERTEX) return m_vertices.end(); @@ -133,64 +125,64 @@ throw (XAO_Exception) throw XAO_Exception(MsgBuilder() << "Unknown dimension:" << dim); } -void Geometry::setCountVertices(const int& nb) throw (XAO_Exception) +void Geometry::setCountVertices(int nb) { checkReadOnly(); m_vertices.setSize(nb); } -void Geometry::setCountEdges(const int& nb) throw (XAO_Exception) +void Geometry::setCountEdges(int nb) { checkReadOnly(); m_edges.setSize(nb); } -void Geometry::setCountFaces(const int& nb) throw (XAO_Exception) +void Geometry::setCountFaces(int nb) { checkReadOnly(); m_faces.setSize(nb); } -void Geometry::setCountSolids(const int& nb) throw (XAO_Exception) +void Geometry::setCountSolids(int nb) { checkReadOnly(); m_solids.setSize(nb); } -void Geometry::setVertexReference(const int& index, const std::string& reference) throw (XAO_Exception) +void Geometry::setVertexReference(int index, const std::string& reference) { checkReadOnly(); m_vertices.setReference(index, reference); } -void Geometry::setEdgeReference(const int& index, const std::string& reference) throw (XAO_Exception) +void Geometry::setEdgeReference(int index, const std::string& reference) { checkReadOnly(); m_edges.setReference(index, reference); } -void Geometry::setFaceReference(const int& index, const std::string& reference) throw (XAO_Exception) +void Geometry::setFaceReference(int index, const std::string& reference) { checkReadOnly(); m_faces.setReference(index, reference); } -void Geometry::setSolidReference(const int& index, const std::string& reference) throw (XAO_Exception) +void Geometry::setSolidReference(int index, const std::string& reference) { checkReadOnly(); m_solids.setReference(index, reference); } -void Geometry::setVertex(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception) +void Geometry::setVertex(int index, const std::string& name, const std::string& reference) { checkReadOnly(); m_vertices.setElement(index, name, reference); } -void Geometry::setEdge(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception) +void Geometry::setEdge(int index, const std::string& name, const std::string& reference) { checkReadOnly(); m_edges.setElement(index, name, reference); } -void Geometry::setFace(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception) +void Geometry::setFace(int index, const std::string& name, const std::string& reference) { checkReadOnly(); m_faces.setElement(index, name, reference); } -void Geometry::setSolid(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception) +void Geometry::setSolid(int index, const std::string& name, const std::string& reference) { checkReadOnly(); m_solids.setElement(index, name, reference); diff --git a/src/XAO/XAO_Geometry.hxx b/src/XAO/XAO_Geometry.hxx index e7a42a482..1216c2862 100644 --- a/src/XAO/XAO_Geometry.hxx +++ b/src/XAO/XAO_Geometry.hxx @@ -55,7 +55,7 @@ namespace XAO * @param format the format of the geometry. * @return the created geometry. */ - static Geometry* createGeometry(const XAO::Format& format) throw (XAO_Exception); + static Geometry* createGeometry(XAO::Format format) ; /** * Constructor. @@ -63,8 +63,7 @@ namespace XAO * @name name the name of the geometry. * @return the created geometry. */ - static Geometry* createGeometry(const XAO::Format& format, const std::string& name) - throw (XAO_Exception); + static Geometry* createGeometry(XAO::Format format, const std::string& name); /** Destructor. */ virtual ~Geometry(); @@ -90,63 +89,63 @@ namespace XAO * Gets the format of the geometry. * @return the format of the geometry. */ - virtual const XAO::Format getFormat() = 0; + virtual XAO::Format getFormat() = 0; virtual const std::string getShapeString() = 0; virtual void setShapeString(const std::string& shape) = 0; virtual void writeShapeFile(const std::string& fileName) = 0; virtual void readShapeFile(const std::string& fileName) = 0; - const int countElements(const XAO::Dimension& dim) const throw (XAO_Exception); - const int countVertices() const { return m_vertices.getSize(); } - const int countEdges() const { return m_edges.getSize(); } - const int countFaces() const { return m_faces.getSize(); } - const int countSolids() const { return m_solids.getSize(); } - - void setCountVertices(const int& nb) throw (XAO_Exception); - void setCountEdges(const int& nb) throw (XAO_Exception); - void setCountFaces(const int& nb) throw (XAO_Exception); - void setCountSolids(const int& nb) throw (XAO_Exception); - - const std::string getVertexName(const int& index) throw (XAO_Exception) { return m_vertices.getName(index); } - const std::string getEdgeName(const int& index) throw (XAO_Exception) { return m_edges.getName(index); } - const std::string getFaceName(const int& index) throw (XAO_Exception) { return m_faces.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) throw (XAO_Exception) { m_vertices.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) throw (XAO_Exception) { m_faces.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) throw (XAO_Exception) { return m_vertices.hasName(index); } - const bool hasEdgeName(const int& index) throw (XAO_Exception) { return m_edges.hasName(index); } - const bool hasFaceName(const int& index) throw (XAO_Exception) { return m_faces.hasName(index); } - const bool hasSolidName(const int& index) throw (XAO_Exception) { return m_solids.hasName(index); } - - const std::string getVertexReference(const int& index) throw (XAO_Exception) { return m_vertices.getReference(index); } - const std::string getEdgeReference(const int& index) throw (XAO_Exception) { return m_edges.getReference(index); } - const std::string getFaceReference(const int& index) throw (XAO_Exception) { return m_faces.getReference(index); } - const std::string getSolidReference(const int& index) throw (XAO_Exception) { return m_solids.getReference(index); } - const std::string getElementReference(const XAO::Dimension& dim, const int& index) throw (XAO_Exception); - - void setVertexReference(const int& index, const std::string& reference) throw (XAO_Exception); - void setEdgeReference(const int& index, const std::string& reference) throw (XAO_Exception); - void setFaceReference(const int& index, const std::string& reference) throw (XAO_Exception); - void setSolidReference(const int& index, const std::string& reference) throw (XAO_Exception); - - void setVertex(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception); - void setEdge(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception); - void setFace(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception); - void setSolid(const int& index, const std::string& name, const std::string& reference) throw (XAO_Exception); - - const int getVertexIndexByReference(const std::string& reference) { return m_vertices.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 getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); } - const int getElementIndexByReference(const XAO::Dimension& dim, const std::string& reference) throw (XAO_Exception); - - GeometricElementList::iterator begin(const XAO::Dimension& dim) throw (XAO_Exception); - GeometricElementList::iterator end(const XAO::Dimension& dim) throw (XAO_Exception); + int countElements(XAO::Dimension dim) const ; + int countVertices() const { return m_vertices.getSize(); } + int countEdges() const { return m_edges.getSize(); } + int countFaces() const { return m_faces.getSize(); } + int countSolids() const { return m_solids.getSize(); } + + void setCountVertices(int nb); + void setCountEdges(int nb); + void setCountFaces(int nb); + void setCountSolids(int nb); + + const std::string getVertexName(int index) { return m_vertices.getName(index); } + const std::string getEdgeName(int index) { return m_edges.getName(index); } + const std::string getFaceName(int index) { return m_faces.getName(index); } + const std::string getSolidName(int index) { return m_solids.getName(index); } + + void setVertexName(int index, const std::string& name) { m_vertices.setName(index, name); } + void setEdgeName(int index, const std::string& name) { m_edges.setName(index, name); } + void setFaceName(int index, const std::string& name) { m_faces.setName(index, name); } + void setSolidName(int index, const std::string& name) { m_solids.setName(index, name); } + + bool hasVertexName(int index) { return m_vertices.hasName(index); } + bool hasEdgeName(int index) { return m_edges.hasName(index); } + bool hasFaceName(int index) { return m_faces.hasName(index); } + bool hasSolidName(int index) { return m_solids.hasName(index); } + + const std::string getVertexReference(int index) { return m_vertices.getReference(index); } + const std::string getEdgeReference(int index) { return m_edges.getReference(index); } + const std::string getFaceReference(int index) { return m_faces.getReference(index); } + const std::string getSolidReference(int index) { return m_solids.getReference(index); } + const std::string getElementReference(XAO::Dimension dim, int index) ; + + void setVertexReference(int index, const std::string& reference) ; + void setEdgeReference(int index, const std::string& reference) ; + void setFaceReference(int index, const std::string& reference) ; + void setSolidReference(int index, const std::string& reference) ; + + void setVertex(int index, const std::string& name, const std::string& reference) ; + void setEdge(int index, const std::string& name, const std::string& reference) ; + void setFace(int index, const std::string& name, const std::string& reference) ; + void setSolid(int index, const std::string& name, const std::string& reference) ; + + int getVertexIndexByReference(const std::string& reference) { return m_vertices.getIndexByReference(reference); } + int getEdgeIndexByReference(const std::string& reference) { return m_edges.getIndexByReference(reference); } + int getFaceIndexByReference(const std::string& reference) { return m_faces.getIndexByReference(reference); } + int getSolidIndexByReference(const std::string& reference) { return m_solids.getIndexByReference(reference); } + int getElementIndexByReference(XAO::Dimension dim, const std::string& reference) ; + + GeometricElementList::iterator begin(XAO::Dimension dim) ; + GeometricElementList::iterator end(XAO::Dimension dim) ; /** * Verifies if the geometry is read only. @@ -160,7 +159,7 @@ namespace XAO void setReadOnly() { m_readOnly = true; } protected: - void checkReadOnly() throw (XAO_Exception); + void checkReadOnly() ; protected: std::string m_name; diff --git a/src/XAO/XAO_Group.cxx b/src/XAO/XAO_Group.cxx index fe66b47cb..83af8e416 100644 --- a/src/XAO/XAO_Group.cxx +++ b/src/XAO/XAO_Group.cxx @@ -24,8 +24,7 @@ using namespace XAO; -Group::Group(const XAO::Dimension& dim, const int& nbElements, const std::string& name) -throw (XAO_Exception) +Group::Group(XAO::Dimension dim, int nbElements, const std::string& name) { if (dim == XAO::WHOLE) throw XAO_Exception("Dimension WHOLE is not valid for group."); @@ -40,8 +39,7 @@ Group::~Group() { } -void Group::checkIndex(const int& element) -throw (XAO_Exception) +void Group::checkIndex(int element) { if (element < (int)m_elements.size() && element >= 0) return; @@ -50,12 +48,12 @@ throw (XAO_Exception) << m_elements.size()-1 << "]: " << element); } -void Group::add(const int& value) +void Group::add(int value) { m_elements.insert(value); } -void Group::remove(const int& value) +void Group::remove(int value) { m_elements.erase(value); } diff --git a/src/XAO/XAO_Group.hxx b/src/XAO/XAO_Group.hxx index c0279d2d6..61170ef6e 100644 --- a/src/XAO/XAO_Group.hxx +++ b/src/XAO/XAO_Group.hxx @@ -44,8 +44,7 @@ namespace XAO * @param nbElements the number of geometrical elements for the dimension in the geometry. * @param name the name of the group. */ - Group(const XAO::Dimension& dim, const int& nbElements, const std::string& name = std::string("")) - throw (XAO_Exception); + Group(XAO::Dimension dim, int nbElements, const std::string& name = std::string("")); /** * Destructor. @@ -73,7 +72,7 @@ namespace XAO * Gets the dimension of the group. * \return the dimension of the group. */ - const XAO::Dimension getDimension() + XAO::Dimension getDimension() { return m_dimension; } @@ -82,7 +81,7 @@ namespace XAO * Gets the numbers of elements in the geometry of the same type than the group. * \return the number of elements in the associated geometry. */ - const int getNbElements() + int getNbElements() { return m_nbElements; } @@ -91,9 +90,9 @@ namespace XAO * Gets the number of elements in the group. * \return the number of elements. */ - const int count() const + int count() const { - return (int)m_elements.size(); + return m_elements.size(); } /** @@ -102,7 +101,7 @@ namespace XAO * \return the reference of the element. * \note use begin() and end() if you need to iterate. */ - const int get(const int& index) + int get(int index) { checkIndex(index); std::set::iterator it = m_elements.begin(); @@ -114,13 +113,13 @@ namespace XAO * Adds an element to the group. * \param value the index of the element to add. */ - void add(const int& value); + void add(int value); /** * Removes an element from the group. * \param value the index of the element to remove. */ - void remove(const int& value); + void remove(int value); /** * Gets an iterator on the first element in the group. @@ -140,8 +139,7 @@ namespace XAO * @param element * @throw XAO_Exception if element is bigger than the number of elements. */ - void checkIndex(const int& element) - throw (XAO_Exception); + void checkIndex(int element); private: /** The name of the group. */ diff --git a/src/XAO/XAO_IntegerField.cxx b/src/XAO/XAO_IntegerField.cxx index 1e1bcdd65..16736a7d8 100644 --- a/src/XAO/XAO_IntegerField.cxx +++ b/src/XAO/XAO_IntegerField.cxx @@ -24,25 +24,25 @@ using namespace XAO; -IntegerField::IntegerField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name) +IntegerField::IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) : Field(dimension, nbElements, nbComponents, name) { } -Step* IntegerField::addNewStep(const int& step) -throw (XAO_Exception) +Step* IntegerField::addNewStep(int step) + { return addStep(step, 0); } -IntegerStep* IntegerField::addStep(const int& step) -throw (XAO_Exception) +IntegerStep* IntegerField::addStep(int step) + { return addStep(step, 0); } -IntegerStep* IntegerField::addStep(const int& step, const int& stamp) -throw (XAO_Exception) +IntegerStep* IntegerField::addStep(int step, int stamp) + { if (hasStep(step)) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); @@ -52,8 +52,8 @@ throw (XAO_Exception) return bstep; } -IntegerStep* IntegerField::getStep(const int& index) -throw (XAO_Exception) +IntegerStep* IntegerField::getStep(int index) + { checkStepIndex(index); return (IntegerStep*)m_steps[index]; diff --git a/src/XAO/XAO_IntegerField.hxx b/src/XAO/XAO_IntegerField.hxx index 2d9cac221..a761684de 100644 --- a/src/XAO/XAO_IntegerField.hxx +++ b/src/XAO/XAO_IntegerField.hxx @@ -49,18 +49,18 @@ namespace XAO * @param nbComponents the number of components. * @param name the name of the field. */ - IntegerField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name); + IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - virtual const XAO::Type getType() { return XAO::INTEGER; } + virtual XAO::Type getType() { return XAO::INTEGER; } - virtual Step* addNewStep(const int& step) throw (XAO_Exception); + virtual Step* addNewStep(int step) ; /** * Adds a new step. * @param step the number of the step. * @return the newly created step. */ - IntegerStep* addStep(const int& step) throw (XAO_Exception); + IntegerStep* addStep(int step) ; /** * Adds a new step. @@ -68,14 +68,14 @@ namespace XAO * @param stamp the stamp of the step. * @return the newly created step. */ - IntegerStep* addStep(const int& step, const int& stamp) throw (XAO_Exception); + IntegerStep* addStep(int step, int stamp) ; /** * Gets the step of given index. * @param index the index of the step. * @return the step for the given index. */ - IntegerStep* getStep(const int& index) throw (XAO_Exception); + IntegerStep* getStep(int index) ; }; } diff --git a/src/XAO/XAO_IntegerStep.cxx b/src/XAO/XAO_IntegerStep.cxx index 67a377034..afe690d12 100644 --- a/src/XAO/XAO_IntegerStep.cxx +++ b/src/XAO/XAO_IntegerStep.cxx @@ -23,7 +23,7 @@ using namespace XAO; -IntegerStep::IntegerStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents) +IntegerStep::IntegerStep(int step, int stamp, int nbElements, int nbComponents) { m_nbElements = nbElements; m_nbComponents = nbComponents; @@ -56,8 +56,8 @@ std::vector IntegerStep::getValues() return result; } -std::vector IntegerStep::getElement(const int& element) -throw (XAO_Exception) +std::vector IntegerStep::getElement(int element) + { checkElementIndex(element); @@ -65,8 +65,8 @@ throw (XAO_Exception) return result; } -std::vector IntegerStep::getComponent(const int& component) -throw (XAO_Exception) +std::vector IntegerStep::getComponent(int component) + { checkComponentIndex(component); @@ -83,8 +83,8 @@ throw (XAO_Exception) return result; } -const int IntegerStep::getValue(const int& element, const int& component) -throw (XAO_Exception) +int IntegerStep::getValue(int element, int component) + { checkElementIndex(element); checkComponentIndex(component); @@ -92,16 +92,16 @@ throw (XAO_Exception) return m_values[element][component]; } -const std::string IntegerStep::getStringValue(const int& element, const int& component) -throw (XAO_Exception) +const std::string IntegerStep::getStringValue(int element, int component) + { return XaoUtils::intToString(getValue(element, component)); } void IntegerStep::setValues(const std::vector& values) -throw (XAO_Exception) + { - checkNbValues((int)values.size()); + checkNbValues(values.size()); for (int i = 0; i < m_nbElements; ++i) { @@ -112,28 +112,28 @@ throw (XAO_Exception) } } -void IntegerStep::setElement(const int& element, const std::vector& elements) -throw (XAO_Exception) +void IntegerStep::setElement(int element, const std::vector& elements) + { checkElementIndex(element); - checkNbComponents((int)elements.size()); + checkNbComponents(elements.size()); for (int i = 0; i < m_nbComponents; ++i) m_values[element][i] = elements[i]; } -void IntegerStep::setComponent(const int& component, const std::vector& components) -throw (XAO_Exception) +void IntegerStep::setComponent(int component, const std::vector& components) + { checkElementIndex(component); - checkNbElements((int)components.size()); + checkNbElements(components.size()); for (int i = 0; i < m_nbElements; ++i) m_values[i][component] = components[i]; } -void IntegerStep::setValue(const int& element, const int& component, const int& value) -throw (XAO_Exception) +void IntegerStep::setValue(int element, int component, int value) + { checkElementIndex(element); checkComponentIndex(component); @@ -141,8 +141,8 @@ throw (XAO_Exception) m_values[element][component] = value; } -void IntegerStep::setStringValue(const int& element, const int& component, const std::string& value) -throw (XAO_Exception) +void IntegerStep::setStringValue(int element, int component, const std::string& value) + { setValue(element, component, XaoUtils::stringToInt(value)); } diff --git a/src/XAO/XAO_IntegerStep.hxx b/src/XAO/XAO_IntegerStep.hxx index 26b02f283..8757d648a 100644 --- a/src/XAO/XAO_IntegerStep.hxx +++ b/src/XAO/XAO_IntegerStep.hxx @@ -49,9 +49,9 @@ namespace XAO * @param nbElements the number elements of the geometry. * @param nbComponents the number of components of the field. */ - IntegerStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents); + IntegerStep(int step, int stamp, int nbElements, int nbComponents); - virtual const XAO::Type getType() { return XAO::INTEGER; } + virtual XAO::Type getType() { return XAO::INTEGER; } /** * Gets all the values of the step as a list. @@ -64,14 +64,14 @@ namespace XAO * @param element the index of the element. * @return a vector containing all the values for the given element. */ - std::vector getElement(const int& element) throw (XAO_Exception); + std::vector getElement(int element) ; /** * Gets all the values for a given component. * @param component the index of the component. * @return a vector containing all the values for the given component. */ - std::vector getComponent(const int& component) throw (XAO_Exception); + std::vector getComponent(int component) ; /** * Gets the value for an element and a component. @@ -79,27 +79,27 @@ namespace XAO * @param component the index of the component. * @return the value for the given element and component. */ - const int getValue(const int& element, const int& component) throw (XAO_Exception); + int getValue(int element, int component) ; /** * Sets all the values from a list. * @param values the list of values to set. */ - void setValues(const std::vector& values) throw (XAO_Exception); + void setValues(const std::vector& values) ; /** * Sets the values for an element. * @param element the index of the element to set. * @param elements the values to set. */ - void setElement(const int& element, const std::vector& elements) throw (XAO_Exception); + void setElement(int element, const std::vector& elements) ; /** * Sets the values for a component. * @param component the index of the component to set. * @param components the values to set. */ - void setComponent(const int& component, const std::vector& components) throw (XAO_Exception); + void setComponent(int component, const std::vector& components) ; /** * Sets the value for an element and a component. @@ -107,10 +107,10 @@ namespace XAO * @param component the index of the component. * @param value the value. */ - void setValue(const int& element, const int& component, const int& value) throw (XAO_Exception); + void setValue(int element, int component, int value) ; - 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) throw (XAO_Exception); + virtual const std::string getStringValue(int element, int component) ; + virtual void setStringValue(int element, int component, const std::string& value) ; private: std::vector< std::vector > m_values; diff --git a/src/XAO/XAO_Step.cxx b/src/XAO/XAO_Step.cxx index c2353170f..2285c1459 100644 --- a/src/XAO/XAO_Step.cxx +++ b/src/XAO/XAO_Step.cxx @@ -28,8 +28,7 @@ using namespace XAO; -void Step::checkElementIndex(const int& element) -throw (XAO_Exception) +void Step::checkElementIndex(int element) { if (element < m_nbElements && element >= 0) return; @@ -38,8 +37,7 @@ throw (XAO_Exception) << m_nbElements-1 << "]: " << element); } -void Step::checkComponentIndex(const int& component) -throw (XAO_Exception) +void Step::checkComponentIndex(int component) { if (component < m_nbComponents && component >= 0) return; @@ -48,8 +46,7 @@ throw (XAO_Exception) << m_nbComponents-1 << "]: " << component); } -void Step::checkNbElements(const int& nbElements) -throw (XAO_Exception) +void Step::checkNbElements(int nbElements) { if (nbElements == m_nbElements) return; @@ -58,8 +55,7 @@ throw (XAO_Exception) << ", expected " << m_nbElements); } -void Step::checkNbComponents(const int& nbComponents) -throw (XAO_Exception) +void Step::checkNbComponents(int nbComponents) { if (nbComponents == m_nbComponents) return; @@ -68,8 +64,7 @@ throw (XAO_Exception) << ", expected " << m_nbComponents); } -void Step::checkNbValues(const int& nbValues) -throw (XAO_Exception) +void Step::checkNbValues(int nbValues) { if (nbValues == m_nbElements * m_nbComponents) return; diff --git a/src/XAO/XAO_Step.hxx b/src/XAO/XAO_Step.hxx index 071722370..8226171e6 100644 --- a/src/XAO/XAO_Step.hxx +++ b/src/XAO/XAO_Step.hxx @@ -51,49 +51,49 @@ namespace XAO * Gets the type of the step. * @return */ - virtual const XAO::Type getType() = 0; + virtual XAO::Type getType() = 0; /** * Gets the step index. * @return the index of the step. */ - const int getStep() { return m_step; } + int getStep() { return m_step; } /** * Sets the number of the step. * @param step the index to set. */ - void setStep(const int& step) { m_step = step; } + void setStep(int step) { m_step = step; } /** * Gets the stamp of the index. * @return the stamp of the index. */ - const int getStamp() { return m_stamp; } + int getStamp() { return m_stamp; } /** * Sets the stamp of the index. * @param stamp the stamp to set. */ - void setStamp(const int& stamp) { m_stamp = stamp; } + void setStamp(int stamp) { m_stamp = stamp; } /** * Gets the number of components of the step. * @return the number of components. */ - const int countComponents() { return m_nbComponents; } + int countComponents() { return m_nbComponents; } /** * Gets the number of elements for the step. * @return the number of elements. */ - const int countElements() { return m_nbElements; } + int countElements() { return m_nbElements; } /** * Gets the number of values for the step. * @return the number of values. */ - const int countValues() { return m_nbElements * m_nbComponents; } + int countValues() { return m_nbElements * m_nbComponents; } /** * Gets a value as a string. @@ -101,7 +101,7 @@ namespace XAO * @param component the index of the component. * @return the value as a string. */ - virtual const std::string getStringValue(const int& element, const int& component) = 0; + virtual const std::string getStringValue(int element, int component) = 0; /** * Sets a value as a string @@ -110,37 +110,37 @@ namespace XAO * @param value the string value. * @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(int element, int component, const std::string& value) = 0; protected: /** * Checks that given element index is in the range of element indexes. * @param element the index to check. */ - void checkElementIndex(const int& element) throw (XAO_Exception); + void checkElementIndex(int element); /** * Checks that given component index is in the range of component indexes. * @param component the index to check. */ - void checkComponentIndex(const int& component)throw (XAO_Exception); + void checkComponentIndex(int component); /** * Checks that the given number of elements is correct. * @param nbElements the number of elements to check. */ - void checkNbElements(const int& nbElements)throw (XAO_Exception); + void checkNbElements(int nbElements); /** * Checks that the given number of components is correct. * @param nbComponents the number of components to check. */ - void checkNbComponents(const int& nbComponents)throw (XAO_Exception); + void checkNbComponents(int nbComponents); /** * checks that the given number of values is correct. * @param nbValues the number of values to check. */ - void checkNbValues(const int& nbValues)throw (XAO_Exception); + void checkNbValues(int nbValues); protected: /** the index of the step. */ diff --git a/src/XAO/XAO_StringField.cxx b/src/XAO/XAO_StringField.cxx index 81b7a8bea..11a1b49bb 100644 --- a/src/XAO/XAO_StringField.cxx +++ b/src/XAO/XAO_StringField.cxx @@ -24,25 +24,25 @@ using namespace XAO; -StringField::StringField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name) +StringField::StringField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name) : Field(dimension, nbElements, nbComponents, name) { } -Step* StringField::addNewStep(const int& step) -throw (XAO_Exception) +Step* StringField::addNewStep(int step) + { return addStep(step, 0); } -StringStep* StringField::addStep(const int& step) -throw (XAO_Exception) +StringStep* StringField::addStep(int step) + { return addStep(step, 0); } -StringStep* StringField::addStep(const int& step, const int& stamp) -throw (XAO_Exception) +StringStep* StringField::addStep(int step, int stamp) + { if (hasStep(step)) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); @@ -52,8 +52,8 @@ throw (XAO_Exception) return bstep; } -StringStep* StringField::getStep(const int& index) -throw (XAO_Exception) +StringStep* StringField::getStep(int index) + { checkStepIndex(index); return (StringStep*)m_steps[index]; diff --git a/src/XAO/XAO_StringField.hxx b/src/XAO/XAO_StringField.hxx index 56c3eebf7..c5b5b9fe9 100644 --- a/src/XAO/XAO_StringField.hxx +++ b/src/XAO/XAO_StringField.hxx @@ -48,18 +48,18 @@ namespace XAO * @param nbComponents the number of components. * @param name the name of the field. */ - StringField(const XAO::Dimension& dimension, const int& nbElements, const int& nbComponents, const std::string& name); + StringField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string& name); - virtual const XAO::Type getType() { return XAO::STRING; } + virtual XAO::Type getType() { return XAO::STRING; } - virtual Step* addNewStep(const int& step) throw (XAO_Exception); + virtual Step* addNewStep(int step) ; /** * Adds a new step. * @param step the number of the step. * @return the newly created step. */ - StringStep* addStep(const int& step) throw (XAO_Exception); + StringStep* addStep(int step) ; /** * Adds a new step. @@ -67,14 +67,14 @@ namespace XAO * @param stamp the stamp of the step. * @return the newly created step. */ - StringStep* addStep(const int& step, const int& stamp) throw (XAO_Exception); + StringStep* addStep(int step, int stamp) ; /** * Gets the step of given index. * @param index the index of the step. * @return the step for the given index. */ - StringStep* getStep(const int& index) throw (XAO_Exception); + StringStep* getStep(int index) ; }; } diff --git a/src/XAO/XAO_StringStep.cxx b/src/XAO/XAO_StringStep.cxx index e1a5915ce..233200826 100644 --- a/src/XAO/XAO_StringStep.cxx +++ b/src/XAO/XAO_StringStep.cxx @@ -22,7 +22,7 @@ using namespace XAO; -StringStep::StringStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents) +StringStep::StringStep(int step, int stamp, int nbElements, int nbComponents) { m_nbElements = nbElements; m_nbComponents = nbComponents; @@ -55,8 +55,8 @@ std::vector StringStep::getValues() return result; } -std::vector StringStep::getElement(const int& element) -throw (XAO_Exception) +std::vector StringStep::getElement(int element) + { checkElementIndex(element); @@ -64,8 +64,8 @@ throw (XAO_Exception) return result; } -std::vector StringStep::getComponent(const int& component) -throw (XAO_Exception) +std::vector StringStep::getComponent(int component) + { checkComponentIndex(component); @@ -82,8 +82,8 @@ throw (XAO_Exception) return result; } -const std::string StringStep::getValue(const int& element, const int& component) -throw (XAO_Exception) +const std::string StringStep::getValue(int element, int component) + { checkElementIndex(element); checkComponentIndex(component); @@ -91,16 +91,16 @@ throw (XAO_Exception) return m_values[element][component]; } -const std::string StringStep::getStringValue(const int& element, const int& component) -throw (XAO_Exception) +const std::string StringStep::getStringValue(int element, int component) + { return getValue(element, component); } void StringStep::setValues(const std::vector& values) -throw (XAO_Exception) + { - checkNbValues((int)values.size()); + checkNbValues(values.size()); for (int i = 0; i < m_nbElements; ++i) { @@ -111,28 +111,28 @@ throw (XAO_Exception) } } -void StringStep::setElement(const int& element, const std::vector& elements) -throw (XAO_Exception) +void StringStep::setElement(int element, const std::vector& elements) + { checkElementIndex(element); - checkNbComponents((int)elements.size()); + checkNbComponents(elements.size()); for (int i = 0; i < m_nbComponents; ++i) m_values[element][i] = elements[i]; } -void StringStep::setComponent(const int& component, const std::vector& components) -throw (XAO_Exception) +void StringStep::setComponent(int component, const std::vector& components) + { checkElementIndex(component); - checkNbElements((int)components.size()); + checkNbElements(components.size()); for (int i = 0; i < m_nbElements; ++i) m_values[i][component] = components[i]; } -void StringStep::setValue(const int& element, const int& component, const std::string& value) -throw (XAO_Exception) +void StringStep::setValue(int element, int component, const std::string& value) + { checkElementIndex(element); checkComponentIndex(component); @@ -140,8 +140,8 @@ throw (XAO_Exception) m_values[element][component] = value; } -void StringStep::setStringValue(const int& element, const int& component, const std::string& value) -throw (XAO_Exception) +void StringStep::setStringValue(int element, int component, const std::string& value) + { setValue(element, component, value); } diff --git a/src/XAO/XAO_StringStep.hxx b/src/XAO/XAO_StringStep.hxx index 8f73b3a02..e5d10034d 100644 --- a/src/XAO/XAO_StringStep.hxx +++ b/src/XAO/XAO_StringStep.hxx @@ -49,9 +49,9 @@ namespace XAO * @param nbElements the number elements of the geometry. * @param nbComponents the number of components of the field. */ - StringStep(const int& step, const int& stamp, const int& nbElements, const int& nbComponents); + StringStep(int step, int stamp, int nbElements, int nbComponents); - virtual const XAO::Type getType() { return XAO::STRING; } + virtual XAO::Type getType() { return XAO::STRING; } /** * Gets all the values of the step as a list. @@ -64,14 +64,14 @@ namespace XAO * @param element the index of the element. * @return a vector containing all the values for the given element. */ - std::vector getElement(const int& element) throw (XAO_Exception); + std::vector getElement(int element) ; /** * Gets all the values for a given component. * @param component the index of the component. * @return a vector containing all the values for the given component. */ - std::vector getComponent(const int& component) throw (XAO_Exception); + std::vector getComponent(int component) ; /** * Gets the value for an element and a component. @@ -79,27 +79,27 @@ namespace XAO * @param component the index of the component. * @return the value for the given element and component. */ - const std::string getValue(const int& element, const int& component) throw (XAO_Exception); + const std::string getValue(int element, int component) ; /** * Sets all the values from a list. * @param values the list of values to set. */ - void setValues(const std::vector& values) throw (XAO_Exception); + void setValues(const std::vector& values) ; /** * Sets the values for an element. * @param element the index of the element to set. * @param elements the values to set. */ - void setElement(const int& element, const std::vector& elements) throw (XAO_Exception); + void setElement(int element, const std::vector& elements) ; /** * Sets the values for a component. * @param component the index of the component to set. * @param components the values to set. */ - void setComponent(const int& component, const std::vector& components) throw (XAO_Exception); + void setComponent(int component, const std::vector& components) ; /** * Sets the value for an element and a component. @@ -107,10 +107,10 @@ namespace XAO * @param component the index of the component. * @param value the value. */ - void setValue(const int& element, const int& component, const std::string& value) throw (XAO_Exception); + void setValue(int element, int component, const std::string& value) ; - 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) throw (XAO_Exception); + virtual const std::string getStringValue(int element, int component) ; + virtual void setStringValue(int element, int component, const std::string& value) ; private: std::vector< std::vector > m_values; diff --git a/src/XAO/XAO_Xao.cxx b/src/XAO/XAO_Xao.cxx index 3fb767f06..6c521f6ca 100644 --- a/src/XAO/XAO_Xao.cxx +++ b/src/XAO/XAO_Xao.cxx @@ -69,13 +69,13 @@ Xao::~Xao() } } -const int Xao::countGroups() const +int Xao::countGroups() const { - return (int)m_groups.size(); + return m_groups.size(); } -Group* Xao::getGroup(const int& index) -throw (XAO_Exception) +Group* Xao::getGroup(int index) + { checkGroupIndex(index); @@ -89,8 +89,8 @@ throw (XAO_Exception) return NULL; } -Group* Xao::addGroup(const XAO::Dimension& dim, const std::string& name) -throw (XAO_Exception) +Group* Xao::addGroup(XAO::Dimension dim, const std::string& name) + { checkGeometry(); checkGroupDimension(dim); @@ -115,19 +115,19 @@ bool Xao::removeGroup(Group* group) return res; } -const int Xao::countFields() const +int Xao::countFields() const { - return (int)m_fields.size(); + return m_fields.size(); } -const XAO::Type Xao::getFieldType(const int& index) -throw (XAO_Exception) +XAO::Type Xao::getFieldType(int index) + { return getField(index)->getType(); } -Field* Xao::getField(const int& index) -throw (XAO_Exception) +Field* Xao::getField(int index) + { checkFieldIndex(index); @@ -141,8 +141,8 @@ throw (XAO_Exception) throw XAO_Exception("Field not found."); } -BooleanField* Xao::getBooleanField(const int& index) -throw (XAO_Exception) +BooleanField* Xao::getBooleanField(int index) + { Field* field = getField(index); if (field->getType() != XAO::BOOLEAN) @@ -150,8 +150,8 @@ throw (XAO_Exception) return (BooleanField*)field; } -DoubleField* Xao::getDoubleField(const int& index) -throw (XAO_Exception) +DoubleField* Xao::getDoubleField(int index) + { Field* field = getField(index); if (field->getType() != XAO::DOUBLE) @@ -159,8 +159,8 @@ throw (XAO_Exception) return (DoubleField*)field; } -IntegerField* Xao::getIntegerField(const int& index) -throw (XAO_Exception) +IntegerField* Xao::getIntegerField(int index) + { Field* field = getField(index); if (field->getType() != XAO::INTEGER) @@ -168,8 +168,8 @@ throw (XAO_Exception) return (IntegerField*)field; } -StringField* Xao::getStringField(const int& index) -throw (XAO_Exception) +StringField* Xao::getStringField(int index) + { Field* field = getField(index); if (field->getType() != XAO::STRING) @@ -177,8 +177,8 @@ throw (XAO_Exception) return (StringField*)field; } -Field* Xao::addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +Field* Xao::addField(XAO::Type type, XAO::Dimension dim, int nbComponents, const std::string& name) + { checkGeometry(); int nbElts = m_geometry->countElements(dim); @@ -187,8 +187,8 @@ throw (XAO_Exception) return field; } -IntegerField* Xao::addIntegerField(const XAO::Dimension& dim, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +IntegerField* Xao::addIntegerField(XAO::Dimension dim, int nbComponents, const std::string& name) + { checkGeometry(); int nbElts = m_geometry->countElements(dim); @@ -196,8 +196,8 @@ throw (XAO_Exception) m_fields.push_back(field); return field; } -BooleanField* Xao::addBooleanField(const XAO::Dimension& dim, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +BooleanField* Xao::addBooleanField(XAO::Dimension dim, int nbComponents, const std::string& name) + { checkGeometry(); int nbElts = m_geometry->countElements(dim); @@ -205,8 +205,8 @@ throw (XAO_Exception) m_fields.push_back(field); return field; } -DoubleField* Xao::addDoubleField(const XAO::Dimension& dim, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +DoubleField* Xao::addDoubleField(XAO::Dimension dim, int nbComponents, const std::string& name) + { checkGeometry(); int nbElts = m_geometry->countElements(dim); @@ -214,8 +214,8 @@ throw (XAO_Exception) m_fields.push_back(field); return field; } -StringField* Xao::addStringField(const XAO::Dimension& dim, const int& nbComponents, const std::string& name) -throw (XAO_Exception) +StringField* Xao::addStringField(XAO::Dimension dim, int nbComponents, const std::string& name) + { checkGeometry(); int nbElts = m_geometry->countElements(dim); @@ -241,7 +241,7 @@ bool Xao::removeField(Field* field) return res; } -const bool Xao::exportXAO(const std::string& fileName, const std::string& shapeFileName) +bool Xao::exportXAO(const std::string& fileName, const std::string& shapeFileName) { return XaoExporter::saveToFile(this, fileName, shapeFileName); } @@ -251,25 +251,23 @@ const std::string Xao::getXML() return XaoExporter::saveToXml(this); } -const bool Xao::importXAO(const std::string& fileName) +bool Xao::importXAO(const std::string& fileName) { return XaoExporter::readFromFile(fileName, this); } -const bool Xao::setXML(const std::string& xml) +bool Xao::setXML(const std::string& xml) { return XaoExporter::setXML(xml, this); } void Xao::checkGeometry() const -throw(XAO_Exception) { if (m_geometry == NULL) throw XAO_Exception("Geometry is null"); } -void Xao::checkGroupIndex(const int& index) const -throw(XAO_Exception) +void Xao::checkGroupIndex(int index) const { if (index >= 0 && index < countGroups()) return; @@ -278,8 +276,7 @@ throw(XAO_Exception) << countGroups()-1 << "]: " << index); } -void Xao::checkFieldIndex(const int& index) const -throw(XAO_Exception) +void Xao::checkFieldIndex(int index) const { if (index >= 0 && index < countFields()) return; @@ -288,8 +285,7 @@ throw(XAO_Exception) << countFields()-1 << "]: " << index); } -void Xao::checkGroupDimension(const XAO::Dimension& dim) const -throw(XAO_Exception) +void Xao::checkGroupDimension(XAO::Dimension dim) const { if (dim == XAO::WHOLE) throw XAO_Exception(MsgBuilder() << "Invalid dimension for group: " << dim); diff --git a/src/XAO/XAO_Xao.hxx b/src/XAO/XAO_Xao.hxx index 5354fc98c..6701510e0 100644 --- a/src/XAO/XAO_Xao.hxx +++ b/src/XAO/XAO_Xao.hxx @@ -115,7 +115,7 @@ namespace XAO * Sets the geometry. * \param geometry the geometry to set. */ - void setGeometry(Geometry* geometry) throw (XAO_Exception) + void setGeometry(Geometry* geometry) { if (m_geometry != NULL) throw XAO_Exception("Geometry already set."); @@ -131,20 +131,20 @@ namespace XAO * Gets the number of groups. * \return the number of groups. */ - const int countGroups() const; + int countGroups() const; /** * Gets a group. * \param index the index of the wanted group. * \return the group. */ - Group* getGroup(const int& index) throw (XAO_Exception); + Group* getGroup(int index) ; /** * Adds a group. * \param dim the dimension of the group. * \param name the name of the group. * \return the created group. */ - Group* addGroup(const XAO::Dimension& dim, const std::string& name = std::string("")) throw (XAO_Exception); + Group* addGroup(XAO::Dimension dim, const std::string& name = std::string("")) ; /** * Removes a group. * \param group the group to remove. @@ -160,26 +160,26 @@ namespace XAO * Gets the number of fields. * \return the number of fields. */ - const int countFields() const; + int countFields() const; /** * Gets the type of a field. * \param index the index of the wanted field. * \return the type of the field. */ - const XAO::Type getFieldType(const int& index) throw (XAO_Exception); + XAO::Type getFieldType(int index) ; /** * Gets a field. * \param index the index of the wanted field. * \return the field. */ - Field* getField(const int& index) throw (XAO_Exception); + Field* getField(int index) ; - BooleanField* getBooleanField(const int& index) throw (XAO_Exception); - DoubleField* getDoubleField(const int& index) throw (XAO_Exception); - IntegerField* getIntegerField(const int& index) throw (XAO_Exception); - StringField* getStringField(const int& index) throw (XAO_Exception); + BooleanField* getBooleanField(int index) ; + DoubleField* getDoubleField(int index) ; + IntegerField* getIntegerField(int index) ; + StringField* getStringField(int index) ; /** * Adds a field. @@ -189,18 +189,18 @@ namespace XAO * \param name the name of the field. * \return the created field. */ - Field* addField(const XAO::Type& type, const XAO::Dimension& dim, const int& nbComponents, + Field* addField(XAO::Type type, XAO::Dimension dim, int nbComponents, const std::string& name = std::string("")) - throw (XAO_Exception); + ; - BooleanField* addBooleanField(const XAO::Dimension& dim, const int& nbComponents, - const std::string& name = std::string("")) throw (XAO_Exception); - IntegerField* addIntegerField(const XAO::Dimension& dim, const int& nbComponents, - const std::string& name = std::string("")) throw (XAO_Exception); - DoubleField* addDoubleField(const XAO::Dimension& dim, const int& nbComponents, - const std::string& name = std::string("")) throw (XAO_Exception); - StringField* addStringField(const XAO::Dimension& dim, const int& nbComponents, - const std::string& name = std::string("")) throw (XAO_Exception); + BooleanField* addBooleanField(XAO::Dimension dim, int nbComponents, + const std::string& name = std::string("")) ; + IntegerField* addIntegerField(XAO::Dimension dim, int nbComponents, + const std::string& name = std::string("")) ; + DoubleField* addDoubleField(XAO::Dimension dim, int nbComponents, + const std::string& name = std::string("")) ; + StringField* addStringField(XAO::Dimension dim, int nbComponents, + const std::string& name = std::string("")) ; /** * Removes a field. @@ -218,7 +218,7 @@ namespace XAO * \param shapeFileName if not empty, export the shape to this external file. * \return true is the export is successful. */ - const bool exportXAO(const std::string& fileName, const std::string& shapeFileName); + bool exportXAO(const std::string& fileName, const std::string& shapeFileName); /** * Gets the XML corresponding to this XAO. * \return the XML as a string. @@ -230,19 +230,19 @@ namespace XAO * \param fileName the name of the file to import. * \return true if the import is successful. */ - const bool importXAO(const std::string& fileName); + bool importXAO(const std::string& fileName); /** * Sets an XML describing an XAO format to this object. * \param xml the XML to set. * \return true if the import is successful. */ - const bool setXML(const std::string& xml); + bool setXML(const std::string& xml); private: - void checkGeometry() const throw (XAO_Exception); - void checkGroupIndex(const int& index) const throw (XAO_Exception); - void checkFieldIndex(const int& index) const throw (XAO_Exception); - void checkGroupDimension(const XAO::Dimension& dim) const throw (XAO_Exception); + void checkGeometry() const ; + void checkGroupIndex(int index) const ; + void checkFieldIndex(int index) const ; + void checkGroupDimension(XAO::Dimension dim) const ; private: /** The author of the file. */ diff --git a/src/XAO/XAO_XaoExporter.cxx b/src/XAO/XAO_XaoExporter.cxx index cddabd7c3..7faadbf0b 100644 --- a/src/XAO/XAO_XaoExporter.cxx +++ b/src/XAO/XAO_XaoExporter.cxx @@ -116,14 +116,14 @@ namespace { void parseStepElementNode(xmlNodePtr eltNode, Step* step); std::string readStringProp(xmlNodePtr node, const xmlChar* attribute, - const bool& required, const std::string& defaultValue, + bool required, const std::string& defaultValue, const std::string& exception = std::string("")); int readIntegerProp(xmlNodePtr node, const xmlChar* attribute, - const bool& required, const int& defaultValue, + bool required, int defaultValue, const std::string& exception = std::string("")); std::string readStringProp(xmlNodePtr node, const xmlChar* attribute, - const bool& required, const std::string& defaultValue, + bool required, const std::string& defaultValue, const std::string& exception /*= std::string() */) { xmlChar* strAttr = xmlGetProp(node, attribute); @@ -147,7 +147,7 @@ namespace { } int readIntegerProp(xmlNodePtr node, const xmlChar* attribute, - const bool& required, const int& defaultValue, + bool required, int defaultValue, const std::string& exception /*= std::string() */) { xmlChar* strAttr = xmlGetProp(node, attribute); @@ -222,7 +222,7 @@ namespace { { // export the shape in the XAO file std::string txtShape = xaoGeometry->getShapeString(); - xmlNodePtr cdata = xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), (int)txtShape.size()); + xmlNodePtr cdata = xmlNewCDataBlock(doc, BAD_CAST txtShape.c_str(), txtShape.size()); xmlAddChild(shape, cdata); } else @@ -638,8 +638,8 @@ namespace { } } -const bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) -throw (XAO_Exception) +bool XaoExporter::saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) + { xmlDocPtr doc = exportXMLDoc(xaoObject, shapeFileName); xmlSaveFormatFileEnc(fileName.c_str(), doc, "UTF-8", 1); // format = 1 for node indentation @@ -649,7 +649,7 @@ throw (XAO_Exception) } const std::string XaoExporter::saveToXml(Xao* xaoObject) -throw (XAO_Exception) + { xmlDocPtr doc = exportXMLDoc(xaoObject, ""); @@ -662,8 +662,8 @@ throw (XAO_Exception) return (char*)xmlbuff; } -const bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject) -throw (XAO_Exception) +bool XaoExporter::readFromFile(const std::string& fileName, Xao* xaoObject) + { // parse the file and get the DOM int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; @@ -677,8 +677,8 @@ throw (XAO_Exception) return true; } -const bool XaoExporter::setXML(const std::string& xml, Xao* xaoObject) -throw (XAO_Exception) +bool XaoExporter::setXML(const std::string& xml, Xao* xaoObject) + { int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options); diff --git a/src/XAO/XAO_XaoExporter.hxx b/src/XAO/XAO_XaoExporter.hxx index af90b8b1c..5656eb5b5 100644 --- a/src/XAO/XAO_XaoExporter.hxx +++ b/src/XAO/XAO_XaoExporter.hxx @@ -47,8 +47,8 @@ namespace XAO * @param shapeFileName if not empty save the shape in an this external file. * @return true if the export was successful, false otherwise. */ - static const bool saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) - throw (XAO_Exception); + static bool saveToFile(Xao* xaoObject, const std::string& fileName, const std::string& shapeFileName) + ; /** * Saves the XAO object to a XML string. @@ -56,7 +56,7 @@ namespace XAO * @return the XML string. */ static const std::string saveToXml(Xao* xaoObject) - throw (XAO_Exception); + ; /** * Reads a XAO object from a file. @@ -64,8 +64,8 @@ namespace XAO * @param xaoObject the XAO object. * @return true if the XAO object was read successful, false otherwise. */ - static const bool readFromFile(const std::string& fileName, Xao* xaoObject) - throw (XAO_Exception); + static bool readFromFile(const std::string& fileName, Xao* xaoObject) + ; /** * Reads a XAO object from an XML string. @@ -73,8 +73,8 @@ namespace XAO * @param xaoObject the XAO object. * @return true if the XAO object was read successful, false otherwise. */ - static const bool setXML(const std::string& xml, Xao* xaoObject) - throw (XAO_Exception); + static bool setXML(const std::string& xml, Xao* xaoObject) + ; }; } diff --git a/src/XAO/XAO_XaoUtils.cxx b/src/XAO/XAO_XaoUtils.cxx index 144548269..4c64f6634 100644 --- a/src/XAO/XAO_XaoUtils.cxx +++ b/src/XAO/XAO_XaoUtils.cxx @@ -27,15 +27,14 @@ using namespace XAO; -const std::string XaoUtils::intToString(const int& value) +std::string XaoUtils::intToString(int value) { std::ostringstream str; str << value; return str.str(); } -const int XaoUtils::stringToInt(const std::string& value) -throw(XAO_Exception) +int XaoUtils::stringToInt(const std::string& value) { int res; std::istringstream convert(value); @@ -44,15 +43,14 @@ throw(XAO_Exception) return res; } -const std::string XaoUtils::doubleToString(const double& value) +std::string XaoUtils::doubleToString(double value) { std::ostringstream str; str << value; return str.str(); } -const double XaoUtils::stringToDouble(const std::string& value) -throw(XAO_Exception) +double XaoUtils::stringToDouble(const std::string& value) { double res; std::istringstream convert(value); @@ -61,15 +59,12 @@ throw(XAO_Exception) return res; } -const std::string XaoUtils::booleanToString(const bool& value) +std::string XaoUtils::booleanToString(bool value) { - if (value) - return "true"; - return "false"; + return value ? "true" : "false"; } -const bool XaoUtils::stringToBoolean(const std::string& value) -throw(XAO_Exception) +bool XaoUtils::stringToBoolean(const std::string& value) { if (value == "true" || value == "1") return true; @@ -79,8 +74,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Invalid boolean value: " << value); } -const std::string XaoUtils::dimensionToString(const XAO::Dimension& dimension) -throw(XAO_Exception) +std::string XaoUtils::dimensionToString(XAO::Dimension dimension) { if (dimension == XAO::VERTEX) return "vertex"; @@ -96,8 +90,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); } -const XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension) -throw(XAO_Exception) +XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension) { if (dimension == "vertex") return XAO::VERTEX; @@ -113,8 +106,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension); } -const std::string XaoUtils::fieldTypeToString(const XAO::Type& type) -throw(XAO_Exception) +std::string XaoUtils::fieldTypeToString(XAO::Type type) { if (type ==XAO:: BOOLEAN) return "boolean"; @@ -128,8 +120,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad type: " << type); } -const XAO::Type XaoUtils::stringToFieldType(const std::string& type) -throw(XAO_Exception) +XAO::Type XaoUtils::stringToFieldType(const std::string& type) { if (type == "boolean") return XAO::BOOLEAN; @@ -143,8 +134,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad type: " << type); } -const std::string XaoUtils::shapeFormatToString(const XAO::Format& format) -throw(XAO_Exception) +std::string XaoUtils::shapeFormatToString(XAO::Format format) { if (format == XAO::BREP) return "BREP"; @@ -154,8 +144,7 @@ throw(XAO_Exception) throw XAO_Exception(MsgBuilder() << "Bad format: " << format); } -const XAO::Format XaoUtils::stringToShapeFormat(const std::string& format) -throw(XAO_Exception) +XAO::Format XaoUtils::stringToShapeFormat(const std::string& format) { if (format == "BREP") return XAO::BREP; diff --git a/src/XAO/XAO_XaoUtils.hxx b/src/XAO/XAO_XaoUtils.hxx index 524e056ae..33bc891b4 100644 --- a/src/XAO/XAO_XaoUtils.hxx +++ b/src/XAO/XAO_XaoUtils.hxx @@ -78,7 +78,7 @@ namespace XAO * \param value the integer to convert. * \return the string. */ - static const std::string intToString(const int& value); + static std::string intToString(int value); /** * Converts a string into an integer. @@ -86,28 +86,28 @@ namespace XAO * \return the integer value. * \throw XAO_Exception if value cannot be converted to string. */ - static const int stringToInt(const std::string& value) throw(XAO_Exception); + static int stringToInt(const std::string& value); /** * Converts a double into a string. * \param value the double to convert. * \return the string. */ - static const std::string doubleToString(const double& value); + static std::string doubleToString(double value); /** * Converts a string into a double. * \param value the string to convert. * \return the double value. * \throw XAO_Exception if value cannot be converted to string. */ - static const double stringToDouble(const std::string& value) throw(XAO_Exception); + static double stringToDouble(const std::string& value); /** * Converts a boolean into a string. * \param value the boolean to convert. * \return the string. */ - static const std::string booleanToString(const bool& value); + static std::string booleanToString(bool value); /** * Converts a string into a boolean. * \param value the string to convert. @@ -115,7 +115,7 @@ namespace XAO * \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) throw(XAO_Exception); + static bool stringToBoolean(const std::string& value); /** * Converts a Dimension to string. @@ -123,7 +123,7 @@ namespace XAO * \return the dimension as a string. * \throw XAO_Exception */ - static const std::string dimensionToString(const XAO::Dimension& dimension) throw(XAO_Exception); + static std::string dimensionToString(XAO::Dimension dimension); /** * Converts a string into a Dimension. @@ -131,7 +131,7 @@ namespace XAO * \return the converted Dimension. * \throw XAO_Exception if dimension cannot be converted. */ - static const XAO::Dimension stringToDimension(const std::string& dimension) throw(XAO_Exception); + static XAO::Dimension stringToDimension(const std::string& dimension); /** * Converts a Type to string. @@ -139,7 +139,7 @@ namespace XAO * \return the Type as a string. * \throw XAO_Exception */ - static const std::string fieldTypeToString(const XAO::Type& type) throw(XAO_Exception); + static std::string fieldTypeToString(XAO::Type type); /** * Converts a string into a Type. @@ -147,7 +147,7 @@ namespace XAO * \return the converted Type. * \throw XAO_Exception if type cannot be converted. */ - static const XAO::Type stringToFieldType(const std::string& type) throw(XAO_Exception); + static XAO::Type stringToFieldType(const std::string& type); /** * Converts a Format to string. @@ -155,7 +155,7 @@ namespace XAO * \return the Format as a string. * \throw XAO_Exception */ - static const std::string shapeFormatToString(const XAO::Format& format) throw(XAO_Exception); + static std::string shapeFormatToString(XAO::Format format); /** * Converts a string into a Format. @@ -163,7 +163,7 @@ namespace XAO * \return the converted Format. * \throw XAO_Exception if format cannot be converted. */ - static const XAO::Format stringToShapeFormat(const std::string& format) throw(XAO_Exception); + static XAO::Format stringToShapeFormat(const std::string& format); }; /** -- 2.30.2