Salome HOME
Adjust to CVS HEAD modifications
[modules/smesh.git] / src / SMDS / SMDS_MeshElementIDFactory.hxx
index 8814676335d34505bea659a419044d47232ecfe0..526bcb5a051e773eee12cfe94c3a563a264ce9b4 100644 (file)
 #define _SMDS_MeshElementIDFactory_HeaderFile
 
 #include "SMDS_MeshIDFactory.hxx"
-#include <SMDS_Iterator.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);
-  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;
 
 };