Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/smesh.git] / src / SMDS / SMDS_MeshElementIDFactory.hxx
index f987eaed2d4c7bb67ec51b69441dbe03f3779425..edab00727393fd79a34db94d658553b79c01b657 100644 (file)
@@ -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
 //
 //
 //
 #define _SMDS_MeshElementIDFactory_HeaderFile
 
 #include "SMDS_MeshIDFactory.hxx"
+#include "SMDS_ElemIterator.hxx"
 
-#include <map>
-using namespace std;
+#include <NCollection_DataMap.hxx>
 
 class SMDS_MeshElement;
 
+typedef NCollection_DataMap<int, SMDS_MeshElement *> 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);
-  private:
-       map<int, SMDS_MeshElement *> 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;
 
 };