X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshElementIDFactory.hxx;h=edab00727393fd79a34db94d658553b79c01b657;hb=c46bd4f9bb602f9863c817bcd622b1b70d5af1e9;hp=932ad057cd715fc64e10ec9f9442ddbfdd889699;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_MeshElementIDFactory.hxx b/src/SMDS/SMDS_MeshElementIDFactory.hxx index 932ad057c..edab00727 100644 --- a/src/SMDS/SMDS_MeshElementIDFactory.hxx +++ b/src/SMDS/SMDS_MeshElementIDFactory.hxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,26 +28,35 @@ #define _SMDS_MeshElementIDFactory_HeaderFile #include "SMDS_MeshIDFactory.hxx" +#include "SMDS_ElemIterator.hxx" -#include +#include class SMDS_MeshElement; -typedef std::map SMDS_IdElementMap; +typedef NCollection_DataMap SMDS_IdElementMap; class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory { - public: - SMDS_MeshElementIDFactory(); - bool BindID(int ID, SMDS_MeshElement * elem); - SMDS_MeshElement * MeshElement(int ID); - virtual int GetFreeID(); - virtual void ReleaseID(int ID); - int GetMaxID() const; - int GetMinID() const; - const SMDS_IdElementMap & GetIdElementMap() const { return myIDElements; } - private: - SMDS_IdElementMap myIDElements; +public: + SMDS_MeshElementIDFactory(); + bool BindID(int ID, SMDS_MeshElement * elem); + SMDS_MeshElement * MeshElement(int ID); + virtual int GetFreeID(); + virtual void ReleaseID(int ID); + int GetMaxID() const; + int GetMinID() const; + SMDS_ElemIteratorPtr elementsIterator() const; +private: + void updateMinMax() const; + void updateMinMax(int id) const + { + if (id > myMax) myMax = id; + if (id < myMin) myMin = id; + } + + SMDS_IdElementMap myIDElements; + mutable int myMin, myMax; };